create table from another table in stored procedure in
oracle
CREATE OR REPLACE PROCEDURE PRC_CREATETABLE is
circlecode varchar2(20);
cursor c1 is select
distinct circle_code from circle_master;
BEGIN
open c1;
loop
fetch c1 into
circlecode;
EXIT WHEN
c1%NOTFOUND;
EXECUTE
IMMEDIATE 'CREATE TABLE tablename AS
(SELECT * refencetablename WHERE circle_code='''||circlecode||''') ' ;
end loop;
close c1;
END PRC_CREATETABLE;
No comments :
Post a Comment