You have a conflict with the cnum character, which you use both a local variable and the current cursor line.
You probably want:
DECLARE CURSOR c1 is select distinct WP_NO from temp; BEGIN FOR current_row in c1 LOOP EXECUTE IMMEDIATE 'Alter table temp_col add (:1 varchar2(255))' using current_row.WP_NO; END LOOP; COMMIT; END;
As you can see, you do not need to declare the current_row variable that you use in the for loop.
source share