Microsoft Windows XP [版本 5.1.2600]
(C) 版权所有 1985-2001 Microsoft Corp.
C:/Documents and Settings/hawk>sqlplus /nolog
SQL*Plus: Release 9.0.1.4.0 - Production on 星期二 7月 18 15:08:15 2006
(c) Copyright 2001 Oracle Corporation. All rights reserved.
SQL> connect system/system
已连接。
SQL> create table testlob ( id number, thelob clob);
表已创建。
SQL> create or replace directory DIR1 as 'd:/test/';
目录已创建。
SQL> create or replace procedure load_lob as
2 l_clob clob;
3 l_bfile bfile;
4 begin
5 insert into testlob values(1,empty_clob())
6 returning thelob into l_clob;
7
8 l_bfile:=bfilename('DIR1','control.txt');
9 dbms_lob.fileopen(l_bfile);
10
11 dbms_lob.loadfromfile(l_clob,l_bfile,dbms_lob.getlength(l_bfile));
12 dbms_lob.fileclose(l_bfile);
13 end ;
14 /
过程已创建。
SQL> execute load_lob
PL/SQL 过程已成功完成。
SQL> SELECT * FROM TESTLOB;
ID THELOB
---------- ------------------------------
1 慤?慴愍?湦楬攠摡瑡?獶?楮瑯?慢汥?敳琍?数污捥?晩敬摳
SQL> COMMIT;
提交完成。
SQL> select id ,dbms_lob.getlength(thelob) thelob from testlob;
ID THELOB
---------- ----------
1 59
SQL>