Parameter variable schema oracle

徘徊边缘 提交于 2019-12-23 05:34:10

问题


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:


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;


来源:https://stackoverflow.com/questions/47745686/parameter-variable-schema-oracle

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!