X-Original-To: pgsql-sql@postgresql.org Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 101EE474E53 for ; Sun, 16 Feb 2003 23:48:06 -0500 (EST) Received: from news.hub.org (news.hub.org [64.49.215.80]) by postgresql.org (Postfix) with ESMTP id 68072474E42 for ; Sun, 16 Feb 2003 23:48:05 -0500 (EST) Received: by news.hub.org (Postfix, from userid 8) id 4C5F643A94B; Sun, 16 Feb 2003 23:48:04 -0500 (EST) From: "betty" X-Newsgroups: comp.databases.postgresql.sql Subject: trigger after with cursor Date: Mon, 17 Feb 2003 11:57:37 +0700 Organization: Hub.Org Networking Services (http://www.hub.org) Lines: 53 Message-ID: X-Complaints-To: usenet@news.hub.org X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 To: pgsql-sql@postgresql.org X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200302/379 X-Sequence-Number: 11777 Hi.. I try trigger after insert used cursor without rowtype or cursor with rowtype, etc: create or replace function fn_tr_ai_pdcblc() returns trigger as ' declare c_pdcblc cursor for select * from t_pdcblc where fc_branch=new.fc_branch and fc_bankacct=new.fc_bankacct; row_pdcblc t_pdcblc%rowtype; balance decimal(30,5); begin balance:=0; open c_pdcblc; for c_pdc in 1..(select count(*) from t_pdcblc where fc_branch=new.fc_branch and fc_bankacct=new.fc_bankacct and fd_trxdate>=new.fd_trxdate) loop fetch c_pdcblc into row_pdcblc; if (select count(*) from t_pdcblc where fc_branch=new.fc_branch and fc_bankacct=new.fc_bankacct and fd_trxdate0 then balance:=fm_balance from t_pdcblc where fc_branch=new.fc_branch and fc_bankacct=new.fc_bankacct and fd_trxdate