Home » Infrastructure » Unix » Unix Scripting | With Oracle db (Unix)
Unix Scripting | With Oracle db [message #364373] Mon, 08 December 2008 03:38 Go to next message
bahubcd
Messages: 36
Registered: July 2007
Location: Bangalore
Member
Hi all,
I have a stored procedure as below. But am getting error for the fopen statement.

I can access /home/ibm4/retlRMSforRDF/data from my unix login. But when i run the below procedure i get an error
ORA-20052: Invalid file location.

Can some one suggest how can I make my PLSQL procedure to access files in Unix. Does it have anything to do with the unix user priviliges? Or DO i have to mention the Unix login credentials in the Oracle stored procedure before opening the file?

Thanks in advance for all the attentions and co-operation

BEGIN
vSFile := utl_file.fopen('/home/ibm4/retlRMSforRDF/data', file_name,'r');

IF utl_file.is_open(vSFile) THEN
LOOP
BEGIN
utl_file.get_line(vSFile, vNewLine);

IF vNewLine IS NULL THEN
EXIT;
END IF;
v1 := substr(vNewLine,1,instr(vNewLine,'|',1,1)-1);
v2 := substr(vNewLine,instr(vNewLine,'|',1,1)+1,instr(vNewLine,'|',1,1)-1);


INSERT INTO testdata
(val, mon)
VALUES
(v1, v2);
EXCEPTION
WHEN NO_DATA_FOUND THEN
EXIT;
END;
END LOOP;
COMMIT;
END IF;
utl_file.fclose(vSFile);
END read_file;
Re: Unix Scripting | With Oracle db [message #364377 is a reply to message #364373] Mon, 08 December 2008 03:51 Go to previous message
Michel Cadot
Messages: 64103
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
1/ directory should be in utl_file_dir parameter
2/ directory shoud exist
3/ directory shoud be accessible to user that started the instance or listener

Regards
Michel
Previous Topic: How to execute procedure everyday
Next Topic: Solaris Very Direct IO
Goto Forum:
  


Current Time: Sat Dec 03 03:41:54 CST 2016

Total time taken to generate the page: 0.18885 seconds