Received: from hub.org.org (localhost [127.0.0.1]) by hub.org (8.10.1/8.11.0) with SMTP id e9IMxrP26708 for ; Wed, 18 Oct 2000 18:59:53 -0400 (EDT) (envelope-from pgsql-interfaces-owner@hub.org) Received: from hotmail.com (f212.law7.hotmail.com [216.33.237.212]) by hub.org (8.10.1/8.11.0) with ESMTP id e9ILrTP05725 for ; Wed, 18 Oct 2000 17:53:29 -0400 (EDT) (envelope-from joel_xue@hotmail.com) Received: from mail pickup service by hotmail.com with Microsoft SMTPSVC; Wed, 18 Oct 2000 14:53:23 -0700 Received: from 204.138.59.163 by lw7fd.law7.hotmail.msn.com with HTTP; Wed, 18 Oct 2000 21:53:23 GMT X-Originating-IP: [204.138.59.163] From: "joel xue" To: pgsql-interfaces@postgresql.org Subject: Help for plpgsql!! Date: Wed, 18 Oct 2000 21:53:23 GMT Mime-Version: 1.0 Content-Type: text/plain; format=flowed Message-ID: X-OriginalArrivalTime: 18 Oct 2000 21:53:23.0377 (UTC) FILETIME=[D61B9210:01C0394D] X-Archive-Number: 200010/172 X-Sequence-Number: 1529 Dear Sir/Madam, My table is : Attribute | Type | Modifier -----------+-----------+---------- empname | text | salary | integer | last_date | timestamp | last_name | name | My function and trigger is: create function isFull() returns opaque as ' begin select count(*) into tmp1 from emp; if tmp1.count >= 5 then select min(last_date) into tmp2 from emp; delete from emp where last_date=tmp2.min; drop table tmp2; end if; drop table tmp1; end; ' language 'plpgsql'; create trigger isfull before insert on emp for each row execute procedure isFull (); But my error messages is : ERROR: parser: parse error at or near "tmp1" I can finish these steps in psql environment,why it could not work well in plpgsql?Can you help me? _________________________________________________________________________ Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com. Share information about yourself, create your own public profile at http://profiles.msn.com.