Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Fetch records with a column having non-specified characters

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
soundarr

New User


Joined: 17 Jan 2008
Posts: 25
Location: Chennai

PostPosted: Tue Jul 07, 2009 3:00 pm    Post subject: Fetch records with a column having non-specified characters
Reply with quote

Dear All,

Can you please suggest the easiest way to fetch records from a table with a column (char) having characters other than non-specified values.

For example: I need values which have characters other than A, B and C

i/p :
AC
ABC
ACD
IFB
GABC

o/p:
ACD
IFB
GABC

Thanks for having a look!

Best Regards,
Soundar
Back to top
View user's profile Send private message

dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Tue Jul 07, 2009 3:26 pm    Post subject:
Reply with quote

Sounds like a class project
you only want ROWS (there are no records in db2 tables)
which contain char D thru Z? (don't care about spaces, special char, lower case or numeric)
How large is the Column? (what is the length)

assuming that it is a 4 char column

Code:

SELECT ?
FROM table
WHERE SUBSTR(column,1,1) > 'D'
   OR SUBSTR(column,2,1) > 'D'
   OR SUBSTR(column,3,1) > 'D'
   OR SUBSTR(column,4,1) > 'D'


you could also reverse it and make it
WHERE
SUBSTR(column,1,1) > 'D'
or
SUBSTR(column,1,1) < 'A'
or
...
Back to top
View user's profile Send private message
soundarr

New User


Joined: 17 Jan 2008
Posts: 25
Location: Chennai

PostPosted: Tue Jul 07, 2009 3:44 pm    Post subject:
Reply with quote

To be exact, I need ROWS with characters other than A-Z, "-" and SPACE. Column is 200 characters long.

Thanks and Regards,
Soundar
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts DB2 query Using Recursion, Converting... smilewithashu2 DB2 1 Tue Jan 03, 2017 12:50 pm
No new posts Removing Duplicates based on certain ... chandracdac DFSORT/ICETOOL 8 Fri Dec 09, 2016 4:40 am
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts SQZ pipe delimited file with 1 column... Rick Silvers DFSORT/ICETOOL 2 Sun Nov 06, 2016 8:11 pm
No new posts How to split the records using the am... vnktrrd DFSORT/ICETOOL 24 Fri Oct 28, 2016 7:33 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us