Problem creating stored procedure - Mailing list pgsql-general

From Ted Byers
Subject Problem creating stored procedure
Date
Msg-id 025001c60b0c$cdd5ece0$6401a8c0@RnDworkstation
Whole thread Raw
Responses Re: Problem creating stored procedure
Re: Problem creating stored procedure
Re: Problem creating stored procedure
List pgsql-general
I am puzzled.  Can ayone explain why I get an error from Postgres on this simple stored procedure?
 
The following is from the pgAdmin III History window:
-- Executing query:
CREATE PROCEDURE addEntity (
 fn IN VARCHAR,
 ln IN VARCHAR,
 ivar IN VARCHAR,
 hi IN VARCHAR,
 pw IN VARCHAR,
 ea IN VARCHAR,
 ad IN VARCHAR,
 c IN VARCHAR,
 p IN VARCHAR,
 co IN VARCHAR,
 pc IN VARCHAR
 )
AS
DECLARE
 varID INTEGER
BEGIN
 SELECT int varID uid from uids where email_address=ea;
 IF varID IS NOT NULL THEN
  INSERT INTO addy (uid,address,city,province,country,postal_code)
   VALUES (varID,ad,c,p,co,pc)
 ELSE
  INSERT INTO uids(family_name,first_name,initials,hid,pword,email_address)
   VALUES (ln,fn,ivar,hi,pw,ea)
  INSERT INTO addys(...) VALUES (currval('seq'),ad,c,p,co,pc)
 END IF;
END
LANGUAGE 'sql' VOLATILE;
 
ERROR:  syntax error at or near "PROCEDURE" at character 8
 
Judging from the examples in the manual (around page 600), my procedure ought to be fine, but clearly Postgres doesn't like it.
 
 
Thanks,
 
Ted
 
R.E. (Ted) Byers, Ph.D., Ed.D.
R & D Decision Support Software
http://www.randddecisionsupportsolutions.com/

pgsql-general by date:

Previous
From: Tony Caduto
Date:
Subject: Re: R: Case sensitivity? - I understood...
Next
From: "Uwe C. Schroeder"
Date:
Subject: Re: Problem creating stored procedure