Skip to Main Content

Oracle Database Discussions

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!

number format to string format

Green-bitDec 27 2013 — edited Dec 31 2013

Hello guys, in a sql I am trying to convert a number format to string format.

create table test_cpy (name varchar2(20), age number(2), salary number(35));

insert into test_cpy values ('a',20,3746583);

select name||','||age||','||'="'+salary+'"' from test_cpy;

The reason for the number to text conversion is because the data in the table will be exported to another file in csv format and will be viewed in excel sheet and the numbers with large value will have an exponential value to it and I want to display the entire number as it is. The only to do that is to convert the number to text format.

To convert the number format to string format I used the following.

select name|| ',' || age || ',' || '="'+salary+'"' from test_cpy;

(the above sql is giving me an error ora-01722:invalid number)

I tried select name|| ',' || age || ',' || to_char(salary) from test_cpy;

but when I finally view the data in the excel, I am still getting the exponential values instead of the actual numbers

5.03479E+15

Can someone please help me how to proceed with this.

Thank You

This post has been answered by Green-bit on Dec 31 2013
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 28 2014
Added on Dec 27 2013
4 comments
2,607 views