I think that
        ltrim(to_char(n), '0') || 'A'
gives the same result as
                     to_char(n)       || 'A'

If you want to retain the leading zero but drop any trailing zeros you can
do:
WITH nums AS
 (SELECT 0.008499 n FROM dual UNION ALL
 SELECT 0.01795 n FROM dual UNION ALL
 SELECT 0.05390 n FROM dual UNION ALL
 SELECT 0.1078 n FROM dual UNION ALL
 SELECT 0.0082 n FROM dual UNION ALL
 SELECT 0.01366667 n FROM dual UNION ALL
 SELECT 0.00969 n FROM dual
)
SELECT rtrim (to_char(n,'0.999999999'),'0') || 'A' res FROM nums;







2011/3/17 Ivan Doroshenko <zider...@gmail.com>

> Using to_char formatting mask implies fixed result length.
> If you want variable length, try:
>
> WITH nums AS
>  (SELECT 0.008499 n FROM dual UNION ALL
>  SELECT 0.01795 n FROM dual UNION ALL
>  SELECT 0.0539 n FROM dual UNION ALL
>  SELECT 0.1078 n FROM dual UNION ALL
>  SELECT 0.0082 n FROM dual UNION ALL
>  SELECT 0.01366667 n FROM dual UNION ALL
>  SELECT 0.00969 n FROM dual
> )
>
> SELECT ltrim(to_char(n), '0') || 'A' res FROM nums
>
>
> On 16 мар, 21:39, teo <teomana...@gmail.com> wrote:
> > Hi everyone,
> >
> > I have a table with NUMBER(38,8) column named PRICE. Below there are
> > some values of this table.
> >
> > 0,008499
> > 0,01795
> > 0,0539
> > 0,1078
> > 0,0082
> > 0,01366667
> > 0,00969
> >
> > I need to concat this values with a text. I use to_char(PRICE) || 'A'
> > the result is like below. Bu as you can see there are no zero (0) How
> > can i concat this values exactly?
> >
> > ,008499A
> > ,01795A
> > ,0539A
> > ,1078A
> > ,0082A
> > ,01366667A
> > ,00969A
>
> --
> You received this message because you are subscribed to the Google
> Groups "Oracle PL/SQL" group.
> To post to this group, send email to Oracle-PLSQL@googlegroups.com
> To unsubscribe from this group, send email to
> oracle-plsql-unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/Oracle-PLSQL?hl=en
>

-- 
You received this message because you are subscribed to the Google
Groups "Oracle PL/SQL" group.
To post to this group, send email to Oracle-PLSQL@googlegroups.com
To unsubscribe from this group, send email to
oracle-plsql-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/Oracle-PLSQL?hl=en

Reply via email to