Thread: Explicit Cast

Explicit Cast

From
Rhaoni Chiu Pereira
Date:
Hi List,

     As I already said .. I'm porting an Oracle DB to PostgreSQL and I must
rewrite most of the functions . So I have a problem to do something like this:

... atual_fatura in(''+'',''-'') ...

It gives me the following error:

 Unable to identify an operator '-' for types 'numeric' and 'character varying'
 You will have to retype this query using an explicit castenciosamente,

atual_fatura is a varchar field.

I read howto create an explicit cast but I didn't understand what I must do in
this case.

Can anybody help me ?


Rhaoni Chiu Pereira
Sistêmica Computadores

Visite-nos na Web: http://sistemica.info
Fone/Fax : +55 51 3328 1122






Re: Explicit Cast

From
"Mendola Gaetano"
Date:
"Rhaoni Chiu Pereira" <rhaoni@sistemica.info> wrote:
> Hi List,
>
>      As I already said .. I'm porting an Oracle DB to PostgreSQL and I
must
> rewrite most of the functions . So I have a problem to do something like
this:
>
> ... atual_fatura in(''+'',''-'') ...
>
> It gives me the following error:
>
>  Unable to identify an operator '-' for types 'numeric' and 'character
varying'
>  You will have to retype this query using an explicit castenciosamente,
>
> atual_fatura is a varchar field.
>
> I read howto create an explicit cast but I didn't understand what I must
do in
> this case.
>
> Can anybody help me ?

May we have more details on it ? Seems that you want add a numeric with a
varchar.


Regards
Gaetano Mendola



Re: Explicit Cast

From
Stephan Szabo
Date:
On Wed, 20 Aug 2003, Rhaoni Chiu Pereira wrote:

> Hi List,
>
>      As I already said .. I'm porting an Oracle DB to PostgreSQL and I must
> rewrite most of the functions . So I have a problem to do something like this:
>
> ... atual_fatura in(''+'',''-'') ...
>
> It gives me the following error:
>
>  Unable to identify an operator '-' for types 'numeric' and 'character varying'
>  You will have to retype this query using an explicit castenciosamente,
>
> atual_fatura is a varchar field.
>
> I read howto create an explicit cast but I didn't understand what I must do in
> this case.

Can you send the actual function you're having problems with and version
information?  I don't seem to get an error with a simple function that
uses such a construct on 7.3.4, but I expect the real example is more
complicated.