Outer Join Query over Dblink Can Fail with ORA-904 (Doc ID 730256.1)

Source: Internet
Author: User

< /td> Outer Join Query over Dblink Can Fail with ora- 904 (Doc ID 730256.1) to Bottom
Modified: 03-may-2013 Type: problem

In this Document

Symptoms
Changes
Cause
Solution
References

Applies To: Oracle database-enterprise edition-version 10.2.0.1 to 11.1.0.7 [Release 10.2 to 11.1]
Information in this document applies to any platform.
Symptoms


Following query over Dblink has Local database 9ir2 and remote 10GR2 works.

SELECT *
From [email protected] I,
[Email protected] s,ods.institutions Oi
where s.stt_state_type_id (+) = i.stt_state_type_id
and oi.ctps_insttn_id = i.inst_insttn_id
and I.inst_modifd_dt = trunc (sysdate)
and (NVL (Oi.inst_state_txt, ' x ') <> NVL (s.stt_state_type_nm, ' X '))
and (NVL (oi.inst_phone_txt) <> NVL (I.inst_phone_txt, 17));

The same query fails when both local and remote databases is 10g R2 with following errors:

ERROR at line 2:
ORA-00904: "OI". " Inst_state_txt ": Invalid identifier
Ora-02063:preceding Line from CTPS3


Changes

Cause

Outer join query over Dblink can fail with ORA-904, as referenced in:

BUG 6620988 QUERY over DBLINK fails with ORA-904 SELECTING DATE

Predicates is not checked to verify if they belong to same network node, we attempt to colocate the remote tables. This results in wrongly generating remote query and ORA-904

Rediscovery information:
1. ORA-904
2. DB Link
3. OJ predicates Across network nodes
4. Predicates wrongly pushed network nodes

Solution

--to implement the solution, please execute the following steps::

Use the workaround of disabling colocated joins via event 10176 and force a hard parse to happen
(ie by flushing the shared pool), ie:

Sql> alter session SET events ' 10176 Trace name context forever ';
Sql> alter system flush Shared_pool;

Or

For a permanent fix, request a one-off backport of 6620988 for the appropiate platform.

REFERENCESbug:6620988 -QUERY over DBLINK fails with ORA-904 SELECTING DATE

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.