Problem with utl file
577284May 28 2008 — edited May 28 2008Hi to all,
I have tried the UTL file concept as per the oracle documentation
I have created a directory name read_flat_file and granted read, write permission to the whm user. I am trying to executing the below code as in Oracle Documentation, but I am getting this below error.
DECLARE
V1 VARCHAR2(32767);
F1 UTL_FILE.FILE_TYPE;
BEGIN
F1 := UTL_FILE.FOPEN('READ_FLAT_FILE','HMI PO','R',256);
UTL_FILE.GET_LINE(F1,V1,32767);
UTL_FILE.FCLOSE(F1);
END;
Error I am getting is
F1 UTL_FILE.FILE_TYPE;
*
ERROR at line 3:
ORA-06550: line 3, column 4:
PLS-00201: identifier 'UTL_FILE' must be declared
ORA-06550: line 3, column 4:
PL/SQL: Item ignored
ORA-06550: line 5, column 1:
PLS-00320: the declaration of the type of this expression is incomplete or
malformed
ORA-06550: line 5, column 1:
PL/SQL: Statement ignored
ORA-06550: line 6, column 19:
PLS-00320: the declaration of the type of this expression is incomplete or
malformed
ORA-06550: line 6, column 1:
PL/SQL: Statement ignored
ORA-06550: line 7, column 17:
PLS-00320: the declaration of the type of this expression is incomplete or
malformed
ORA-06550: line 7, column 1:
PL/SQL: Statement ignored
I tried this code from system user but I got the same error.
When I am trying the same code with the SYS User I got this error.
declare
*
ERROR at line 1:
ORA-29283: invalid file operation
ORA-06512: at "SYS.UTL_FILE", line 475
ORA-29283: invalid file operation
ORA-06512: at line 5
I dont understand the UTL_FILE package is granted to PUBLIC role by default.
In sys user the handler is throwing the error perfectly that invalid file operation. then why this is not occuring with other users.
Please let me know why this is happening
Thanks and Regards,
Vijay