Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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: 6968
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 Binary to display characters Roy Ware SYNCSORT 3 Tue Sep 19, 2017 8:46 pm
No new posts column with count of rows within dist... ronald wouterson DB2 4 Sun Sep 17, 2017 9:48 pm
No new posts Convert rows and column into JSON for... Dinesh Manivannan DB2 2 Sun Sep 03, 2017 6:50 pm
No new posts Join records from 2 files with No Dup... Poha Eater DFSORT/ICETOOL 21 Sun Aug 27, 2017 10:35 pm
No new posts Select numeric portion from CHAR data... balaji81_k DB2 6 Sat Aug 19, 2017 1:51 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us