By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
462,281 Members | 488 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 462,281 IT Pros & Developers. It's quick & easy.

How to add $ sign to number data type?

P: 4
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
Share this Question
Share on Google+
5 Replies

debasisdas
Expert 5K+
P: 8,127
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

P: 93
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

P: 4
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
Expert 100+
P: 2,367
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
Expert 5K+
P: 8,127
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.