在internal这个用户下给scott用户授权如下:
SQL>grant create any directory to scott;
SQL>grant create any library to scott;
在scott这个用户下执行下述语句:SQL>create table bfile_tab (bfile_column BFILE);
SQL>create table utl_lob_test (blob_column BLOB);
SQL>create or replace directory utllobdir as 'C:\DDS\EXTPROC';
SQL>set serveroutput on然后执行下面语句就将C:\DDS\EXTPROC目录下的word文件COM.doc存入到utl_lob_test 
表中的blob_column字段中了。declare
   a_blob  BLOB;
   a_bfile BFILE := BFILENAME('UTLLOBDIR','COM.doc'); --用来指向外部操作系统文件
begin
   insert into bfile_tab values (a_bfile)
     returning bfile_column into a_bfile;
   insert into utl_lob_test values (empty_blob())
     returning blob_column into a_blob;
   dbms_lob.fileopen(a_bfile);
   dbms_lob.loadfromfile(a_blob, a_bfile, dbms_lob.getlength(a_bfile));
   dbms_lob.fileclose(a_bfile);
   commit;
end;
/
SQL>show errors
此时可以使用DBMS_LOB包的getlength这个procedure来检测是否已经将该word文件存入
到blob字段中了。如:
SQL> select dbms_lob.getlength(blob_column) from UTL_LOB_TEST;
结果如下:
DBMS_LOB.GETLENGTH(BLOB_COLUMN)
-------------------------------
                83968
说明该word文件已经存入到blob字段中去了。这篇文章我看过,但他好象只能把服务器上的图片加到数据库的,还没看太明白。

解决方案 »

  1.   

    你是如何控制扫描仪的?能给个源码吗??我的扫描仪是虹光AU600的,高分相送!!在
    http://community.csdn.net/Expert/topic/3545/3545100.xml?temp=.814831
    内给分!!
      

  2.   

    你是如何控制扫描仪的?能给个源码吗??我的扫描仪是虹光AU600的,高分相送!!在
    http://community.csdn.net/Expert/topic/3545/3545100.xml?temp=.814831
    内给分!!