database - How can I write a PL/SQL procedure to copy tables and contents from another account -
i need write pl/sql procedure create tables match ones in account(i have access account). need have same columns , types. also, need filled same data
help me!
edit:
sql> create or replace procedure maketables 2 3 begin 4 execute immediate 5 'create table table1 (select * another_acct.table1); 6 create table table2 (select * another_acct.table2); 7 create table table3 (select * another_acct.table3); 8 create table table4 (select * another_acct.table4)'; 9 end; 10 / procedure created.
but when run error:
sql> begin 2 maketables; 3 end; 4 / begin * error @ line 1: ora-00911: invalid character ora-06512: @ "bs135.maketables", line 4 ora-06512: @ line 2
when say, "account", mean, "user/schema"? if so, can simple. go read/google "oracle create table select". lets create table select statement, issue statement such
create table new_table select * other_schema.old_table
you don't need pl/sql unless wanted automate process creating many tables. query data dictionaries driver.
(also, please read on how ask proper questions here: https://stackoverflow.com/questions/how-to-ask )
Comments
Post a Comment