Advertisement
|
[x]
Attachment Details
|
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: |
http://www.experts-exchange.com/Database/Oracle/Q_20958688.html
...
3. Create directory:
SQL>create or replace directory dir_of_file as '/db01/test/';
Directory created.
4. Create a procedure:
CREATE procedure file_into_blob(v_id IN varchar2,v_file_name IN varchar2)
IS
BEGIN
DECLARE
v_bfile bfile := BFILENAME('DIR_OF_FILE', v_file_name); -- note that uppercase
v_lob blob;
BEGIN
insert into test(id,blob_col) values(v_id,empty_blob());
select blob_col into v_lob from test where id = v_id for update;
DBMS_LOB.FILEOPEN(v_bfile, DBMS_LOB.FILE_READONLY);
DBMS_LOB.LOADFROMFILE ( v_lob, v_bfile, DBMS_LOB.GETLENGTH(v_bfile));
DBMS_LOB.CLOSE(v_bfile);
commit;
END;
END;
/
...
|
|
Loading Advertisement... |