From: Sugandha Shah <Sugandhas@cybage.com>
To: pgsql-sql@postgresql.org
Subject: Few Queries
Date: Wed, 14 Aug 2002 10:35:54 +0530
Message-ID: <01b301c24352$12570fb0$2005a8c0@cybage.com> (raw)
Hi ,
I'm still facing few problems and hence the query . I have searched the archives as well as read the manual.
1. I 'm firing a query and it returns the value in variable which I need to pass to other query . Is this a right way to pass the value ? I'm newbie to this Database and hence facing lot of syntax problems.
CREATE FUNCTION del_old_history() RETURNS bool 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 ' ' $var_history_age_limit day' ';
--begin transaction
delete from history where complete_time <= set_time;
END IF;
return true;
END;'
LANGUAGE 'plpgsql';
I get this error :
Error: ERROR: parser: parse error at or near "select"
NOTICE: Error occurred while executing PL/pgSQL function del_old_history
NOTICE: line 8 at assignment
2. Is there any equiavlent of MS -SQLServer 'trancount ' in postgres ?
3. if object_id ('database_info') is null
how is above statement verified in postgres . I tried looking for OID .
Any help will be highly appreciated.
Regards,
-Sugandha
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: Sugandhas@cybage.com
Subject: Re: Few Queries
In-Reply-To: <01b301c24352$12570fb0$2005a8c0@cybage.com>
* 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