From: | "Aleksis Petrov" <a(dot)aleksis(at)gmail(dot)com> |
---|---|
To: | "Ranieri Mazili" <rmazili(at)wgsystems(dot)com(dot)br> |
Cc: | pgsql-general(at)postgresql(dot)org, pgsql-sql(at)postgresql(dot)org |
Subject: | Re: Setting variable |
Date: | 2007-06-19 14:20:55 |
Message-ID: | bd9c4fd00706190720w432a8bcw64a941d71993495f@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On 6/18/07, Ranieri Mazili <rmazili(at)wgsystems(dot)com(dot)br> wrote:
>
> 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
Try adding explicit casts with the "::" operator.
From | Date | Subject | |
---|---|---|---|
Next Message | Robert Treat | 2007-06-19 14:41:29 | Re: [GENERAL] [PERFORM] [ADMIN] Postgres VS Oracle |
Previous Message | Greg Smith | 2007-06-19 14:15:01 | Re: VACUUM ANALYZE extremely slow |