Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id F06DC4759A6 for ; Wed, 14 Aug 2002 09:10:48 -0400 (EDT) Received: from anchor-post-33.mail.demon.net (anchor-post-33.mail.demon.net [194.217.242.91]) by postgresql.org (Postfix) with ESMTP id E2C82475902 for ; Wed, 14 Aug 2002 09:10:47 -0400 (EDT) Received: from lfix.demon.co.uk ([158.152.59.127] helo=linda.lfix.co.uk) by anchor-post-33.mail.demon.net with esmtp (Exim 3.35 #1) id 17exvF-0007st-0X; Wed, 14 Aug 2002 14:10:50 +0100 Received: from localhost ([127.0.0.1] helo=localhost.localdomain ident=olly) by linda.lfix.co.uk with esmtp (Exim 3.35 #1 (Debian)) id 17exvC-0007ti-00; Wed, 14 Aug 2002 14:10:46 +0100 Subject: Re: Few Queries From: Oliver Elphick To: Sugandha Shah Cc: Janning Vygen , pgsql-sql@postgresql.org In-Reply-To: <027601c2438e$3a6304a0$2005a8c0@cybage.com> References: <01b301c24352$12570fb0$2005a8c0@cybage.com> <200208140702.g7E72Cd05129@janning.planwerk6.local> <027601c2438e$3a6304a0$2005a8c0@cybage.com> Content-Type: text/plain Content-Transfer-Encoding: 7bit X-Mailer: Ximian Evolution 1.0.8 Date: 14 Aug 2002 14:10:46 +0100 Message-Id: <1029330646.28727.22.camel@linda> Mime-Version: 1.0 X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200208/225 X-Sequence-Number: 9071 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 obtain mercy, and find grace to help in time of need." Hebrews 4:16