问题描述
嗨,汤姆。
archivos的统一编码。Aplicaci ó n接口,pero cuando se trata un set de datos muy grande la escritura del archivo falla,dando un error ORA-29285
我的pregunta como puedo controlar esa falla y manejar el tama ñ o de la linea que trato de escribir sin afectar el rendimiento del pkg。
archivos的统一编码。Aplicaci ó n接口,pero cuando se trata un set de datos muy grande la escritura del archivo falla,dando un error ORA-29285
我的pregunta como puedo controlar esa falla y manejar el tama ñ o de la linea que trato de escribir sin afectar el rendimiento del pkg。
procedure clobTofile (p_clob clob, p_directory varchar2 := 'DIR_CSV', p_filename varchar2 := 'file'||userenv('SESSIONID')||to_char(systimestamp,'ddmmyyyyhh24miss')||'.csv') IS t_clob clob := p_clob; t_fh utl_file.file_type; amount pls_integer := 32767; offset integer := 1; l_leng pls_integer := 32700; l_fileleng number := dbms_lob.getlength(p_clob); lc_buffer varchar2(32767); lberr_29285 exception; pragma EXCEPTION_INIT (lberr_29285, -29285); begin t_fh := utl_file.fopen( p_directory, p_filename, 'w'); begin if ( dbms_lob.isopen(t_clob) != 1 ) then dbms_lob.open(t_clob, 0); end if; -- /* intente controlar el maximo del campo char logre romper en segmentos tomando el string 32700 como maximo, sin embargo cuando recibo una linea o segmento que llega a medir 3213b pero no la longitud maxima controlada falla la escritura. */ case when l_fileleng >= l_leng then -- loop amount := instr(dbms_lob.substr( t_clob, l_leng, offset), l_endofline, -1); exit when nvl(amount,0) = 0; lc_buffer := dbms_lob.substr( t_clob, amount, offset); utl_file.put_line( t_fh, lc_buffer); offset := offset + amount; end loop; else utl_file.put_line( t_fh, dbms_lob.substr( t_clob, l_fileleng, offset)); end case; if ( dbms_lob.isopen(t_clob) = 1 ) then dbms_lob.close(t_clob); end if; exception when lberr_29285 then dbms_output.put_line('Error :Error de escritura en el archivo archivo destino'); raise; when others then dbms_output.put_line('Error : '||sqlerrm); raise; end printout; utl_file.fclose( t_fh ); end;复制
专家解答
我希望我理解你的问题-我用谷歌翻译。
默认情况下,UTL_FILE只允许很小的线宽。
更改
utl_file.fopen (目录,文件名,'w');
到
utl_file.fopen( p_directory,p_filename,'w',32767);
到allow a line 到go up 到32k in size.
默认情况下,UTL_FILE只允许很小的线宽。
更改
utl_file.fopen (目录,文件名,'w');
到
utl_file.fopen( p_directory,p_filename,'w',32767);
到allow a line 到go up 到32k in size.
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。
评论
相关阅读
【纯干货】Oracle 19C RU 19.27 发布,如何快速升级和安装?
Lucifer三思而后行
647次阅读
2025-04-18 14:18:38
Oracle RAC 一键安装翻车?手把手教你如何排错!
Lucifer三思而后行
624次阅读
2025-04-15 17:24:06
Oracle数据库一键巡检并生成HTML结果,免费脚本速来下载!
陈举超
526次阅读
2025-04-20 10:07:02
XTTS跨版本迁移升级方案(11g to 19c RAC for Linux)
zwtian
521次阅读
2025-04-08 09:12:48
【ORACLE】记录一些ORACLE的merge into语句的BUG
DarkAthena
479次阅读
2025-04-22 00:20:37
【活动】分享你的压箱底干货文档,三篇解锁进阶奖励!
墨天轮编辑部
475次阅读
2025-04-17 17:02:24
Oracle 19c RAC更换IP实战,运维必看!
szrsu
455次阅读
2025-04-08 23:57:08
一页概览:Oracle GoldenGate
甲骨文云技术
454次阅读
2025-04-30 12:17:56
【ORACLE】你以为的真的是你以为的么?--ORA-38104: Columns referenced in the ON Clause cannot be updated
DarkAthena
449次阅读
2025-04-22 00:13:51
火焰图--分析复杂SQL执行计划的利器
听见风的声音
400次阅读
2025-04-17 09:30:30