I have a SQL script referencing that runs fine when I use sql*plus from user A.
If I copy and paste the code from the script in order to make it a stored procedure in schama A i cannot compile the objects it references in schema B.
/* logged on schema A from SQL Navigator */
PROCEDURE MYPROC IS
myvar B.MYTABLE.MY_COLUMN%type;
BEGIN
DBMS_OUTPUT.PUT_LINE('HELLO');
END ;
I get this error:
PLS-00201: identifier 'B.MYTABLE' must be declared
But as a script, it runs successfully from sqlplus logged as user A
DECLARE
myvar B.MYTABLE.MY_COLUMN%type;
BEGIN
DBMS_OUTPUT.PUT_LINE('HELLO');
END ;
/
exit
Why? How could it run as a script from the same user A?