ORA-02016: Cannot use a sub-query in START WITH on a remote database

ORA- Error:

SELECT level, LPAD(ename,level*5,' ') ename
FROM employee
start with empno=100
CONNECT_BY by nocycle prior empno = mgr
/

ORA-02016: Cannot use a sub-query in START WITH on a remote database


Cause :

An attempt has been made to access the remote database tables in a hierarchy sql containing START WITH clause which no longer supports access to remote dependencies in oracle 18/19c. 


Solution :

Try executing the query by setting below hidden parameter at session level. 


alter session set "_connect_by_use_union_all"=false;

below error could be reported if alter session command not executed by privileged user like pdbadmin

Error starting at line : 1 in command -
alter session set "_connect_by_use_union_all"=false
Error report -
ORA-01031: insufficient privileges
01031. 00000 - "insufficient privileges"
*Cause: An attempt was made to perform a database operation without
the necessary privileges.
*Action: Ask your database administrator or designated security
administrator to grant you the necessary privileges



Reference :

ORA-02016: Cannot use a sub-query in START WITH on a remote database after database upgraded To 12c (Doc ID 2266473.1)






No comments:

Post a Comment