Skip site navigation (1) Skip section navigation (2)

Help for plpgsql!!

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: (view raw, whole thread or download thread mbox)
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 '
    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 

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

Share information about yourself, create your own public profile at


pgsql-interfaces by date

Next:From: Matthew H. NorthDate: 2000-10-19 16:06:38
Subject: PsqlODBC on W2K conn. to PostgreSQL 7.0.2 on FreeBSD
Previous:From: Scott HolmesDate: 2000-10-18 16:54:25
Subject: Transactions and Errors with ODBC

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group