Adding a leading dollar sign ($) in front of a number in Oracle

There are two ways of adding a leading dollar sign to numbers in Oracle. You can either define teh column with a number format which display number with a dollar sign or you can define it in you select statement as follows:

select name, to_char(salary, '$9,999,990,99') from salarytable

to_char is used to change string formatting. Here we add $ and a comma after every three digits left of the decimal. We also specified that there are two decimal places. Without the 0 in the middle, you would get $.00 instead of $0.00 when the salary is 0.