I tried to use ORA_FFI for loading the file but I found no way to return
a buffer containing ASCII 0's into a PLSQL varchar2 variable, so this method
does not seem useful.
The question is: what is the best way to load a file into a BLOB using Forms
(d2kutil, user exit, ....)?
I'd suggest creating a package on the server, then calling a member function
of that package in your on-insert form trigger.
Here is a sample of how to handle the load...
create table blob_test (id number not null primary key,
blob_file blob);
create or replace directory my_files as 'C:\My Documents';
create or replace procedure blob_ins(p_id in number, p_filename in varchar2) as
l_bfile bfile;
l_blob blob;
begin
insert into blob_test(p_id, empty_blob())
returning blob_file into l_blob;
l_bfile := bfilename('MY_FILES', p_filename);
dbms_lob.fileopen(l_bfile);
dbms_lob.loadfromfile(l_blob, l_bfile, dbms_lob.getlength(l_bfile));
dbms_lob.fileclose(l_bfile);
commit;
return;
end blob_ins;
/
The directory you created (my_files) is a database pointer to a folder or
directory on the DB server that contains the file in question. When it
gets used in the bfilename call, it's been automatically upper-cased, like
other objects (tables, views, etc).
The returning clause essentially creates a referential link between the
local variable l_blob and the current record of the table blob_test.
Modifying the value in l_blob automatically updates the current record,
so no additional updates are necessary.
Good luck.
Eric
macv...@yahoo.it (Macvl2000) wrote in message news:<dfb206b6.01122...@posting.google.com>...