PL/SQL: ORA-04052: error occurred when looking up remote object

Posted on 2006-07-20
Last Modified: 2011-08-18

This is my procedure



      INSERT INTO care_admin.coventry_adPerSyncLog
      SELECT * FROM yyuniv.adPerSyncLog@UNIVERSE;
      DELETE FROM yyuniv.adPerSyncLog@UNIVERSE;


but I get lovely errors

PL/SQL: ORA-04052: error occurred when looking up remote object
ORA-00604: error occurred at recursive SQL level 1
ORA-06552: PL/SQL: Compilation unit analysis terminated
ORA-06553: PLS-320: the declaration of the type of this
expression is incomplete or malformed
ORA-02063: preceding 2 lines from UNIVERSE

I tried running the insert statement directly via SQL Plus and it worked correctly.  Not sure why it works interactively but not contained in a procedure.

Any ideas anyone?  Thanks in advance for you help.

Question by:twisted_kiwi

Author Comment

ID: 17147779
I have now found out about the catrpc.sql script (formally KGLR.SQL) and have run that on the remote universe database but I still get the same error.
LVL 14

Expert Comment

ID: 17147970
Check the NLS_LANG on both your databases.
Also what's the version of your remote db and the other DB?
LVL 14

Accepted Solution

sathyagiri earned 75 total points
ID: 17147980
Also make sure the grants on the remote table are explicitly assigned to the user.
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

LVL 18

Expert Comment

ID: 17149306

I assume that the structure of the two tables is the same?
Looking up ORA-06552, the only odd thing that i can find is that one of the column names is a datatype.

create table coventry_adPerSyncLog (
  "DATE" date,
  text1 varchar2(20),
  text2 carchar2(30)

having column1 called DATE ( which is a datatype ) can result in this error.
can this be the case?

LVL 16

Expert Comment

ID: 17151585
>> I tried running the insert statement directly via SQL Plus and it worked correctly.
There must be some permission issues with tables. As sathyagiri  suggested assign the grants on the remote table explicitly instead of using roles.

If the procedure is executed by a different user then specify "AUTHID CURRENT_USER"  to run the procedure with the rights of the owner executing the code.

Author Comment

ID: 17286443
It turns out that a stored procedure does not take into account and access granted via roles.  So even though the user had the correct rights via their roles, these were not used when the stored proc was run.  I granted the rights explicitly to the user and it works fine.  

Thanks for the help.

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article started out as an Experts-Exchange question, which then grew into a quick tip to go along with an IOUG presentation for the Collaborate confernce and then later grew again into a full blown article with expanded functionality and legacy…
How to Create User-Defined Aggregates in Oracle Before we begin creating these things, what are user-defined aggregates?  They are a feature introduced in Oracle 9i that allows a developer to create his or her own functions like "SUM", "AVG", and…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Via a live example, show how to restore a database from backup after a simulated disk failure using RMAN.

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now