Mihai Viisan
Mihai Viisan

Reputation: 1

Cannot use default Oracle 11G package utl_file

I'm using PLSQL Developer client to access my 11G Oracle database. My understanding is that these are the default packages that come with this version. However, if I try to declare a utl_file.file_type variable, I get the following error:

PLS-00201: identifier 'UTL_FILE' must be declared

My program:

declare 
  l utl_file.file_type;
begin
  NULL;
end;

I've tried to declare, for instance, a DBMS_LOB.BFILE, and it compiled succesfully, that prooves that some other packages are imported in my block. Aren't all Oracle default packages automatically imported?

Upvotes: 0

Views: 1297

Answers (1)

parikLS
parikLS

Reputation: 553

My assumption that if it's yours database, you have got pass for user SYS. If it is, you should check if package utl_file is installed. You can connect by SYS and execute this statement

SELECT * FROM dba_objects WHERE object_name = 'UTL_FILE'

You should see if that package exists. Also you should see object type 'SYNONYM' with owner 'PUBLIC'. If package present in DB, but there is no synonym for it, you can create it using this statement

CREATE PUBLIC SYNONYM OF UTL_FILE FOR SYS.UTL_FILE

If there is no such package - you should install it, by executing script, which is located in

{ORACLE_HOME}/rdbms/admin/utlfile.sql

Upvotes: 0

Related Questions