= SQL%BULK_EXCEPTIONS.COUNT; DBMS_OUTPUT.PUT_LINE('Number of errors is ' || ERRORS); FOR i IN 1..ERRORS LOOP DBMS_OUTPUT.PUT_LINE('SQLCODE: ' || SQL%BULK_EXCEPTIONS(i).ERROR_INDEX); DBMS_OUTPUT.PUT_LINE('SQLERRM: ' ||SQLERRM(-SQL%BULK_EXCEPTIONS(i).ERROR_CODE)); END LOOP; ...
FORALL文は、VALUES句およびWHERE句の異なる値を使用して、1つのDML文を複数回実行します。 これらの異なる値は、データが移入された既存のコレクションまたはホスト配列から取得されます。通常、FORALL文は、同等のFOR LOOP文よりはるかに高速です。 ノート: FORALL文を使用できるのは、クラ...
in; 16 17 FOR indx IN 1 .. l_employee_ids.COUNT 18 LOOP 19 check_eligibility (l_employee_ids (indx), 20 increase_pct_in, 21 l_eligible); 22 23 IF l_eligible 24 THEN 25 l_eligible_ids (l_eligible_ids.COUNT + 1) := 26 l_employee_ids (indx); 27 END IF; 28 END LOOP;...
Suppose my manager asked me to write a procedure that accepts a department ID and a salary percentage increase and gives everyone in that department a raise by the specified percentage. Taking advantage of PL/SQL’s elegant cursor FOR loop and the ability to call SQL statements natively in PL...
identifies all the employees in a department. The UPDATE statement executes for each of those employees, applying the same percentage increase to all. In such a simple scenario, a cursor FOR loop is not needed at all. I can simplify this procedure to nothing more than the code inListing 2...
identifies all the employees in a department. The UPDATE statement executes for each of those employees, applying the same percentage increase to all. In such a simple scenario, a cursor FOR loop is not needed at all. I can simplify this procedure to nothing more than the code inListing 2...