Casting Varchar to Numeric - Mailing list pgsql-general

From Andy Marden
Subject Casting Varchar to Numeric
Date
Msg-id 9tvo1j$1u7g$1@news.tht.net
Whole thread Raw
Responses Re: Casting Varchar to Numeric
Re: Casting Varchar to Numeric
Re: Casting Varchar to Numeric
List pgsql-general
Just undertaking a port of a small Data Warehouse-type batch load
application from Oracle to PostgreSQL. It's common practice in such a system
to load data into a staging table whose fields are typically all varying
text. Then the conversion and mapping of the data is done as a second stage
into the 'proper' tables.

In Oracle, you can put a text field into a numeric field as long as it
contains a number and teh conversion will be implicit (or you can simply
specify to_number(value)) to make the conversion explicitly.

In PostgreSQL, it seems that an error is thrown up if an implicit conversion
is attempted, and the only explicit conversion seems to be to_number(value,
format) which doesn't do what's needed generically enough.

I can't believe that this isn't possible - can anyone point me in the right
direction?

Cheers

Andy Marden



pgsql-general by date:

Previous
From: William WAISSE
Date:
Subject: Re: newbie needs help with postgres internal tables
Next
From: Karel Zak
Date:
Subject: Re: Casting Varchar to Numeric