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: 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 Loading data to table gives wrong for... Raghu navaikulam DB2 16 Thu Jul 13, 2017 2:11 pm
No new posts Need DB2 query to fetch previous row ! Chandan1993 DB2 10 Sat Jun 03, 2017 10:43 am
No new posts Check if any Detail records and extra... V S Amarendra Reddy SYNCSORT 19 Mon May 08, 2017 8:54 pm
No new posts Join giving more records than expected Danielle.Filteau SYNCSORT 2 Thu Mar 09, 2017 3:28 am
No new posts TSO or command line utility to genera... kishpra JCL & VSAM 3 Thu Mar 09, 2017 1:11 am


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