全部博文(136)
分类: Oracle
2008-06-04 17:11:58
DECLARE
photo BLOB; BEGIN SELECT falls_photo INTO photo FROM waterfalls WHERE falls_name='Dryer Hose'; ... |
Oracle's LOB DocumentationIf you are working with LOBs, we strongly recommend that you familiarize yourself with the following portions of Oracle's documentation set:
This is not an exhaustive list of LOB documentation, but you'll find all the essential information in these sources. |
SQL> set serveroutput on
SQL> DECLARE 2 directions CLOB; 3 BEGIN 4 IF directions IS NULL THEN 5 DBMS_OUTPUT.PUT_LINE('directions is NULL'); 6 ELSE 7 DBMS_OUTPUT.PUT_LINE('directions is not NULL'); 8 END IF; 9 END; 10 / directions is NULL PL/SQL 过程已成功完成。 |
SQL> DECLARE
2 directions CLOB; 3 BEGIN 4 --Insert a new row using EMPTY_CLOB( ) to create a LOB locator 5 INSERT INTO waterfalls 6 (falls_name,falls_directions) 7 VALUES ('Munising Falls',EMPTY_CLOB( )); 8 9 --Retrieve the LOB locater created by the previous INSERT statement 10 SELECT falls_directions 11 INTO directions 12 FROM waterfalls 13 WHERE falls_name='Munising Falls'; 14 15 IF directions IS NULL THEN 16 DBMS_OUTPUT.PUT_LINE('directions is NULL'); 17 ELSE 18 DBMS_OUTPUT.PUT_LINE('directions is not NULL'); 19 END IF; 20 21 DBMS_OUTPUT.PUT_LINE('Length = ' || DBMS_LOB.GETLENGTH(directions)); 22 END; 23 / directions is not NULL Length = 0 PL/SQL 过程已成功完成。 |
IF some_number IS NULL THEN --You know there is no data |
IF some_clob IS NULL THEN --There is no data ELSEIF DBMS_LOB.GETLENGTH(some_clob) = 0 THEN --There is no data ELSE --Only now is there data END IF; |
chinaunix网友2009-09-23 09:11:24
接着怎么 (2)调用系统过程 DBMS_LOB.OPEN 打开这个 BLOB 指针; (3)调用系统过程 DBMS_LOB.GETCHUNKSIZE,得到 读/写 该 BLOB 数据的最佳块尺寸; (4)调用系统过程 DBMS_LOB.GETLENGTH,得到该 BLOB 数据的字节或字符长度; (5)多次调用系统过程 DBMS_LOB.READ,分批得到该 BLOB 数据; (6)关闭该 BLOB。 怎么做呢? http://bbs3.chinaunix.net/viewthread.php?tid=1153789&page=2&extra=#pid11243344