469,300 Members | 2,176 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,300 developers. It's quick & easy.

How to add $ sign to number data type?

Hi Everybody,

I am fetching number data from a table. i want to add '$' sign to this data.
I already tried "TO_CHAR" function. This works fine but it converts number data type to string data type. I want it to be in number format only.
So, is there any way or any function that add '$' sign to number data without converting its data type?

Amit parmar
Jan 30 '08 #1
5 6785
debasisdas
8,127 Expert 4TB
If you want to use string data it will be string only.

If retrieving only for display then try to concadinate the $ with the data.
Jan 30 '08 #2
YOU HAVE TO USE TO_CHAR FUNCTION.

Expand|Select|Wrap|Line Numbers
  1.  
  2. SELECT TO_CHAR(SAL,'$99,999.00') FROM EMP;
  3. declare
  4.    v_num number;
  5. begin
  6.    v_num := to_number('$1234567.67','$9999999.99');
  7. end;
  8.  
  9.  
Jan 30 '08 #3
If you want to use string data it will be string only.

If retrieving only for display then try to concadinate the $ with the data.
Hi Debasisdas,

Thanks for your reply,
As i said, i want it in number or money data type only. If i concatenate number with $ sign then the result would be in string data type that i donít want.
If you know how to convert number data type to money data type then it would also helpful to me.

Amit Parmar
Jan 31 '08 #4
amitpatel66
2,367 Expert 2GB
Hi Debasisdas,

Thanks for your reply,
As i said, i want it in number or money data type only. If i concatenate number with $ sign then the result would be in string data type that i donít want.
If you know how to convert number data type to money data type then it would also helpful to me.

Amit Parmar
Oracle does not provide any thing as MONEY DATA TYPE.

Check out post #3 of this thread on how to concateate "$" symbol before the salary or any amount column to be displayed as $000.00.
Jan 31 '08 #5
debasisdas
8,127 Expert 4TB
Hi Debasisdas,

Thanks for your reply,
As i said, i want it in number or money data type only. If i concatenate number with $ sign then the result would be in string data type that i donít want.
If you know how to convert number data type to money data type then it would also helpful to me.

Amit Parmar
There is nothing like money datatype in oracle .
If you want to store pure numbers store in numbers else go for char type.
Jan 31 '08 #6

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

12 posts views Thread by tarmat | last post: by
4 posts views Thread by thomas | last post: by
10 posts views Thread by Sona | last post: by
6 posts views Thread by Steve K. | last post: by
11 posts views Thread by =?ISO-8859-1?Q?Konrad_M=FChler?= | last post: by
3 posts views Thread by Shailesh Patel | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by harlem98 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.