Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Question on aligning char to the right side.

Phil in SydneyJun 22 2009 — edited Jun 22 2009
Hi there,

I got stuck on displaying numbers in varchar2.
As I saw the result of a select cmd, if the data type is char,
the result will be displayed as aligned left. If the data type is number,
the result is aligned right.
Say
create table tmp1(
id number,
name varchar2(10)
);

insert tmp1 values(1,'1');
insert tmp1 values(2,'2');
insert tmp1 values(3,'John');

select id,name from tmp1;

id name
1 1
2 2
3 John

How can I align the name column right?
In other words, how to make char column right aligned?
This is the result what I want.(To line them up, I used underline in Name column.)
id name
1 ____1
2 ____2
3 John


Thanks.


Phil
This post has been answered by SanjayRs on Jun 22 2009
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 20 2009
Added on Jun 22 2009
2 comments
3,447 views