Parameter variable schema oracle

2019-06-09 06:15发布

I'm newbie using Oracle.

I have a question: in SQL Server, we can use:

DECLARE DBNAME1 VARCHAR(20)
DECLARE DBNAME2 VARCHAR(20)

SET @DBNAME1 ='TEST_DB'
SET @DBNAME2 ='TEST_DB2'

INSERT INTO @DBNAME1.TABLECORE
    SELECT * 
    FROM @DBNAME2.TABLENONCORE T

What is the equivalent of this script in if @DBNAME == Schema in Oracle?

1条回答
爷的心禁止访问
2楼-- · 2019-06-09 07:01

We can manage it but creating db link on dbname2 :

create public database link dbname2 connect to myschema using 'abc-scan.mycompany.com.tr:1521/dbname2.mycompany.com.tr';

and calling the following dml statement from dbname1 :

insert into tablecore select * from tablenocore@dbname2;
查看更多
登录 后发表回答