hi all. the following text is an excerpt of oracle documentation Oracle® Database PL/SQL Language Reference 11g Release 1 (11.1) :
Unhandled exceptions can also affect subprograms. If you exit a subprogram successfully, PL/SQL assigns values to OUT parameters. However, if you exit with an unhandled exception, PL/SQL does not assign values to OUT parameters (unless they are NOCOPY parameters). Also, if a stored subprogram fails with an unhandled exception, PL/SQL does not roll back database work done by the subprogram.
note the bold text, does that true? i'm curious about that, so i wrote the following example to test it.
-- create a test table
CREATE TABLE e AS SELECT * FROM HR.EMPLOYEES;
-- create p1 which will update a row in table e
CREATE OR REPLACE PROCEDURE p1
IS
ex EXCEPTION;
row e%ROWTYPE;
BEGIN
select * into row from e where employee_id=100;
row.employee_id := 100;
row.first_name := 'yang';
-- update
UPDATE e set ROW = row where employee_id = 100;
-- and raise an error
RAISE ex;
END;
BEGIN
-- call the upper procedure
p1;
END;
-- test whether update success
select * from e where employee_id=100;
-- the upper query gives me
Steven
so my question is: am i right?