Setting variable

From: Ranieri Mazili <ranieri(dot)oliveira(at)terra(dot)com(dot)br>
To: pgsql-general(at)postgresql(dot)org, pgsql-sql(at)postgresql(dot)org
Subject: Setting variable
Date: 2007-06-18 14:29:43
Message-ID: 467696D7.2090703@terra.com.br
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-sql

Hello,
I need to know why can't I do it?

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

How can I solve it?

Thanks

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ranieri Mazili 2007-06-18 14:34:21 Setting Variable - (Correct)
Previous Message Ranieri Mazili 2007-06-18 14:29:35 Setting variable

Browse pgsql-sql by date

  From Date Subject
Next Message Ranieri Mazili 2007-06-18 14:34:21 Setting Variable - (Correct)
Previous Message A. Kretschmer 2007-06-18 13:19:00 Re: Exec a text variable as select