惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

人人都是产品经理
人人都是产品经理
Stack Overflow Blog
Stack Overflow Blog
S
SegmentFault 最新的问题
博客园 - 司徒正美
aimingoo的专栏
aimingoo的专栏
U
Unit 42
GbyAI
GbyAI
B
Blog RSS Feed
博客园 - Franky
L
LangChain Blog
Hugging Face - Blog
Hugging Face - Blog
美团技术团队
The GitHub Blog
The GitHub Blog
Y
Y Combinator Blog
云风的 BLOG
云风的 BLOG
H
Hackread – Cybersecurity News, Data Breaches, AI and More
博客园 - 三生石上(FineUI控件)
Microsoft Azure Blog
Microsoft Azure Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
G
Google Developers Blog
Last Week in AI
Last Week in AI
阮一峰的网络日志
阮一峰的网络日志
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Apple Machine Learning Research
Apple Machine Learning Research

博客园 - killkill

jar 冲突、class 冲突的检测脚本 Oracle User Calls 和 Executions 两个概念的区别 使用 dbms_xplan.display 按照 plan_hash_value 查执行计划的方法 oratop 各个指标项说明 [转] sql_id VS hash_value lsattr/chattr [转]节约内存:Instagram的Redis实践 [原]佛山-杭州自驾路书 [原] insert into … on duplicate key update / replace into 多行数据 [摘] python url decoder 一条霸气的分析binlog的命令 一句命令完成MySQL的数据迁移(轻量级) [转]Linux下SSH Session复制 使用taskset命令来限制进程的CPU MySQL重复记录删除 使用Screen抵御杯具 [摘]Oracle 11g Flashback_transaction_query的undo_sql为空? Duplicate Active Database 遇到 ORA-01017 invalid username/password [摘]如何抓住蝴蝶效应中的那只蝴蝶
[原]将Oracle 中的blob导出到文件中
killkill · 2011-04-30 · via 博客园 - killkill

      直接上代码:

declare
  l_directory varchar(200) := '__dir__';
	l_file UTL_FILE.FILE_TYPE;  
	l_buffer RAW(32767);  
	l_amount BINARY_INTEGER:=32767;  
	l_pos NUMBER:=1;  
	l_Blob Blob;  
	l_Blob_len Number;  
	l_lob_id number;
	CURSOR cur is 
	  select __id__ from __table_name__;
BEGIN  
  open cur;
	loop
	  fetch cur into l_lob_id;
	  EXIT when cur%NOTFOUND; 
	  select __blob_fild__ into l_Blob from __table_name__ where __id__=l_lob_id ; 
	  l_file:=UTL_FILE.FOPEN(l_directory,'adapter_blob.'||to_char(l_lob_id)||'.bin','wb',32767); 
	  l_Blob_len:=dbms_lob.getlength(l_Blob);  
	  l_pos := 1;
	  WHILE l_pos<l_Blob_len LOOP  
	    DBMS_LOB.READ(l_Blob,l_amount,l_pos,l_buffer);
	    UTL_FILE.PUT_RAW(l_file,l_buffer,TRUE);  
	    l_pos:=l_pos+l_amount;  
	  end loop;  
	  utl_file.fclose(l_file);  
	end loop;	
	exception  
		when others then  
		if utl_file.is_open(l_file) then  
		utl_file.fclose(l_file);  
		end if;  
END;