Re: Few Queries - Mailing list pgsql-sql

From Oliver Elphick
Subject Re: Few Queries
Date
Msg-id 1029330646.28727.22.camel@linda
Whole thread Raw
In response to Re: Few Queries  ("Sugandha Shah" <Sugandhas@cybage.com>)
List 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.Elphick@lfix.co.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
obtainmercy, and find grace to help in      time of need."           Hebrews 4:16 
 



pgsql-sql by date:

Previous
From: Oliver Elphick
Date:
Subject: Re: parser: parse error at or near "$1"
Next
From: Masaru Sugawara
Date:
Subject: Re: parser: parse error at or near "$1"