DECLARE
   v_text_loc      CLOB;
   v_text_amt      BINARY_INTEGER := 60;
   v_text_buffer   VARCHAR2(60);
BEGIN
   v_text_loc := book_text ('Chapter 1');   v_text_buffer := DBMS_LOB.SUBSTR (v_text_loc, v_text_amt, 1);
   DBMS_OUTPUT.PUT_LINE ('Chapter 1: ' || v_text_buffer);
END;
/The output of this script is:Chapter 1: It was a dark and stormy night.  Suddenly a scream rang out.The next example reads sixty characters at a time from the CLOB chapter_text column of the my_book_text table using the 慍hapter 1?row.  Note that the loop continues until SUBSTR returns NULL (i.e., SUBSTR does not raise NO_DATA_FOUND exception):DECLARE
   v_text_loc      CLOB;
   v_text_amt      BINARY_INTEGER := 60;
   v_text_pos      INTEGER := 1;
   v_buffer   VARCHAR2(60);
BEGIN
   v_text_loc := book_text ('Chapter 1');   LOOP
      v_buffer := 
      DBMS_LOB.SUBSTR (v_text_loc, v_text_amt, v_text_pos);
      EXIT WHEN v_buffer IS NULL;      /* process the text and prepare to read again */
      DBMS_OUTPUT.PUT_LINE('Chapter 1: ' || v_buffer);
      v_text_pos := v_text_pos + v_text_amt;
   END LOOP;
END;
/The output of this script is:Chapter 1: It was a dark and stormy night.  Suddenly a scream rang out.
Chapter 1:   An EXCEPTION had not been handled.
DECLARE
   v_text_loc      CLOB;
   v_text_amt      BINARY_INTEGER := 60;
   v_text_buffer   VARCHAR2(60);
BEGIN
   v_text_loc := book_text ('Chapter 1');
   DBMS_LOB.READ (v_text_loc, v_text_amt, 1, v_text_buffer);
   DBMS_OUTPUT.PUT_LINE('Chapter 1: ' || v_text_buffer);
END;
/The output of this script is:Chapter 1: It was a dark and stormy night.  Suddenly a scream rang out.The next example reads sixty characters at a time from the CLOB chapter_text column of the my_book_text table using the 慍hapter 1?row.  Note that the loop continues until READ raises the NO_DATA_FOUND exception:DECLARE
   v_text_loc      CLOB;
   v_text_amt      BINARY_INTEGER := 60;
   v_text_pos      INTEGER := 1;
   v_text_buffer   VARCHAR2(60);
BEGIN
   v_text_loc := book_text ('Chapter 1');
   LOOP
      DBMS_LOB.READ
         (v_text_loc, v_text_amt, v_text_pos, v_text_buffer);
      /* process the text and prepare to read again */
      DBMS_OUTPUT.PUT_LINE('Chapter 1: ' || v_text_buffer);
      v_text_pos := v_text_pos + v_text_amt;
   END LOOP;
EXCEPTION
   WHEN NO_DATA_FOUND
   THEN
      DBMS_OUTPUT.PUT_LINE('End of Chapter Reached.');
END;
/This script produces:Chapter 1: It was a dark and stormy night.  Suddenly a scream rang out.
Chapter 1:   An EXCEPTION had not been handled.
End of Chapter Reached.Note that the maximum size of a VARCHAR2 or RAW variable is 32767 bytes.  This is the size limit of the buffer to be used with READ.

解决方案 »

  1.   

    呵呵,这个东西,我也是头一天研究!
    参考:
    http://expert.csdn.net/Expert/topic/2479/2479396.xml?temp=4.793948E-02
    下载个
    KXpertPLSQL:
    http://www.quest.com/kxpert_plsql/payload/KXpertPLSQLSetup.exetoad:
    http://www.quest.com/toad/payload/TOADXpertSetup.exe
    toad7.x的注册码:
    5-88860-01683-29060-00749可以找到楼上的解释!(KXpertPLSQL好象是绑在toad上的!)
      

  2.   

    参考以下:
    http://211.99.196.144:8090/forum1/frontshow/dispbbs.jsp?boardid=106&id=5355
    帮助文档:
    http://download-west.oracle.com/docs/cd/B10501_01/appdev.920/a96612/d_lob.htm#ARPLS020