-
Hi,
I'm trying to output the contents of a table to a spool file. However, my select statement contains the 'to_char' operator that calculates and formats a field this seems to be altering my output to include an extra space eg
select name||age||height from person;
gives an output of
billy30150 ----where name=billy age=30 height=150
brian22139
but if I change the sql to
select name||to_char(age+15,'99')||height from person;
gives an output of
billy 40150
brian 32139
How do I ensure the 'new' space between name and calculated age does not appear??
I've tried to keep the example simple....I hope it makes sense!!
Any suggestions most welcome....
Thanks in advance
Moff.
-
Try using LTRIM(TO_CHAR(age+15,'99')).
Hope this helps
Matt
-
Use the LTRIM function
select col1 || LTRIM(TO_CHAR(col2+15,'99')) || col3
from TEST_SAN
A farmer learns more from a bad harvest than a good one
-
Works a treat....
Thanks for your help
Moff.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|