Exception raised while validating admin name

If the company has zero earnings, the predefined exception DECLARE pe_ratio NUMBER(3,1); BEGIN SELECT price / earnings INTO pe_ratio FROM stocks WHERE symbol = 'XYZ'; -- might cause division-by-zero error INSERT INTO stats (symbol, ratio) VALUES ('XYZ', pe_ratio); COMMIT; EXCEPTION -- exception handlers begin WHEN ZERO_DIVIDE THEN -- handles 'division by zero' error INSERT INTO stats (symbol, ratio) VALUES ('XYZ', NULL); COMMIT; ...

WHEN OTHERS THEN -- handles all other errors ROLLBACK; END; -- exception handlers and block end here Error processing is not clearly separated from normal processing; nor is it robust.

You can, however, declare the same exception in two different blocks.

Exceptions declared in a block are considered local to that block and global to all its sub-blocks.

The host cursor variable and PL/SQL cursor variable involved in an assignment have incompatible return types.

Comments