Good afternoon,
I have 2 users in an ORACLE database, USER1 and USER2.
USER2 has a view VIEW1, and i want a procedure in USER1 to access VIEW1 through a cursor, like this:
create or replace procedure PROCEDURE1 is
CURSOR C_CURSOR
IS
select * from USER2.VIEW1;
BEGIN
RETURN;
end PROCEDURE1;
However, when i try to compile the PROCEDURE1, i get the error:
ORA-01031 - insufficient privelieges
However, i only get this error inside the stored procedure, as i can do the following query just fine from USER1:
select * from USER2.VIEW1;
Can you please tell me what i'm doing wrong?
Thanks a lot!