Re: How to transform pg_7.4 function 'to_number' to 8.4 equivalent? - Mailing list pgsql-novice

From Tom Lane
Subject Re: How to transform pg_7.4 function 'to_number' to 8.4 equivalent?
Date
Msg-id 25414.1224269024@sss.pgh.pa.us
Whole thread Raw
In response to How to transform pg_7.4 function 'to_number' to 8.4 equivalent?  (Ennio-Sr <nasr.laili@tin.it>)
Responses Re: How to transform pg_7.4 function 'to_number' to 8.4 equivalent?
List pgsql-novice
Ennio-Sr <nasr.laili@tin.it> writes:
> after upgrading from pg_7.4 to pg_8.3  when I run this command:

> psql finanza -c "SELECT titolo, var, pr_chius, pr_aper, \
> diff_aper_ch*(-1) as \"diff. ass.\", \
> to_number(diff_aper_ch*(-1)/pr_aper*100::float(8),'9999.000000') as \"sc. %\" \

to_number works on text arguments.  I suppose you could make this work
like 7.4 by explicitly casting the expression to text, but the whole
thing seems like the wrong approach altogether.  What are you trying to
accomplish --- round the result to six decimal places?  If so, it'd be
better to just cast it to numeric(20,6) or some such.

            regards, tom lane

pgsql-novice by date:

Previous
From: Tom Lane
Date:
Subject: Re: "timestamp without timezone" and at "time zone"
Next
From: "Morris, Roy"
Date:
Subject: Re: How to transform pg_7.4 function 'to_number' to 8.4 equivalent?