我正在尝试确定此代码的功能(Oracle SQL),尤其是from
子句中的符号感叹号。
INSERT INTO "LOCATIONS" "A1"
("LOCATION_ID",
"SEQUENCE",
"POINT_TYPE")
SELECT "A2"."LOCATION_ID",
"A2"."SEQUENCE",
"A2"."LOCATION_TYPE",
"A2"."POINT_TYPE"
FROM "LOCATIONS"@! "A2"
WHERE NOT EXISTS (SELECT 1
FROM "LOCATIONS" "A3"
WHERE "A3"."LOCATION_ID" = "A2"."LOCATION_ID")
最佳答案
这是到执行查询的原始数据库的反向数据库链接。原始查询必须如下所示:
INSERT INTO LOCATIONS@remote_db
("LOCATION_ID",
"SEQUENCE",
"POINT_TYPE")
SELECT "A2"."LOCATION_ID",
"A2"."SEQUENCE",
"A2"."POINT_TYPE"
FROM "LOCATIONS" A2
WHERE NOT EXISTS (SELECT 1
FROM LOCATIONS@remote_db A3
WHERE "A3"."LOCATION_ID" = "A2"."LOCATION_ID");
这样,所有远程表都将变为本地,而本地表将通过“@!”变为远程。
关于sql - @是什么! From语句中的均值,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/11671303/