From: | "joel xue" <joel_xue(at)hotmail(dot)com> |
---|---|
To: | pgsql-interfaces(at)postgresql(dot)org |
Subject: | Help for plpgsql!! |
Date: | 2000-10-18 21:53:23 |
Message-ID: | F212RelSbxpqyDp6fwq00008e81@hotmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-interfaces |
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.
From | Date | Subject | |
---|---|---|---|
Next Message | Matthew H. North | 2000-10-19 16:06:38 | PsqlODBC on W2K conn. to PostgreSQL 7.0.2 on FreeBSD |
Previous Message | Scott Holmes | 2000-10-18 16:54:25 | Transactions and Errors with ODBC |