SQL 错误 - ORA-22835:缓冲区太小,无法将 CLOB 转换为 CHAR 或 BLOB 转换为 RAW

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/25518780/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-01 02:32:02  来源:igfitidea点击:

Error- ORA-22835: Buffer too small for CLOB to CHAR or BLOB to RAW conversion

sqloraclestored-proceduresblobclob

提问by kumarb

I am attempting to read a blob message and display it as a variable in one of my procedures, but am getting the error below:

我正在尝试读取 blob 消息并将其显示为我的程序之一中的变量,但出现以下错误:

Error - ORA-22835: Buffer too small for CLOB to CHAR or BLOB to RAW conversion (actual: 9923, maximum: 2000)

错误 - ORA-22835:对于 CLOB 到 CHAR 或 BLOB 到 RAW 的转换,缓冲区太小(实际:9923,最大值:2000)

I have googled and found a suggestion to trim the blob message as below, but would rather display the complete blob message as a string.

我用谷歌搜索并找到了一个建议来修剪 blob 消息,如下所示,但宁愿将完整的 blob 消息显示为字符串。

UTL_RAW.CAST_TO_VARCHAR2(dbms_lob.substr(variable_name,2000,1)) 

How can I display the complete message? Is there a setting on either the database or procedure level that I can change?

如何显示完整的消息?是否有我可以更改的数据库或过程级别的设置?

采纳答案by kumarb

I got this worked by using the option described in

我通过使用中描述的选项完成了这项工作

http://www.dba-oracle.com/t_convert_blob_varchar_datatype.htm

http://www.dba-oracle.com/t_convert_blob_varchar_datatype.htm

回答by Артур Курицын

Try to use DBMS_LOB.GETLENGTH(), instead of trimming the string

尝试使用 DBMS_LOB.GETLENGTH(),而不是修剪字符串