Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to use multiple columns as an array in PLSQL

2849762Jul 24 2019 — edited Jul 24 2019

Hi

I want to update multiple columns from emp_test with columns from hremp3 table.  And, my  sample sql is as below. I am not sure I can write like this as error keep showing  ORA00927 missing equal sign in line 17 column 30. Please advise .

Thank you

declare

cursor c_data IS

   select  fname,lname  FROM EMP_TEST;

   type emparray  is   varray(2)  of varchar2(10);

   type hremparray  is varray(2) of varchar2(10);

   emp emparray;

   hremp hremparray;

BEGIN

   emp := emparray('fname',' lname');

   hremp := hremparray('fname','lname');

   FOR i in 1 .. c_data LOOP

      update emp_test set emp(i) =hremp3. hremp(i)  where emp_test.emplid=hremp3.emplidhr;

   END LOOP;

END;

Comments
Post Details
Added on Jul 24 2019
3 comments
2,760 views