Adsense Ad

Thursday, 8 November 2018

Multiple Columns Array in PL/SQL


Example Only:


Declare
  Cursor Employee_Id_Cur Is
    Select empno, ename, job, sal, deptno
      From emp;
  Type Employeearraytype Is Table Of Employee_Id_Cur%Rowtype;
  Employeearray Employeearraytype;
Begin
  Open Employee_Id_Cur;
  Loop
    Fetch Employee_Id_Cur Bulk Collect
      Into Employeearray;
    Exit When Employee_Id_Cur%Notfound;
  End Loop;
  Close Employee_Id_Cur;
      For j In Employeearray.First .. Employeearray.Last Loop      
      DBMS_OUTPUT.PUT_LINE(Employeearray(j).empno);
      DBMS_OUTPUT.PUT_LINE(Employeearray(j).ename);
      DBMS_OUTPUT.PUT_LINE(Employeearray(j).job);
      DBMS_OUTPUT.PUT_LINE(Employeearray(j).sal);
      DBMS_OUTPUT.PUT_LINE(Employeearray(j).deptno);    
      End Loop;
End;
/

No comments: