Re: Anybody have an Oracle PL/SQL reference at hand?
От | Gavin Sherry |
---|---|
Тема | Re: Anybody have an Oracle PL/SQL reference at hand? |
Дата | |
Msg-id | Pine.LNX.4.58.0408032228220.13632@linuxworld.com.au обсуждение исходный текст |
Ответ на | Re: Anybody have an Oracle PL/SQL reference at hand? (Tom Lane <tgl@sss.pgh.pa.us>) |
Ответы |
Re: Anybody have an Oracle PL/SQL reference at hand?
|
Список | pgsql-hackers |
One other difference when compared with Oracle is that Oracle does not abort the transaction which raised the exception. Although I generally do not think this is a great idea, it does allow for things like retry loops. Assuming we have savepoints, consider the following function which creates a user account DECLAREsuffix int; BEGINsuffix := 1;LOOP BEGIN; SAVEPOINT start; INSERT INTO users VALUES(user || suffix); EXIT; EXCEPTION WHEN UNIQUE_VIOLATION THEN ROLLBACK TO start; suffix := suffix + 1; END;END LOOP; END; Again, it might not be great to leave the database in an inconsistent state when we get to the exception handler and I'd be all for generating another exception if the (sub) transaction was not rolled back and the exception handler tried to access data. Just some ideas. Gavin
В списке pgsql-hackers по дате отправления: