From: | Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com> |
---|---|
To: | Darren Ferguson <darren(at)crystalballinc(dot)com> |
Cc: | <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: VARCHAR to INTEGER conversion |
Date: | 2002-01-17 01:49:20 |
Message-ID: | 20020116174450.U48091-100000@megazone23.bigpanda.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Wed, 16 Jan 2002, Darren Ferguson wrote:
> I have a stored procedure that takes in an integer
>
> sp_customer_service_property_descr(INTEGER)
>
> However i have a database field that is a VARCHAR because it can take
> either a number that would have to go into this stored procedure or it can
> just have normal text depending on the value of another field.
>
> I tried casting the VARCHAR as an INTEGER postgres (V7.2b4) doesn't let me
> do this. Now i understand why it is not letting me do this however here is
> my question
>
> Does anyone know of a work around so that i can call this function with
> the varchar database field.
If the rows you're working with won't have non-numeric values I think you
can do this by casting through text (varchar->text->integer). If the value
may not be a number that will still fail on those rows.
From | Date | Subject | |
---|---|---|---|
Next Message | DAESEON LEE | 2002-01-17 02:04:31 | in postgresql BLOB type (that is),question about oid type? |
Previous Message | Christian Schröder | 2002-01-17 01:31:13 | pg_dump behaviour changed in 7.1.3? |