pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Ranieri Mazili <ranieri.oliveira@terra.com.br>
To: pgsql-general@postgresql.org
To: pgsql-sql@postgresql.org
Subject: Setting variable
Date: Mon, 18 Jun 2007 11:29:43 -0300
Message-ID: <467696D7.2090703@terra.com.br> (raw)

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



view thread (2+ messages)  latest in thread

Message-ID: <467696D7.2090703@terra.com.br>
Permalink:  ../467696D7.2090703@terra.com.br/
Also on:    postgresql.org/message-id/467696D7.2090703@terra.com.br

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: ranieri.oliveira@terra.com.br, pgsql-general@postgresql.org
  Subject: Re: Setting variable
  In-Reply-To: <467696D7.2090703@terra.com.br>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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