Home » SQL & PL/SQL » SQL & PL/SQL » to left align the number fields (sql plus)
to left align the number fields [message #446980] Thu, 11 March 2010 04:23 Go to next message
devi_vi
Messages: 10
Registered: March 2010
Location: bangalore
Junior Member
hi all,

Is there any way to align the output data of sql plus.
for eg., if i give "select custname, custid, custage from cust;"
the ouput am getting is,
custname   custid  custage
aaa             1       23
bbbbb           2       22
cccc            3       45
dddddddd        4       21
but i need to left align the custid and custage.
my output should look like,
custname   custid  custage
aaa        1       23
bbbbb      2       22
cccc       3       45
dddddddd   4       21

is ther anyway to do this...

pls help if someone knows the solution....

[EDITED by LF: applied [pre] tags]

[Updated on: Thu, 11 March 2010 05:25] by Moderator

Report message to a moderator

Re: to left align the number fields [message #446981 is a reply to message #446980] Thu, 11 March 2010 04:30 Go to previous messageGo to next message
pablolee
Messages: 2813
Registered: May 2007
Location: Scotland
Senior Member
I see no difference in your outputs. If you have a look at the forum guidelines, they will show you how to use tags in order to properly format and structure your posts. remeber that there is a preview button for you to check how your post will look prior to actually posting it.
Re: to left align the number fields [message #446984 is a reply to message #446980] Thu, 11 March 2010 04:36 Go to previous messageGo to next message
devi_vi
Messages: 10
Registered: March 2010
Location: bangalore
Junior Member
sorry everyone., the spaces input and output which i gave got trimed.... so both of them looks like the same.,

but the thing is I need to left align the number fields which is in the putput of sqlplus.

thanks.
Re: to left align the number fields [message #446985 is a reply to message #446984] Thu, 11 March 2010 04:38 Go to previous messageGo to next message
delna.sexy
Messages: 941
Registered: December 2008
Location: Surat, The Diamond City
Senior Member
Convert those NUMBERs in CHARs.

regards,
Delna
Re: to left align the number fields [message #446990 is a reply to message #446980] Thu, 11 March 2010 04:49 Go to previous messageGo to next message
devi_vi
Messages: 10
Registered: March 2010
Location: bangalore
Junior Member
is there any direct way to convert number to char?

[Updated on: Thu, 11 March 2010 04:54]

Report message to a moderator

Re: to left align the number fields [message #446991 is a reply to message #446990] Thu, 11 March 2010 05:00 Go to previous messageGo to next message
JRowbottom
Messages: 5933
Registered: June 2006
Location: Sunny North Yorkshire, ho...
Senior Member
Other than TO_CHAR?
Re: to left align the number fields [message #446993 is a reply to message #446984] Thu, 11 March 2010 05:18 Go to previous messageGo to next message
Michel Cadot
Messages: 63804
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
devi_vi wrote on Thu, 11 March 2010 11:36
sorry everyone., the spaces input and output which i gave got trimed.... so both of them looks like the same.,

but the thing is I need to left align the number fields which is in the putput of sqlplus.

thanks.

This is why there are 2 things:
1/ A OraFAQ Forum Guide that explains you how to post
2/ A Preview button that allows you to see how your post will look like.

Please use both.

Regards
Michel

[Updated on: Thu, 11 March 2010 05:18]

Report message to a moderator

Re: to left align the number fields [message #447262 is a reply to message #446980] Fri, 12 March 2010 15:52 Go to previous message
Bill B
Messages: 1457
Registered: December 2004
Senior Member
say your field is 14 characters long then


select rpad(to_char(my_num),14,' ') from my_table;
Previous Topic: Performing TYPE 2 operation using Merge in 10g
Next Topic: Procedure Insert Into
Goto Forum:
  


Current Time: Mon Sep 26 23:11:33 CDT 2016

Total time taken to generate the page: 0.11226 seconds