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
 
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: 1281
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: 7315

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 HEX value search in a DB2 query maxsubrat DB2 2 Wed Oct 04, 2017 3:04 pm
No new posts Create procedure issues -628 when add... chandraBE DB2 1 Mon Sep 18, 2017 12:16 pm
No new posts Can we limit length in concatenation ... balaji81_k DB2 7 Tue Aug 22, 2017 2:50 am
No new posts Need DB2 query to fetch previous row ! Chandan1993 DB2 10 Sat Jun 03, 2017 10:43 am
No new posts JCL to Set Return code based on DB2 S... vinu78 DB2 17 Mon Mar 13, 2017 9:47 pm

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