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 WRITE ,SAVE A FILE IN BLOB COLUMN

Uday_NOct 6 2010 — edited Oct 6 2010
Hi,
I have to write a simple utl file and store it in a column of blob data tye..i hav written a piece of code..it shows invalid path as error..please kindly help me


create or replace
procedure simp_file as

fhandler utl_file.file_type;
f_dir VARCHAR2(100);
f_file VARCHAR2(100);




BEGIN


f_dir := 'C:/utl/';
f_file := 'Kings.txt';




BEGIN
fhandler := utl_file.fopen(f_dir,f_file,'a');
EXCEPTION
WHEN utl_file.invalid_path THEN
f_dir := 'C:/utl/';
fhandler := utl_file.fopen(f_dir,f_file,'a');
END;

utl_file.new_line(fhandler,1);

utl_file.putf(fhandler,'hi');

utl_file.fclose(fhandler);

EXCEPTION
WHEN UTL_FILE.INVALID_PATH THEN
IF (utl_file.is_open(fhandler)) THEN
utl_file.fclose(fhandler);
END IF;
raise_application_error(-20101, 'Invalid path');



END simp_file;
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 3 2010
Added on Oct 6 2010
6 comments
6,541 views