SQL function
| От | Prasad dev |
|---|---|
| Тема | SQL function |
| Дата | |
| Msg-id | BAY103-F23AEE65C4087556E8A8B10C0CF0@phx.gbl обсуждение исходный текст |
| Ответы |
Re: SQL function
|
| Список | 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.
В списке pgsql-novice по дате отправления: