Re: VARCHAR to INTEGER conversion

From: Jeff Eckermann <jeff_eckermann(at)yahoo(dot)com>
To: Darren Ferguson <darren(at)crystalballinc(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: VARCHAR to INTEGER conversion
Date: 2002-01-17 15:09:51
Message-ID: 20020117150951.61361.qmail@web20807.mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

PostgreSQL allows for function overloading, i.e. you
can create another function with the same name (and
same logic) that takes a VARCHAR parameter.
PostgreSQL will figure out which function you want,
based on the datatype of the parameter that you pass
to it.

IIRC, if you use pl/pgsql for your function, any type
casting required internally in the function (to get to
your return type) will be handled automagically.

--- Darren Ferguson <darren(at)crystalballinc(dot)com> wrote:
> Hello list
>
> 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.
>
> Thanks in advance
>
> Darren Ferguson
>
>
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please
> send an appropriate
> subscribe-nomail command to majordomo(at)postgresql(dot)org
> so that your
> message can get through to the mailing list cleanly

__________________________________________________
Do You Yahoo!?
Send FREE video emails in Yahoo! Mail!
http://promo.yahoo.com/videomail/

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Darren Ferguson 2002-01-17 15:17:19 Re: VARCHAR to INTEGER conversion
Previous Message Jan Wieck 2002-01-17 15:04:26 Re: [HACKERS] CREATE OR REPLACE VIEW / TRIGGER