Home » SQL & PL/SQL » SQL & PL/SQL » Re: Access to other user's object from procedure
Re: Access to other user's object from procedure [message #20468] Mon, 27 May 2002 11:37 Go to next message
Valery
Messages: 3
Registered: May 2002
Junior Member
Many thanks for your advise!

SQL>
1 CREATE or replace procedure oth_user
2 as
3 cnt number;
4 begin
5 select count(*) into cnt from scott.emp;
6 dbms_output.put_line(cnt);
7* end;
SQL> /

I did that and I got same error message:

SQL> sho error PROCEDURE oth_user;
Errors for PROCEDURE OTH_USER:

LINE/COL ERROR
-------- -----------------------------------------------------------------
5/1 PL/SQL: SQL Statement ignored
5/31 PLS-00201: identifier 'SCOTT.EMP' must be declared
Re: Access to other user's object from procedure [message #20470 is a reply to message #20468] Mon, 27 May 2002 17:54 Go to previous message
Mahesh Rajendran
Messages: 10707
Registered: March 2002
Location: oracleDocoVille
Senior Member
Account Moderator
*****************************
check the privileges. first check whether
user scott exists!!
*****************************
SQL> connect test/test@high9i
Connected.
SQL> ed
Wrote file afiedt.buf

1 CREATE or replace procedure oth_user
2 as
3 cnt number;
4 begin
5 select count(*) into cnt from scott.emp;
6 dbms_output.put_line(cnt);
7* end;
SQL> /

Warning: Procedure created with compilation errors.

SQL> show err
Errors for PROCEDURE OTH_USER:

LINE/COL ERROR
-------- -----------------------------------------------------------------
5/2 PL/SQL: SQL Statement ignored
5/38 PL/SQL: ORA-00942: table or view does not exist
SQL> connect scott/tiger@high9i
Connected.
SQL> grant select on emp to test;

Grant succeeded.

SQL> connect test/test@high9i
Connected.
SQL>
SQL> CREATE or replace procedure oth_user
2 as
3 cnt number;
4 begin
5 select count(*) into cnt from scott.emp;
6 dbms_output.put_line(cnt);
7 end;
8 /

Procedure created.
SQL> set serveroutput on
SQL> exec oth_user
14

PL/SQL procedure successfully completed.
Previous Topic: Create & drop user thru PL/SQL
Next Topic: INSERT FILES USING DATA TYPE LONG RAW IN ORACLE 7.3
Goto Forum:
  


Current Time: Tue May 21 07:13:03 CDT 2024