1600 PMP mock questions 1400 CAPM mock questions 800 SCJP 6 mock questions 600 OCAJP 7 mock questions 590 OCPJP 7 mock questions 556 SCWCD 5 mock questions 500 OCEJWCD 6 mock questions pdfDownload (java,struts, hibernet etc)

ORACLE Tutorials

Exception handling with FORALL statement using SAVE EXCEPTIONS

SET serveroutput on

DECLARE
TYPE numlist IS TABLE OF NUMBER;

num_tab numlist
:= numlist (10, 0, 11, 12, 30, 0, 20, 199, 2, 0, 9, 1);
ERRORS NUMBER;
dml_errors EXCEPTION;
PRAGMA EXCEPTION_INIT (dml_errors, -24381);
BEGIN
FORALL i IN num_tab.FIRST .. num_tab.LAST SAVE EXCEPTIONS
DELETE FROM emp
WHERE sal > 500000 / num_tab (i);
EXCEPTION
WHEN dml_errors
THEN
ERRORS := SQL%BULK_EXCEPTIONS.COUNT;
DBMS_OUTPUT.put_line ('Number of errors is ' || ERRORS);

FOR i IN 1 .. ERRORS
LOOP
DBMS_OUTPUT.put_line ( 'Error '
|| i
|| ' occurred during '
|| 'iteration '
|| SQL%BULK_EXCEPTIONS (i).ERROR_INDEX
);
DBMS_OUTPUT.put_line ( 'Oracle error is '
|| SQLERRM
(-SQL%BULK_EXCEPTIONS (i).ERROR_CODE)
);
END LOOP;
END;
/

Reviews and Comments


PMP, CAPM, PMI is a registered certification mark of the Project Management Institute, Inc

Copyright © www.techfaq360.com 2016


About US | Contact US | Privacy Policy | Terms and Conditions  | Website disclaimer  | Cancellation and Refund Policy  | Shipping & Delivery Policy