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
 

 

Query required - New

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

New User


Joined: 24 Jul 2012
Posts: 5
Location: india

PostPosted: Mon Aug 06, 2012 3:59 pm    Post subject: how to format string using query
Reply with quote

data thatis in table

01
02
03
04
05
06
07
08
09
10
11
12

i want the ou[put like:

01,02,03,04,05,06,07,08,09,10,11,12


how to format using the query


plz help me
Back to top
View user's profile Send private message

GuyC

Senior Member


Joined: 11 Aug 2009
Posts: 1278
Location: Belgium

PostPosted: Mon Aug 06, 2012 4:49 pm    Post subject:
Reply with quote

not that it is any faster but this also works :
Code:
where translate(substr(col1,1,1),'','ABCDEFGHIJKLMNOPQRSTUVWXYZ') = ''
and translate(substr(col1,2,4),'','0123456789') = ''


and you could add following to limit the tablescan (if an index exists)
Code:
and col1 between 'A' and 'Z'

about omitting the criteria in your select, and test it in your program :
A lot more rows will have to be transported from DB2 to your program =
A lot more fetches will need to be done =
more cpu
Back to top
View user's profile Send private message
Kjeld

Active User


Joined: 15 Dec 2009
Posts: 365
Location: Denmark

PostPosted: Mon Aug 06, 2012 5:06 pm    Post subject:
Reply with quote

Hi Muthupandi,

Don't reuse old posts, but open a new topic, and provide all neccessary information on your SQL query including what you have tried yourself. Remember, this is not a please do my homework for me forum, but a forum for help when people get stuck in a problem.

Dick or any moderator, please lock this thread.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7255

PostPosted: Mon Aug 06, 2012 5:15 pm    Post subject: Reply to: Query required - New
Reply with quote

muthupandi.

This is also a duplicate of one in the DFSORT forum. Please one topic for one question.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Mon Aug 06, 2012 7:00 pm    Post subject:
Reply with quote

Hello,

Are you looking for a database solution or a sort solution?

The answer is not "both". . .
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 Join in SQL Query vickey_dw DB2 2 Tue Jan 17, 2017 12:15 am
This topic is locked: you cannot edit posts or make replies. MQ setup query mohitsaini Java & MQSeries 4 Sun Jan 08, 2017 1:53 am
No new posts DB2 query Using Recursion, Converting... smilewithashu2 DB2 1 Tue Jan 03, 2017 12:50 pm
No new posts SQL query to run through list of valu... Ni3-db2 DB2 14 Wed Dec 14, 2016 9:52 am
This topic is locked: you cannot edit posts or make replies. Db2 SQL query to convert rows into co... subratarec DB2 5 Thu Nov 17, 2016 4:51 pm


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