在SYSTEM帐户下
insert into user.table1 select col1,col2 from user2.table1 where .....;如果有很多表就用SQLPLUS 的spool 构造语句,如果是全部数据使用EXP/IMP可以
insert into user.table1 select col1,col2 from user2.table1 where .....;如果有很多表就用SQLPLUS 的spool 构造语句,如果是全部数据使用EXP/IMP可以
INSERT INTO TB2
SELECT * FROM TB1
WHERE EXISTS (SELECT 1 FROM TB1 WHERE TB1.ID <> TB2.ID) --该条件可选,过滤TB2中没有而TB1中有的
grant select on tbname to user2;
connect user2/psw2
insert into tbname2 select * from user1.tbname where ...;
commit;
但是如果表结构不相同,
请将,字段都列出来
如:
insert into tablea (col1,col2,col3,...) select col1,col2,col3,... from username.tablea;
grant select on tbname to user2;
connect user2/psw2这个步骤非常重要,保证你的用户对另外一个用户的表有选择权限
select col1,col2 from table1
必须列对应相同
(Col............)
select Col...
from Tablename
Where condition