Help for plpgsql!!

Поиск
Список
Период
Сортировка
От joel xue
Тема Help for plpgsql!!
Дата
Msg-id F212RelSbxpqyDp6fwq00008e81@hotmail.com
обсуждение исходный текст
Ответы Re: Help for plpgsql!!  (hubert depesz lubaczewski <depesz@depesz.pl>)
Список 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)
intotmp2 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.



В списке pgsql-interfaces по дате отправления:

Предыдущее
От: Scott Holmes
Дата:
Сообщение: Transactions and Errors with ODBC
Следующее
От: "Matthew H. North"
Дата:
Сообщение: PsqlODBC on W2K conn. to PostgreSQL 7.0.2 on FreeBSD