pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedSetting variable
2+ messages / 2 participants
[nested] [flat]
* Setting variable
@ 2007-06-18 14:29 Ranieri Mazili <ranieri.oliveira@terra.com.br>
2007-06-18 14:43 ` Re: [SQL] Setting variable Michael Glaesemann <grzm@seespotcode.net>
0 siblings, 1 reply; 2+ messages in thread
From: Ranieri Mazili @ 2007-06-18 14:29 UTC (permalink / raw)
To: pgsql-general@postgresql.org; 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
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: [SQL] Setting variable
2007-06-18 14:29 Setting variable Ranieri Mazili <ranieri.oliveira@terra.com.br>
@ 2007-06-18 14:43 ` Michael Glaesemann <grzm@seespotcode.net>
0 siblings, 0 replies; 2+ messages in thread
From: Michael Glaesemann @ 2007-06-18 14:43 UTC (permalink / raw)
To: Ranieri Mazili <ranieri.oliveira@terra.com.br>; +Cc: pgsql-general@postgresql.org; 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
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2007-06-18 14:43 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2007-06-18 14:29 Setting variable Ranieri Mazili <ranieri.oliveira@terra.com.br>
2007-06-18 14:43 ` Michael Glaesemann <grzm@seespotcode.net>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox