Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 6130A47590F for ; Wed, 14 Aug 2002 01:16:33 -0400 (EDT) Received: from herald.cybage.com (universe.cybage.com [202.54.41.226]) by postgresql.org (Postfix) with ESMTP id DC8034754A4 for ; Wed, 14 Aug 2002 01:16:31 -0400 (EDT) Received: from Sugandha ([192.168.5.32]) by herald.cybage.com with Microsoft SMTPSVC(5.0.2195.4453); Wed, 14 Aug 2002 10:48:50 +0530 Message-ID: <01b301c24352$12570fb0$2005a8c0@cybage.com> From: "Sugandha Shah" To: Subject: Few Queries Date: Wed, 14 Aug 2002 10:35:54 +0530 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_01A8_01C2437E.5E698870" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 X-OriginalArrivalTime: 14 Aug 2002 05:18:50.0088 (UTC) FILETIME=[12C20680:01C24352] X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200208/212 X-Sequence-Number: 9058 This is a multi-part message in MIME format. ------=_NextPart_000_01A8_01C2437E.5E698870 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hi , I'm still facing few problems and hence the query . I have searched the arc= hives 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=20 select into var_history_age_limit history_age_limit from database_info; IF (var_history_age_limit is not null) THEN set_time :=3D select current_date()+ INTERVAL ' ' $var_history_age_li= mit day' '; --begin transaction delete from history where complete_time <=3D set_time; END IF; =20=20=20=20 return true;=20=20 END;' LANGUAGE 'plpgsql'; I get this error :=20 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=20=20 how is above statement verified in postgres . I tried looking for OID . Any help will be highly appreciated. Regards, -Sugandha ------=_NextPart_000_01A8_01C2437E.5E698870 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
 

Hi ,
 
 
I'm still facing few problems and hence = the query=20 . I have searched the archives as well as read the manual.
 
1. I 'm firing a query and it returns th= e value=20 in variable which I need to pass to other query .  Is this a right way= to=20 pass the value ? I'm newbie to     this Database and hence f= acing=20 lot of syntax problems.
 
CREATE FUNCTION del_old_history() RETURN= S bool AS=20 '
declare
   var_history_age_limit int4;
  =20 set_time    datetime;
BEGIN
select into=20 var_history_age_limit history_age_limit from database_info;
IF=20 (var_history_age_limit is not null)  =20 THEN
      set_time :=3D select current_date()+= =20 INTERVAL ' ' $var_history_age_limit  day' ';
 
     --begin=20 transaction
    delete from history where complete_time &= lt;=3D=20 set_time;
END IF;
    
       ret= urn=20 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=20 del_old_history

NOTICE: line 8 at assignment

 

2. Is there any equiavlent of  MS -S= QLServer=20 'trancount ' in postgres ?

3. if object_id ('database_info') is null=  =20

   how is above=20 statement verified in postgres . I tried looking for OID .

 

Any help will be highly=20 appreciated.

Regards,
-Sugandha
------=_NextPart_000_01A8_01C2437E.5E698870--