Re: Executing dynamic procedure call

From: Craig Ringer <craig(at)postnewspapers(dot)com(dot)au>
To: tekwiz <ryoung(at)medicalpharmacies(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Executing dynamic procedure call
Date: 2008-05-03 18:27:54
Message-ID: 481CAEAA.2060201@postnewspapers.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

tekwiz wrote:

> Result:
>
> DBD::Pg:st execute failed: ERROR: operator does not exist: money <>
> integer
> HINT: No operator matches the given name and argument type(s). You may
> need to add explicit type casts.
> CONTEXT: SQL statement "SELECT (( $1 - $2 - $3 - $4 - $%) <> 0)"

craig=# SELECT '0'::money <> 0;
ERROR: operator does not exist: money <> integer
LINE 1: SELECT '0'::money <> 0;
^
HINT: No operator matches the given name and argument type(s). You
might need to add explicit type casts.

You are trying to compare a value of `money' data type with a value of
`integer' data type. This is intentionally not permitted. Since, in your
case, it looks like the 0 is an integer literal you should be doing:

( moneyvar1 - moneyvar2 - moneyvar3etc ) <> '0'::money;

In the longer run you might want to look into using the NUMERIC data
type instead of the MONEY type.

--
Craig Ringer

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2008-05-03 18:33:18 Re: clustering without locking
Previous Message Craig Ringer 2008-05-03 18:19:14 Re: clustering without locking