简体   繁体   中英

Insert table data into another table in another schema in oracle

i have 2 DBs

the first one

username: name1
password: password1
hostname: pdprf.local
port: 8080
SID: prf

the second one

username: username2
password: password2
hostname: pdora.local
port: 8080
SID: prd

i am selecting data from a table in scehama 1 and i want to insert that data into table in scehma 2 - usually i export the data and insert it but i am looking for 1 line statment to do this - any ideas how to do that in oracle DB ?

If these are different databases, then a database link is the answer to your question.

Create a database link in one of those databases, eg

create database link dbl_prd
  connect to username2
  identified by password2
  using 'prd';

Then you'd

insert into some_table@dbl_prd (col1, col2, ..., coln)
  select col1, col2, ..., coln
  from some_table;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM