[ad_1]
I’m trying to insert records to table
input from information_schema :
select table_schema,table_name,table_type
from information_schema.tables
where table_schema=”MYSCHEMA”;
expected output:
insert into new table along with ddl of table_name
to get ddl: select get_ddl(‘table’,’INVOICING’)
can you help me?
create or replace procedure proc_getddl
is
v_tableschema varchar(30);
v_tablename varchar(30);
v_tabletype varchar(30);
v_getddl varchar(110);
cursor getddl is
select table_schema,table_name,table_type,get_ddl('table','INVOICING')
from information_schema.tables
where table_schema="MYSCHEMA";
begin
open getddl;
LOOP
fetch getddl into v_tableschema,v_tablename,v_tabletype,v_getddl;
EXIT WHEN getddl%NOTFOUND;
INSERT INTO backup_table
values (v_tableschema,v_tablename,v_tabletype,v_getddl);
END LOOP;
close getddl;
end proc_getddl;
I can use this but I want it to execute for all tables in information schema
[ad_2]