For oracle,
If I have a table A with data in number (such as price), how to write a function to format a number(10,2) to 9,9999.99 (<< obvious format).
And then how to use this function in SQL statement for displaying the data in table A.
Thank you.
----- UPDATE ----- From kindly suggestions below, yes, I should not treat numbers in this way. But I highly want to accomplish the task above
Here I come with the function
CREATE OR REPLACE FUNCTION Fmt_num(N1 in NUMBER)
RETURN CHAR
IS
BEGIN
RETURN TO_CHAR(N1,'FM9,9999.99');
END;
/
And I can use this with the SQL statement as follow
SELECT Fmt_num(price) from A;
It works ! However, Can anyone fixes the function above to let it works with "a number (10,2)"? Just this condition only. Thank you for your anticipate in this noob question. :)