SQLplus script to format text as numeric
-
02-07-2019 - |
Question
I am selecting rows from a table, but some of the columns are a text type, but they always have numeric data in them. How can I format them as numbers?
e.g. column quantity heading 'Quantity' format 999,999
However, since the column in the table is text, the numeric formatting is ignored.
Solution
You will need to TO_NUMBER the column in your query.
OTHER TIPS
To render with thousand seperators, you'll need to...
to_char(to_number(quantity), '999,999')
Thanks Steve,
I can now have:
column quantity heading 'Quantity' format 999,999 select TO_NUMBER(quantity) as quantity from Sales
And I get a right justified report.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow