IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

select prefix 2 extra characters


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
muthukumar

New User


Joined: 24 Mar 2004
Posts: 29

PostPosted: Thu Sep 02, 2004 12:02 pm
Reply with quote

Hi,

I tried unloading a table with DSNTIAUL program and i have following issues.. can one of u help me to solve this.

1) With Select A||'|'||.... query the result dataset set has two special characters prefixed to the value of A. Any techniques to avoid this?

2) Also i have Null values for a field in the table. When i concatenate this field with other field using || an error message that invalid parameter for ||. Is there any methods to concatenate null values too.

thanks and regards
Muthu
Back to top
View user's profile Send private message
ovreddy

Active User


Joined: 06 Dec 2004
Posts: 211
Location: Keane Inc., Minneapolis USA.

PostPosted: Tue Mar 08, 2005 12:43 pm
Reply with quote

Hi Muthu,

1 Ans: You can use RIGHT function to remove left most 2 unwanted characters. The RIGHT function returns the rightmost integer bytes of string-expression.

select RIGHT(A || ',' || B ||.......,LENGTH-2) from <table>;

2 Ans: Yes, we can concatinate null values by using COALESCE. COALESCE returns the first argument that is not NULL. The arguments are evaluated in the order in which they are specified. This function is usually used to replace NULL values with a not NULL value.

SELECT COLUMN A || COALESCE(COLUMN B,'') from <TABLE>;

COLUMN B value will be replaced by '' if it is NULL.

Bye,
Reddy.
Back to top
View user's profile Send private message
muthukumar

New User


Joined: 24 Mar 2004
Posts: 29

PostPosted: Tue Mar 08, 2005 12:50 pm
Reply with quote

Hi Reddy,

thanks for the information.

regards
Muthu
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Inserting into table while open selec... DB2 1
No new posts Substring number between 2 characters... DFSORT/ICETOOL 2
No new posts Dynamically pass table name to a sele... DB2 2
No new posts Reading dataset in Python - New Line ... All Other Mainframe Topics 22
No new posts SELECT from data change table DB2 5
Search our Forums:

Back to Top