Monday 19 March 2012

Create table at run time using Execute Immediate

declare
cursor rec is select call_type,record_id  from IUC_ERR_CDR_AP_DATA;
v_rec rec%rowtype;
call_t number(20);
recor_i number(20);
begin
execute immediate 'create table test_tablee ( call_type number(20),record_id varchar2(20))';
commit;
open rec;
loop
fetch rec into call_t,recor_i;
exit when rec%notfound;
--dbms_output.put_line(call_t);
--dbms_output.put_line(recor_i);
execute immediate 'insert into test_tablee (call_type,record_id) values (:call_t,:recor_i)' using call_t,recor_i;
end loop;
commit;
end;

No comments:

Post a Comment