From: | "Prasad dev" <esteem3300(at)hotmail(dot)com> |
---|---|
To: | pgsql-novice(at)postgresql(dot)org |
Subject: | SQL function |
Date: | 2005-07-28 03:13:17 |
Message-ID: | BAY103-F23AEE65C4087556E8A8B10C0CF0@phx.gbl |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
Hi all !
I want an SQL function a rough structure below-
CREATE FUNCTION ins_both(int,int,int,int) RETURNS boolean AS '
BEGIN
INSERT INTO inv2 values($2,$3,$4);
INSERT INTO inv1 values($1,$2,$3);
COMMIT
' LANGUAGE SQL;
but we cannot include Begin and commit in an SQL function
so i came out with the following which is not right
Create function insboth(int,int,int,int) RETURNS void AS $$
START TRANSACTION;
INSERT INTO inv2 values($2,$3,$4);
INSERT INTO inv1 values($1,$2,$3);
END TRANSACTION;
$$LANGUAGE SQL;
In short what i look for, i commit only after inserting these 2 tuples and
later it fires my trigger etc. If there is any other possible way please let
me know.
Thanks
Cheers
Prasad.
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Glaesemann | 2005-07-28 03:23:47 | Re: SQL function |
Previous Message | Jeff Eckermann | 2005-07-28 01:55:44 | Re: Troubles with PL/Perl in PgSQL |