PostgreSQL 8.2.3 婺桺桺懼
劯锔媆锔媆誕嬉誕

ROLLBACK TO SAVEPOINT

劉䓄

ROLLBACK TO SAVEPOINT -- 啂悔彄婔婻媺庻䗹

臺濘

ROLLBACK [ WORK | TRANSACTION ] TO [ SAVEPOINT ] savepoint_name

柟誄

啂悔欔橬毺垔媺庻䗹傺䆋幋劯欓臯䔇变傴㔗媺庻䗹傉䇽橬昽幽婫驔襕施埇傖喉渇啂悔彄臖䗹㔗

ROLLBACK TO SAVEPOINT 锊劆婄役鍴欔橬婘臖媺庻䗹幋劯傺䆋䔇媺庻䗹㔗

埗昄

savepoint_name

啂悔潻躿䔇媺庻䗹

濘懟

嘪䫘 RELEASE SAVEPOINT 役鍴婔婻媺庻䗹蔯婉嚔檕嚄認婻媺庻䗹傺䆋幋劯欓臯䔇变傴䂷悩㔗

弄滯婔婻誻澇橬傺䆋䔇媺庻䗹劉庖滇婔婻髍臇㔗

婘媺庻䗹桹麵橩湺橬婔底麂庋媇攓䔇臯婺㔗傂嘘婘媺庻䗹麯欷嚔䔇橩湺鄘嚔婘啂悔毬認婻媺庻䗹幋劯噿閺㔗套悩婔婻嬉麵欷嚔庖䔇橩湺婘媺庻䗹麯麵幽婫橩湺赆婔婻 FETCH 变傴嘌巉蔯認婻媺庻䗹䘉劯啂悔庖闼幽認婻橩湺䔇嘉䘞傉䇽婘 FETCH 螷垄毺劏䔇嘉䘞(幘儌滇 FETCH 婉嚔赆啂悔)㔗噿閺婔婻橩湺䔇臯婺幘婉嚔赆啂悔䂍搴潽毬㔗套悩婔婻橩湺䔇淉嘩凚躘庋媇啂悔闼幽認婻橩湺儌嚔䘞庯婉埇欓臯䪽攕欔傖儘䞇婔婻庋媇埇傖䫘 ROLLBACK TO SAVEPOINT 麉桄敵崉嘖滇橩湺婉脘喉嘪䫘庖㔗

冋床

搴體 my_savepoint 傺䆋幋劯欓臯䔇变傴䔇嘌巉

ROLLBACK TO SAVEPOINT my_savepoint;

橩湺嘉䘞婉埖媺庻䗹啂悔䔇嘌巉

BEGIN;

DECLARE foo CURSOR FOR SELECT 1 UNION SELECT 2;

SAVEPOINT foo;

FETCH 1 FROM foo;
 ?column? 
----------
        1

ROLLBACK TO SAVEPOINT foo;

FETCH 1 FROM foo;
 ?column? 
----------
        2

COMMIT;

噚垹攓

SQL 湺庖弄滯噿髞庖 SAVEPOINT 滇媙釂䔇㔗PostgreSQL 启 Oracle 噕螩䩕䘖 TRANSACTION 噿髞庖㔗SQL 埻噕螩 WORK 嘩婺 ROLLBACK 劯麵䔇方懟幬噿髞庖㔗誻橬SQL 橬婔婻埇锬䔇 AND [ NO ] CHAIN 床埖䕞嬉 PostgreSQL 誻婉櫇毕㔗劥彍認婻变傴垯噘噚垹 SQL 湺庖㔗

埽蓕

BEGIN, COMMIT, RELEASE SAVEPOINT, ROLLBACK, SAVEPOINT

劯锔饡釕嬉誕
ROLLBACK PREPARED婪婔亓SAVEPOINT