Re: Few Queries

From: Oliver Elphick <olly(at)lfix(dot)co(dot)uk>
To: Sugandha Shah <Sugandhas(at)cybage(dot)com>
Cc: Janning Vygen <vygen(at)gmx(dot)de>, pgsql-sql(at)postgresql(dot)org
Subject: Re: Few Queries
Date: 2002-08-14 13:10:46
Message-ID: 1029330646.28727.22.camel@linda
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Wed, 2002-08-14 at 13:29, Sugandha Shah wrote:
> Hi ,
>
> No luck . Even with Select Into . Please if any body has faced similar problem and knows a solution.
>
> CREATE FUNCTION del_old_history() RETURNS int4 AS '

^^^^^^^^^^^^^

> declare
> var_history_age_limit int4;
> set_time datetime;
>
> BEGIN
> select into var_history_age_limit history_age_limit from database_info;
> IF (var_history_age_limit is not null) THEN
>
> --set_time :=select current_date()+ INTERVAL '1 day');
> select into set_time current_date()+ INTERVAL ''$var_history_age_limit days '';
> delete from history where complete_time <= set_time;
> END IF;
> return true;

^^^^^^^^^^^

> END;'
> LANGUAGE 'plpgsql';

You don't seem to be returning what you have selected. I would expect
"RETURN true;" to give you an error. Shouldn't that be "RETURN
var_history_age_limit;"?

--
Oliver Elphick Oliver(dot)Elphick(at)lfix(dot)co(dot)uk
Isle of Wight, UK
http://www.lfix.co.uk/oliver
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839 932A 614D 4C34 3E1D 0C1C
========================================
"Let us therefore come boldly unto the throne of grace,
that we may obtain mercy, and find grace to help in
time of need." Hebrews 4:16

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Masaru Sugawara 2002-08-14 13:21:50 Re: parser: parse error at or near "$1"
Previous Message Oliver Elphick 2002-08-14 13:02:59 Re: parser: parse error at or near "$1"