How to use package classes and call packages from Oracle11gr2 stored procedure in certain schema

oraclestored-procedures

When a stored procedure begins with

4 create or replace procedure user0.import
5 is
6   f1 utl_file.file_type;

compiler throws an error Error(6,6): PLS-00201: identifier 'UTL_FILE' must be declared.

But if I replaced is with declare and ran the same as anonymous block selecting everything after line 4, it would work fine and import data as expected. This is runnning under SYS AS SYSDBA. Also it would compile fine if user0 schema was not used.

Why cannot I as sysdba compile a procedure in a user0 schema?

Best Answer

Try granting directly execute to utl_file to user0:

grant execute on util_file to user0;

Then try to recompile the code.