On 09/07/2013 05:20, Mike Christensen wrote: > I was reading about Postgres stored procs in the FAQ: > > https://wiki.postgresql.org/wiki/FAQ#Does_PostgreSQL_have_stored_procedures.3F > > It claims that an alternative syntax to: > > SELECT theNameOfTheFunction(arg1, arg2); > > Is: > > PERFORM theNameOfTheFunction(arg1, arg2); > > However, when I try the following: > > CREATE TABLE app_for_leave > ( > sno integer NOT NULL, > eid integer, > ename varchar(20), > sd date, > ed date, > sid integer, > status boolean DEFAULT false, > CONSTRAINT pk_snoa PRIMARY KEY (sno) > ); > > CREATE FUNCTION MyInsert(_sno integer, _eid integer, _sd date, _ed date, > _sid integer, _status boolean) > RETURNS void AS > $BODY$ > BEGIN > INSERT INTO app_for_leave(sno, eid, sd, ed, sid, status) > VALUES(_sno, _eid, _sd, _ed, _sid, _status); > END; > $BODY$ > LANGUAGE 'plpgsql' VOLATILE > COST 100; > > PERFORM MyInsert(1,101,'2013-04-04','2013-04-04',2,'f' ); > > I get the error: > > ERROR: syntax error at or near "PERFORM" > SQL state: 42601 > Character: 1 PERFORM only works inside a pl/pgsql function. You use it when you want to discard the result of a SELECT. So, for example, instead of this - select foo from bar ... - you would do this: perform foo from bar ... If you need the result, you would use SELECT INTO <variable>. Ray. -- Raymond O'Donnell :: Galway :: Ireland rod@xxxxxx -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general