Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

number format mask: Avoid trailing comma in integers

juliojgsMar 24 2014 — edited Mar 24 2014

Hi,

I'm exporting some data from plsql via plain xml files

(my decimal separator is comma ",", but I don't think it's important)

When I have to export numbers, I just concat the tags with the values.

I thought it was working ok, but the problem is that when the number is, for example, 0.1234 it showed

<value>.1234</value>

instead of :

<value>0,1234</value>

So I worked out this solution:

to_number(myvar, 'FM9999999990D99999')

and it seemed to work, but now, with integer values, it sends a trailing comma, like this:

select '<value>'||to_char(1234, 'FM9999990D999999') ||'</value>' from DUAL;

<value>1234,</value>

I can rtrim the comma, but ...WTF!!

This post has been answered by Frank Kulash on Mar 24 2014
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 21 2014
Added on Mar 24 2014
4 comments
877 views