CREATE OR REPLACE PROCEDURE PROC1(niandu in VARCHAR2, dh in VARCHAR2) is v_rec mytemptable%rowtype; v_file varchar2(50); strTemp varchar2(200); type hehecur is ref cursor; tempCursor hehecur; begin v_file := 'HH'||niandu; strTemp := ''; strTemp := 'select * From ' || v_file || ' Where dhhh=dh';
open tempCursor for strtemp; loop fetch tempCursor into v_rec; exit when tempCursor%notfound; insert into mytemptable values(v_rec.id, v_rec.des, v_rec.qty); commit; end loop; close tempCursor; END PROC1;
is
v_rec mytemptable%rowtype;
v_file varchar2(50);
strTemp varchar2(200);
type hehecur is ref cursor;
tempCursor hehecur;
begin
v_file := 'HH'||niandu;
strTemp := '';
strTemp := 'select * From ' || v_file || ' Where dhhh=dh';
open tempCursor for strtemp;
loop
fetch tempCursor into v_rec;
exit when tempCursor%notfound;
insert into mytemptable values(v_rec.id, v_rec.des, v_rec.qty);
commit;
end loop;
close tempCursor;
END PROC1;