pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
cast varchar to numeric/money
4+ messages / 3 participants
[nested] [flat]

* cast varchar to numeric/money
@ 2003-11-21 17:47  Yudie <yudie@axiontech.com>
  0 siblings, 1 reply; 4+ messages in thread

From: Yudie @ 2003-11-21 17:47 UTC (permalink / raw)
  To: pgsql-sql

Hi guys,

I know it's impossible to just cast varchar to any numeric datatype,
but is there another function/ custom function or any way to force to do
that convertion.

please help

Thanks..

Yudie




^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: cast varchar to numeric/money
@ 2003-11-21 17:55  Bruno Wolff III <bruno@wolff.to>
  parent: Yudie <yudie@axiontech.com>
  0 siblings, 1 reply; 4+ messages in thread

From: Bruno Wolff III @ 2003-11-21 17:55 UTC (permalink / raw)
  To: Yudie <yudie@axiontech.com>; +Cc: pgsql-sql

On Fri, Nov 21, 2003 at 11:47:42 -0600,
  Yudie <yudie@axiontech.com> wrote:
> Hi guys,
> 
> I know it's impossible to just cast varchar to any numeric datatype,
> but is there another function/ custom function or any way to force to do
> that convertion.

You can use to_number to go from text to numeric.



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: cast varchar to numeric/money
@ 2003-11-21 18:26  Yudie <yudie@axiontech.com>
  parent: Bruno Wolff III <bruno@wolff.to>
  0 siblings, 1 reply; 4+ messages in thread

From: Yudie @ 2003-11-21 18:26 UTC (permalink / raw)
  To: pgsql-sql

I don't have to_numeric function in my 7.2.2 postgre.
then it can resolve it with: 

cast(substr(varcharcolumn,0) as float4)

thanks.



----- Original Message ----- 
From: "Bruno Wolff III" <bruno@wolff.to>
To: "Yudie" <yudie@axiontech.com>
Cc: <pgsql-sql@postgresql.org>
Sent: Friday, November 21, 2003 11:55 AM
Subject: Re: [SQL] cast varchar to numeric/money


On Fri, Nov 21, 2003 at 11:47:42 -0600,
  Yudie <yudie@axiontech.com> wrote:
> Hi guys,
> 
> I know it's impossible to just cast varchar to any numeric datatype,
> but is there another function/ custom function or any way to force to do
> that convertion.

You can use to_number to go from text to numeric.




^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: cast varchar to numeric/money
@ 2003-11-21 19:12  Tomasz Myrta <jasiek@klaster.net>
  parent: Yudie <yudie@axiontech.com>
  0 siblings, 0 replies; 4+ messages in thread

From: Tomasz Myrta @ 2003-11-21 19:12 UTC (permalink / raw)
  To: Yudie <yudie@axiontech.com>; +Cc: pgsql-sql

Dnia 2003-11-21 19:26, Użytkownik Yudie napisał:
> I don't have to_numeric function in my 7.2.2 postgre.
> then it can resolve it with: 
> 
> cast(substr(varcharcolumn,0) as float4)

Read once again. The function is not "to_numeric", but "to_number".
You can read about this function in manual:
6.7. Data Type Formatting Functions

Regards,
Tomasz Myrta




^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2003-11-21 19:12 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-11-21 17:47 cast varchar to numeric/money Yudie <yudie@axiontech.com>
2003-11-21 17:55 ` Bruno Wolff III <bruno@wolff.to>
2003-11-21 18:26   ` Yudie <yudie@axiontech.com>
2003-11-21 19:12     ` Tomasz Myrta <jasiek@klaster.net>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox