Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does @ ! mean in a From Statement

Tags:

sql

oracle

dblink

I am trying to determine what this code is doing (Oracle SQL) — especially the at-sign exclamation mark in the from clause.

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") 
like image 454
user739866 Avatar asked Oct 07 '22 02:10

user739866


1 Answers

This is a reverse database link to the original database, where the query is executed. The original query must look like:

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");

That way all remote tables become local, and local tables become remote with "@!".

like image 182
Evgen Avatar answered Oct 13 '22 10:10

Evgen