ORA-29283: invalid file operation [message #612243] |
Tue, 15 April 2014 04:30 |
|
bryant1003
Messages: 8 Registered: April 2014
|
Junior Member |
|
|
Hi All,
I'm having an issue with the following Procedure;
create or replace
PROCEDURE SP_IF334
(
AUD_ROWID IN VARCHAR2
, FILE_PREFIX IN VARCHAR2
, FILE_NAME OUT VARCHAR2
) AS
FoundGtransNum number(12);
fHandle UTL_FILE.FILE_TYPE;
BEGIN
dbms_output.put_line(' - IF334: Entered at '||to_char(sysdate,'dd/mm/yy hh24:mi:ss'));
select gtrans_num
into FoundGtransNum
from user_ax.gtrans_trig
where rowid = AUD_ROWID;
FILE_NAME := FILE_PREFIX||FoundGtransNum||'.csv';
dbms_output.put_line(' - IF334: Filename: '||FILE_NAME);
fHandle := UTL_FILE.FOPEN('AX_OUT', FILE_NAME, 'W');
UTL_FILE.PUT_LINE(fHandle, 'This is the first line');
UTL_FILE.PUT_LINE(fHandle, 'This is the second line');
UTL_FILE.PUT_LINE(fHandle, 'This is the third line');
UTL_FILE.FCLOSE(fHandle);
dbms_output.put_line(' - IF334: Finished at '||to_char(sysdate,'dd/mm/yy hh24:mi:ss'));
END SP_IF334;
When I call this procedure, I get the following messages:
Error report:
ORA-29283: invalid file operation
ORA-06512: at "SYS.UTL_FILE", line 536
ORA-29283: invalid file operation
ORA-06512: at "USER_AX.SP_IF334", line 23
ORA-06512: at line 130
29283. 00000 - "invalid file operation"
*Cause: An attempt was made to read from a file or directory that does
not exist, or file or directory access was denied by the
operating system.
*Action: Verify file and directory access privileges on the file system,
and if reading, verify that the file exists.
The calling code for this procedure is as follows;
elsif found_if.if_ref = 'IF334' then
--IF334: Stock Movement
dbms_output.put_line(' - Calling IF334');
dbms_output.put_line(' - audit_record.rowid : '||audit_record.rowid);
dbms_output.put_line(' - found_if.output_prefix : '||found_if.output_prefix);
user_ax.SP_IF334(audit_record.rowid,found_if.output_prefix,res_output_filename);
dbms_output.put_line(' - Procedure SP_IF334 completed. Filename returned is '''||res_output_filename||'''');
and the dbms output related to this section is as follows;
- Calling IF334
- audit_record.rowid : AAAh6+AAvAAEmWkAAM
- found_if.output_prefix : 334_StkMove_
- IF334: Entered at 15/04/14 10:26:12
- IF334: Filename: 334_StkMove_8122560.csv
This is on a HPUX box, and the permissions of the directory are 777 (RWXRWXRWX) however i can't work out whats going wrong. Please Help!!!
|
|
|
|
|
|
|
|
|
|
Re: ORA-29283: invalid file operation [message #612254 is a reply to message #612252] |
Tue, 15 April 2014 05:38 |
|
dariyoosh
Messages: 538 Registered: March 2009 Location: France
|
Senior Member |
|
|
Inside your code, add the following put_line right after the filename concatenation
...
FILE_NAME := FILE_PREFIX||FoundGtransNum||'.csv';
sys.dbms_output.put_line('The file name is: ' || FILE_NAME);
Post the output here or rather check whether it is really set to what you expect. I don't really see the point of this concatenation with the FILE_PREFIX. This is ignored by fopen according to the documentation.
http://docs.oracle.com/cd/E16655_01/appdev.121/e17602/u_file.htm#i1003526
Quote:
...
File name, including extension (file type), without directory path. If a directory path is given as a part of the filename, it is ignored by FOPEN. On Unix, the filename cannot end with /.
...
[Updated on: Tue, 15 April 2014 05:38] Report message to a moderator
|
|
|
Re: ORA-29283: invalid file operation [message #612255 is a reply to message #612254] |
Tue, 15 April 2014 05:48 |
|
bryant1003
Messages: 8 Registered: April 2014
|
Junior Member |
|
|
Hi Dariyoosh,
The concatenation is simply as the call to each procedure also passes through a filename 'prefix', it's not a directory at all. I added the output lines as requested, please see the output below;
- Calling IF334
- audit_record.rowid : AAAh6+AAvAAEmWkAAM
- found_if.output_prefix : 334_StkMove_
- IF334: Entered at 15/04/14 11:45:24
The file name is: 334_StkMove_8122560.csv
The file prefix is: 334_StkMove_
The FoundGtransNum is: 8122560
- IF334: Filename: 334_StkMove_8122560.csv
As you can see this is just building the output filename, with the first 'part' being passed to the procedure, and the second part being retrieved from a table.
[Updated on: Tue, 15 April 2014 05:48] Report message to a moderator
|
|
|
Re: ORA-29283: invalid file operation [message #612256 is a reply to message #612243] |
Tue, 15 April 2014 06:16 |
pointers
Messages: 451 Registered: May 2008
|
Senior Member |
|
|
Please see if you have necessay privileges on the mentioned directory
/procdi/tmpeoU/AX/
if you are not very sure just try chmod 777 intially (only for testing, have to set it correctly otherwise), hope it helps.
Regards,
Pointers
|
|
|
|
Re: ORA-29283: invalid file operation [message #612259 is a reply to message #612256] |
Tue, 15 April 2014 06:21 |
|
dariyoosh
Messages: 538 Registered: March 2009 Location: France
|
Senior Member |
|
|
pointers wrote on Tue, 15 April 2014 13:16if you are not very sure just try chmod 777 intially (only for testing, have to set it correctly otherwise), hope it helps.
I believe that the OP specified that clearly at the beginning
"bryant1003 wrote Tue, 15 April 2014 11:30"
...
This is on a HPUX box, and the permissions of the directory are 777 (RWXRWXRWX) however i can't work out whats going wrong
...
[EDIT]: didn't see bryan reply !
[Updated on: Tue, 15 April 2014 06:22] Report message to a moderator
|
|
|
|
|
|
|
|
|