pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: joel xue <joel_xue@hotmail.com>
To: pgsql-interfaces@postgresql.org
Subject: Help for plpgsql!!
Date: Wed, 18 Oct 2000 21:53:23 GMT
Message-ID: <F212RelSbxpqyDp6fwq00008e81@hotmail.com> (raw)

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.




view thread (2+ messages)  latest in thread

Message-ID: <F212RelSbxpqyDp6fwq00008e81@hotmail.com>
Permalink:  ../F212RelSbxpqyDp6fwq00008e81@hotmail.com/
Also on:    postgresql.org/message-id/F212RelSbxpqyDp6fwq00008e81@hotmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-interfaces@postgresql.org
  Cc: joel_xue@hotmail.com
  Subject: Re: Help for plpgsql!!
  In-Reply-To: <F212RelSbxpqyDp6fwq00008e81@hotmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox