Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Table name as a variable in PL/SQL procedure
Hello,
I would like to know how to create a procedure out of the following anonymous PL/SQL block, and how should I rewrite it in order to accept table name as variable(table name equal ‘fixposition').
Thanks in advance,
Ronen
--
CREATE TABLE fixposition(parentid number not null,
id number not null, position number not null)
BEGIN
OPEN parentid_cur;
FETCH parentid_cur INTO parentid_val;
while parentid_cur%FOUND
LOOP
counter:=0;
OPEN id_cur; FETCH id_cur INTO id_val; WHILE id_cur%FOUND LOOP UPDATE fixposition SET position=counter WHERE CURRENT OF id_cur; counter:=counter+1; FETCH id_cur INTO id_val; END LOOP; CLOSE id_cur; FETCH parentid_cur INTO parentid_val;END LOOP;