RT
求一个最基本的方法 好理解的

解决方案 »

  1.   


    DECLARE   
      stud_hist   CLOB;   
      BEGIN   
      --Fetch   the   LOB   locator   
      SELECT   student_history   INTO   stud_hist   
      FROM   student   
      WHERE   student_id   =   1003   
      FOR   UPDATE;   
      --The   LOB   is   empty   to   start   with.   Append   10   characters   
      --onto   the   end.   
      DBMS_LOB.WRITEAPPEND   (stud_hist,   10,   ‘1234567890’);   
      --Do   the   same   thing   twice   more,   giving   
      --us   a   total   of   30   characters.   
      DBMS_LOB.WRITEAPPEND   (stud_hist,   10,   ‘1234567890’);   
      DBMS_LOB.WRITEAPPEND   (stud_hist,   10,   ‘1234567890’);   
      END;
      

  2.   

    student student_history字段的类型为clob类型
      

  3.   

    declare
      lobloc clob;
      fileloc bfile;
      amount int;
      src_offset int := 1;
      dest_offset int := 1;
      csid int := 0;
      lc int := 0;
      warning int;
    begin
      fileloc := bfilename('G','test.txt');
      dbms_lob.fileopen(fileloc,0);
      amount := dbms_lob.getlength(fileloc);
      select resume into lobloc from lob_test where id = 1 for update;
      dbms_lob.loadclobfromfile(lobloc,fileloc,amount,dest_offset,src_offset,csid,lc,warning);
      dbms_lob.fileclose(fileloc);
      commit;
    end;  前提:1.先建立目录G,在目录G内建立文件test.txt.
         2.建立表lob_test,字段resume为clob