Orcale 中的 Blob
用来保存较大的图形文件或带格式的文本文件,如Miceosoft Word文档,以及音频、视频等非文本文件,最大长度是4GB。
LOB有几种类型,取决于你使用的字节的类型,Oracle 8i实实在在地将这些数据存储在数据库内部保存。
可以执行读取、存储、写入等特殊操作。 详细请看:http://www.oradb.net/newuser/datatype_001.htm

解决方案 »

  1.   

    //--------------ORACLE 保存图片
    grant create any directory to scott;
    grant create any library to scott;
    create or replace directory utllobdir as 'c:\oracle';
    create table bfile_tab (bfile_column BFILE);
    create table utl_lob_test (blob_column BLOB);set serveroutput on然后执行下面语句就将G:\oracle目录下的Azul.jpg存入到utl_lob_test
    表中的blob_column字段中了。
    declare
       a_blob  BLOB;
       a_bfile BFILE := BFILENAME('UTLLOBDIR','Azul.jpg');
    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;
    /
      

  2.   

    LGQDUCKY(飘)兄盗用俺的代码,
    侵犯版权,小心俺投诉你
    :)
      

  3.   

    够详细了吧
    grant create any directory to scott;//赋权限
    grant create any library to scott;//赋权限
    create or replace directory utllobdir as 'c:\oracle';//设置图片的路径
    create table bfile_tab (bfile_column BFILE);//创建测试表
    create table utl_lob_test (blob_column BLOB);