Wednesday 10 October 2012

Forall example with plsql table type in Oracle


set echo on

DECLARE

   TYPE emp_aat IS TABLE OF emp%ROWTYPE
      INDEX BY PLS_INTEGER;
   aa_emps emp_aat;

BEGIN

   FORALL i IN 1 .. aa_emps.COUNT
      UPDATE emp
      SET    sal = aa_emps(i).sal * 1.1
      WHERE  empno = aa_emps(i).empno;

END;
/

No comments:

Post a Comment