|
- select * from dba_directories;
- select * from dba_tab_privs tp where tp.grantee='HR';
- create table t071fi11_blob ( pic# number(2), pic_name varchar2(20), photo blob ) ;
- CREATE OR REPLACE PROCEDURE proc071fi11_blob ( p_1 number, p_2 varchar2, p_dir VARCHAR2, p_file VARCHAR2)
- IS
- v_f BFILE;
- v_b blob;
- BEGIN
- INSERT INTO t071fi11_blob values(p_1, p_2, EMPTY_BLOB ()) RETURN photo into v_b;
- v_f := BFILENAME (p_dir, p_file);
- DBMS_LOB.FILEOPEN (v_f, DBMS_LOB.FILE_READONLY);
- DBMS_LOB.LOADFROMFILE (v_b, v_f, DBMS_LOB.GETLENGTH (v_f));
- DBMS_LOB.FILECLOSE (v_f);
- commit;
- end;
- /
-
- begin
- proc071fi11_blob(1, 'RedHat is good', 'DIR1', 'c.jpg');
- end;
- /
- select * from t071fi11_blob;
-
复制代码
|
|