DG4ODBC - ORA-02022: Remote Statement Has Unoptimized View With Remote Object

(Doc ID 2360126.1)

Last updated on FEBRUARY 16, 2018

Applies to:

Oracle Database - Enterprise Edition - Version 12.1.0.2 and later
Information in this document applies to any platform.

Symptoms

With Oracle Database Gateway for ODBC (DG4ODBC) 12.1.0.2, or any other version, executing MERGE INTO command fails with the following error:

ORA-02022: remote statement has unoptimized view with remote object

Below is an example of a MERGE INTO command that will update/insert at Microsoft SQL Server Database

SQL> MERGE INTO SYN_FACILITY_MAPPING@SQL_DBLINK1 TGT
  USING (SELECT ACR_FACILITY_CD,SYN_SITE_NUM FROM S_SYN.SYN_FACILITY_MAPPING@ORA_DBLINK2) SRC
  ON (TGT."Acr_Facility_Cd" = SRC.ACR_FACILITY_CD)
WHEN MATCHED
THEN
  UPDATE SET TGT."Acr_Facility_Cd" = SRC.ACR_FACILITY_CD
WHEN NOT MATCHED
THEN
  INSERT ("Acr_Facility_Cd", "Syn_Site_No")
  VALUES (SRC.ACR_FACILITY_CD, SRC.SYN_SITE_NUM);
  USING (SELECT ACR_FACILITY_CD,SYN_SITE_NUM FROM S_SYN.SYN_FACILITY_MAPPING@ORA_DBLINK2) SRC
  *
ERROR at line 2:
ORA-02022: remote statement has unoptimized view with remote object

Cause

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms