Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to create and write into file using UTIL_FILE in client system?

871594Mar 8 2012 — edited Mar 10 2012
Hi friends,


I am using oracle client , installed in unix system.

I want to create a text file in client unix system. when i provide a directory which is on client system to below procedure then file is not creating on client directory.But when i provide a directory on server the file is creating in server directory..

please suggest me how to create a file in client directory(by providing client host name or something else).

My Procedure:

create or replace procedure Add_To_File is

OutFile utl_file.file_type;
l_err_code NUMBER(10);
l_err_msg VARCHAR2(2000);
vNewLine VARCHAR2(4000);
vdir varchar2(200):='UTIL_DIR'; // UTIL_DIR _CLIENT= /homeu/vvadlam/util //file is not creating
UTIL_DIR_SERVER=/home/vvadlam/util //file is creating


begin

OutFile:=utl_file.fopen(vdir,'out.txt','W','32000');
vNewLine:='Scheduling is successfull';
utl_file.put_line(OutFile,vNewLine);
utl_file.fflush(OutFile);


EXCEPTION
WHEN OTHERS THEN
l_err_code := SQLCODE;
l_err_msg := SUBSTR(SQLERRM,1,128);

Dbms_output.put_line(l_err_code || l_err_msg);
end;
/

Thanks,
Venkat Vadlamudi
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 7 2012
Added on Mar 8 2012
6 comments
426 views