有人可以向我解释为什么这个函数中的COMMIT会返回EXCEPTION吗?
原文链接:https://www.f2er.com/postgresql/191953.htmlDECLARE XNar CURSOR (forDATE Varchar) IS SELECT NARUCENO,ISPORUKA_ID FROM XDATA_NARUDZBE WHERE TO_CHAR(XDATA_NARUDZBE.DATUM,'DD.MM.YYYY') = forDATE; LastDate DATE; OutResult INTEGER; curNAR NUMERIC; curISP VARCHAR; RXNar RECORD; BEGIN OutResult := 1; SELECT MAX(DATUM) INTO LastDate FROM XDATA_NARUDZBE; FOR RXNar IN XNar(TO_CHAR(LastDate,'DD.MM.YYYY')) LOOP IF (RXNar.NARUCENO <> 0) AND (RXNar.ISPORUKA_ID = 'R01') THEN UPDATE NARUDZBE SET ISPORUCENO = RXNar.NARUCENO WHERE NARUDZBE.PP_ID = RXNar.PP_ID AND NARUDZBE.ART_ID = RXNar.ART_ID AND NARUDZBE.ISPORUKA_ID = 'R01'; END IF; END LOOP; COMMIT; <--- ???? RETURN OutResult; EXCEPTION WHEN OTHERS THEN OUTRESULT := 0; RAISE; RETURN OutResult; END;
当EXCEPTION块存在于函数中时,为什么我不能使用ROLLBACK TO SavePoint?