dblink

What does @ ! mean in a From Statement

ⅰ亾dé卋堺 提交于 2020-01-02 04:15:50
问题 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") 回答1: This is a reverse database link to the original database, where the query is executed. The

Best way to handle LOBs in Oracle distributed databases

☆樱花仙子☆ 提交于 2019-12-31 14:52:13
问题 If you create an Oracle dblink you cannot directly access LOB columns in the target tables. For instance, you create a dblink with: create database link TEST_LINK connect to TARGETUSER IDENTIFIED BY password using 'DATABASESID'; After this you can do stuff like: select column_a, column_b from data_user.sample_table@TEST_LINK Except if the column is a LOB, then you get the error: ORA-22992: cannot use LOB locators selected from remote tables This is a documented restriction. The same page

Execute multiple queries as one dblink transaction

此生再无相见时 提交于 2019-12-31 02:34:13
问题 I am working in a Java application where I need to execute these the two queries (as Strings in java) at the same time and rollback the transaction if there where errors. SELECT dblink_exec('hostaddr=xxx.xx.xxx.xxx port=5432 dbname=bdname user=myuser password=mypass connect_timeout=2', 'INSERT INTO table3(field4) VALUES (5)') AS result; SELECT dblink_exec('hostaddr=xxx.xx.xxx.xxx port=5432 dbname=bdname user=myuser password=mypass connect_timeout=2', 'UPDATE table1 SET field2 = field2 + 3.0

postgresql: INSERT INTO … (SELECT * …)

只愿长相守 提交于 2019-12-28 08:04:28
问题 I'm not sure if its standard SQL: INSERT INTO tblA (SELECT id, time FROM tblB WHERE time > 1000) What I'm looking for is: what if tblA and tblB are in different DB Servers . Does PostgreSql gives any utility or has any functionality that will help to use INSERT query with PGresult struct I mean SELECT id, time FROM tblB ... will return a PGresult* on using PQexec . Is it possible to use this struct in another PQexec to execute an INSERT command. EDIT: If not possible then I would go for

Postgresql: ERROR: structure of query does not match function result type Using DbLink

时光怂恿深爱的人放手 提交于 2019-12-25 03:24:39
问题 So I wrote this method that aims at querying to another remote database with the same structure using dblink (inspired from this post Specify dblink column definition list from a local existing type and this one Refactor a PL/pgSQL function to return the output of various SELECT queries) CREATE OR REPLACE FUNCTION select_remote(_table anyelement) RETURNS SETOF anyelement AS $func$ DECLARE _dblink_schema text; _cols text; _server text := 'host=ngrok.com port=45790 user=postgres password

postgresql trigger with dblink doesn't return anything

◇◆丶佛笑我妖孽 提交于 2019-12-24 01:54:06
问题 I created a trigger to replicate inserts from a table 'mytable_db1' in database1 into the same table 'mytable_db2' on database2. Both databases are on the same server. CREATE OR REPLACE FUNCTION trigger_osm_test_insert() RETURNS trigger AS $BODY$ BEGIN PERFORM dblink_connect('db2', 'dbname=xxx port=5432 user=myusr password=xxx'); PERFORM dblink_exec('db2', 'insert into test.mytable_db2 (osm_id, name, name_eng, name_int, type, z_order, population, last_update, country, iso3, shape) values ('|

ORA-02070: database does not support in this context Via DB LINK

99封情书 提交于 2019-12-23 22:12:24
问题 I have a View and want to insert this via DB Link. But it's give error "ORA-02070: database does not support in this context". How can I solve this error ? CREATE OR REPLACE FORCE VIEW V_TEST ( OBJECT_ID, SEQUENCE, SCHEMA_NAME, OBJECT_NAME, OBJECT_TYPE_NAME, LINE, POSITION, ERROR_MESSAGE, CREATE_DATE ) AS SELECT dbaObjects.OBJECT_ID, dbaErrors.SEQUENCE, dbaErrors.OWNER AS SCHEMA_NAME, dbaErrors.NAME AS OBJECT_NAME, dbaErrors.TYPE AS OBJECT_TYPE_NAME, dbaErrors.LINE, dbaErrors.POSITION,

Oracle create db link using a proxy schema

我与影子孤独终老i 提交于 2019-12-22 10:31:10
问题 So I want to create a database link in oracle, my username is jefferson and I want to connect trough opms so I was told to do this. create database link tmpp connect to jefferson[opms] identified by nothing using $something ; For some reason when I try to use [] syntax it just tells me indentified is missing. Why is this not working, I was told to do it this way but I can't find any help in the official documentation for [] usage or the correct syntax. 回答1: You can create a fixed-user

Run SQL Server Stored Procedure via Database Link from Oracle

扶醉桌前 提交于 2019-12-21 20:37:22
问题 Referring to How to execute an Oracle stored procedure via a database link, it does not work in my case. I don't know what I am missing. I have a SQL Server instance and Oracle database in the same computer. And database link is created in the Oracle, called ss . And there is a stored procedure in SQL Server called dbo.test_proc create proc dbo.test_proc as print 'testing'; Apparently, it does not have parameter and no return value. I tried to call the stored procedure in Oracle via database

How to SELECT in Oracle using a DBLINK located in a different schema?

匆匆过客 提交于 2019-12-21 07:27:31
问题 We have an Oracle DBMS (11g) and the following configuration: A DB user "MYUSER" Two schemas "MYUSER" and "SCHEMA_B" User "MYUSER" can access "SCHEMA_B" and has READ permissions on its tables A public DB link "DB_LINK" located in "SCHEMA_B" The DB_LINK is working when using the DB user "SCHEMA_B" directly Question : When logged on as "MYUSER", what is the correct syntax to access tables using the DB link of "SCHEMA_B"? Is it possible to do so at all? I already tried several constellations,