Re: [SQL] Setting variable

From: Michael Glaesemann <grzm(at)seespotcode(dot)net>
To: Ranieri Mazili <ranieri(dot)oliveira(at)terra(dot)com(dot)br>
Cc: pgsql-general(at)postgresql(dot)org, pgsql-sql(at)postgresql(dot)org
Subject: Re: [SQL] Setting variable
Date: 2007-06-18 14:43:55
Message-ID: 0AF9CCEA-787E-42F3-8EFB-3CCF684A3D70@seespotcode.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-sql


On Jun 18, 2007, at 9:29 , Ranieri Mazili wrote:

> CREATE OR REPLACE FUNCTION lost_hours_temp(date)
> RETURNS text AS
> $BODY$
> DECLARE
> START_DATE date;
> END_DATE date;
> QUERY text;
> BEGIN
> START_DATE := $1;
> END_DATE := START_DATE - interval '3 year';
>
> The last line (END_DATE := START_DATE - interval '3 year';)
> generate the following error:
>
> ERROR: operator is not unique: "unknown" / "unknown"
> SQL state: 42725
> Hint: Could not choose a best candidate operator. You may need to
> add explicit type casts.
> Context: PL/pgSQL function "lost_hours_temp" line 10 at assignment

Note that the error is at line 10. You've only shown lines 1 through
7 of the function body, so you haven't actually shown us where the
error is.

Michael Glaesemann
grzm seespotcode net

In response to

Browse pgsql-general by date

  From Date Subject
Next Message g.hintermayer 2007-06-18 15:14:59 Re: Apparent Wraparound?
Previous Message Tom Lane 2007-06-18 14:42:22 Re: pg_restore out of memory

Browse pgsql-sql by date

  From Date Subject
Next Message Michael Glaesemann 2007-06-18 15:17:45 Re: Setting Variable - (Correct)
Previous Message Ranieri Mazili 2007-06-18 14:34:21 Setting Variable - (Correct)