Oracle PL/SQL - PL SQL Data Type BFILE type

Introduction

Oracle accesses files on the server by using a directory, which is a pointer to an operating system folder.

To map a folder to you local folder C:\IO, execute the following SQL commands:

create directory IO as 'C:\IO';
grant read, write on directory IO to public;

Now, when you refer to IO in any commands, you're referring to the C:\IO folder in the file system.

To create a pointer to the file on the server and place that pointer in the table on an existing record.

drop table catalog;
create table catalog(
   item_id number,
   name_tx VARCHAR2(2000),
   manual_cl CLOB,
   firstpage_bl BLOB,
   mastertxt_bf BFILE
);

declare
     v_bf BFILE;                                                      
begin
     v_bf:=BFILENAME ('IO', 'text.htm');                              
     insert into  t_catalog(item_id, name_tx, mastertxt_bf)
     values (1, 'TEXT.HTM', v_bf);                                    
end;
/

Related Topics