I am using Oracle 10.2.
I am working in some scripts to move some ORACLE Objects from one SCHEMA (S1) to another (S2). I am creating the functions with DBA role. When moved, one of my functions becomes invalid, but I don't understand why. Its code goes along these lines:
MY_FUNC
CREATE OR REPLACE FUNCTION S2."MY_FUNC" RETURN VARCHAR2 IS
something VARCHAR2;
othervar VARCHAR2 (50):= 'TEST';
BEGIN
something := S2.MY_FUNC2();
/*some code*/
return othervar;
END;
/
If I use MY_FUNC2
without the schema, It works:
something := MY_FUNC2();
instead of something := S2.MY_FUNC2();
My_FUNC2
CREATE OR REPLACE FUNCTION S2."MY_FUNC2" RETURN VARCHAR2 IS
something BOOLEAN;
othervar VARCHAR2 (50) := 'TEST2';
BEGIN
/*some code*/
return othervar;
END;
/
MY_FUNC2 has a synonym like this:
CREATE OR REPLACE PUBLIC SYNONYM "MY_FUNC2" FOR "S2"."MY_FUNC2"
MY_FUNC
compiles with errors:
PLS-00302: component 'MY_FUNC2' must be declared
I don't understand why I am getting this error, when my functions were in the other schema (S1) they had exactly the same structure and the synonym was created exactly the same (but pointing to S1) and MY_FUNC
compiled fine.
I didn't create this functions and synonym originally. Is it possible that I am missing some privileges in S2, so MY_FUNC
can work properly?