Oracle lob載入bfile資料到blob欄位中
DBMS_LOB.LOADBLOBFROMFILE(從BFILE載入內容到BLOB)
[oracle@blliu ~]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.5.0 - Production on Sun May 23 16:01:58 2010
Copyright (c) 1982, 2010, Oracle. All Rights Reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> host;
[oracle@blliu ~]$ pwd
/home/oracle
[oracle@blliu ~]$ ls bg.jpg
bg.jpg
[oracle@blliu ~]$ exit
exit
SQL> create directory test_dir as '/home/oracle';
Directory created.
SQL> create table test (id number,img bfile);
Table created.
SQL> insert into test values (111,bfilename('TEST_DIR','bg.jpg'));
1 row created.
SQL> commit;
Commit complete.
SQL> create table test2 (id number ,img blob);
Table created.
SQL> insert into test2 values (111,empty_blob());
1 row created.
SQL> commit;
Commit complete.
SQL> declare
2 dl test2.img%type;
3 sb test.img%type;
4 do number:= 1;
5 so number:= 1;
6 begin
7 select img into dl from test2 where id=111 for update;
8 select img into sb from test where id=111;
9 dbms_lob.fileopen(
10 file_loc=>sb,
11 open_mode=>dbms_lob.FILE_READONLY);
12 dbms_lob.loadblobfromfile(
13 dest_lob=>dl,
14 src_bfile=>sb,
15 amount=>dbms_lob.lobmaxsize,
16 dest_offset=>do,
17 src_offset=>so
18 );
19 dbms_lob.close(file_loc=>sb);
20 end;
21 /
PL/SQL procedure successfully completed.
SQL> select dbms_lob.getlength(img) from test;
DBMS_LOB.GETLENGTH(IMG)
-----------------------
6618
SQL> select dbms_lob.getlength(img) from test2;
DBMS_LOB.GETLENGTH(IMG)
-----------------------
6618
SQL>
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/23135684/viewspace-663457/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- oracle中lob欄位Oracle
- 關於oracle中blob欄位的錄入問題Oracle
- Oracle中Blob欄位的寫入處理(一) (轉)Oracle
- ORACLE LOB大欄位維護Oracle
- 遷移帶LOB等大欄位資料到非預設表空間
- 【LOB】使用資料泵時 LOB 欄位存放位置
- Oracle 建表時LOB欄位語法Oracle
- LOB欄位資料清理 - 更新為null後move lobNull
- Oracle 帶LOB欄位的表的遷移Oracle
- 使用sqlldr載入外部檔案中的資料到Oracle中(轉)SQLOracle
- Oracle資料庫連結(DBLink)中如何訪問包含BLOB欄位的資料Oracle資料庫
- LOB欄位在Oracle中的存放方式。Oracle
- 釋放大資料量的lob欄位空間大資料
- LOB欄位EMPTY_LOB和NULL的區別Null
- BLOB及CLOB欄位處理
- Oracle資料庫高水位釋放——LOB欄位空間釋放Oracle資料庫
- PHP 操作 mysql blob 資料型別的欄位PHPMySql資料型別
- MySQL中TEXT與BLOB欄位型別的區別MySql型別
- 在ASP中讀取ORACLE中的BLOB型別的欄位的值,不用Oracle Object for Object (轉)Oracle型別Object
- lob欄位表空間遷移
- Oracle10g Logminer處理BLOB欄位錯誤Oracle
- 物件序列化後,寫入Oracle Blob欄位:“無法從套接字讀取更多的資料”物件Oracle
- mybatis查詢mysql 資料庫中 BLOB欄位,結果出現亂碼MyBatisMySql資料庫
- Oracke大欄位Blob匯出到檔案
- 帶有LOB欄位的表遷移
- 從資料庫中blob欄位中,下載word檔案,word檔案全是亂碼,怎麼會事啊資料庫
- Oracle中的Rownum 欄位Oracle
- Oracle中的大欄位Oracle
- 達夢dmfldr載入大欄位
- 利用PLSQL包載入CLOB欄位SQL
- 小議lob欄位結構和儲存
- 轉載:Oracle常用的資料庫欄位型別Oracle資料庫型別
- 在VC中用OLE DB讀寫SQL Server中的BLOB欄位 (轉)SQLServer
- 使用sqlldr匯入文字資料到oracleSQLOracle
- oracle union查詢中BLOB欄位出錯問題,ora-00932:資料型別不一致:應為 -,但卻獲得BLOBOracle資料型別
- lob欄位的ora-1555處理方案
- varchar or blob:欄位型別的儲存和溢位條件型別
- 關於9i匯入資料到10g時候欄位大小的問題