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

推荐订阅源

Microsoft Azure Blog
Microsoft Azure Blog
WordPress大学
WordPress大学
Google DeepMind News
Google DeepMind News
美团技术团队
大猫的无限游戏
大猫的无限游戏
H
Help Net Security
小众软件
小众软件
aimingoo的专栏
aimingoo的专栏
博客园 - 聂微东
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
M
MIT News - Artificial intelligence
酷 壳 – CoolShell
酷 壳 – CoolShell
博客园 - Franky
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Microsoft Security Blog
Microsoft Security Blog
F
Fortinet All Blogs
A
About on SuperTechFans
Recent Announcements
Recent Announcements
D
Docker
Vercel News
Vercel News
Engineering at Meta
Engineering at Meta
腾讯CDC
Martin Fowler
Martin Fowler
阮一峰的网络日志
阮一峰的网络日志

博客园 - 一 缕 阳 光

macOS 安装cocoapods记录 Flowable笔记 VUE项目中同时使用API代理与MockJs Ruoyi-Cloud-服务间的调用 Ruoyi-Cloud-增加单元测试和Mybatis-plus 使用Typro+dotnet-cnblog在博客园写博客 T4模板插件 使用Open Live Writer在博客园中写博文 Windows与CentOS8虚拟机网络共享与互通 因数据库连接串导致的netcore发布到IIS后报500错误 【转】使用ASP.NET Web API构建Restful API 表单设计器的探索 解决C#中dynamic类型作为泛型参数的反射问题 【原创】AltiumDesigner 6 的自定义菜单 估计项目的重要几点 从Project 2007导出WBS图表到Visio 2007 CMS: DNN And Umbraco 【原创】长尾关键词的挖掘与使用方法 【原创】Tesseract-OCR 3.02 训练笔记
ORA-01489: result of string concatenation is too long
一 缕 阳 光 · 2013-09-03 · via 博客园 - 一 缕 阳 光
ORA-01489: result of string concatenation is too long
Cause: String concatenation result is more than the maximum size.
Action: Make sure that the result is less than the maximum size.

Reference: 
http://nimishgarg.blogspot.com/2012/06/ora-01489-result-of-string.html
http://docs.oracle.com/cd/B19306_01/server.102/b14219/e900.htm


Example:
SQL> SELECT LPAD('x',4000,'x') || LPAD('x',4000,'x')  || LPAD('x',4000,'x') FROM DUAL;
SELECT LPAD('x',4000,'x') || LPAD('x',4000,'x')  || LPAD('x',4000,'x') FROM DUAL
                                                                                                   *
ERROR at line 1:
ORA-01489: result of string concatenation is too long


Problem Description:
The problem with this query is with the use of CONCAT operator (||).

e.g.: select char1 || char2 from dual
Concat operator returns char1 concatenated with char2. The string returned is in the 
same character set as char1. So here concat operator is trying to return varchar2, 
which has limit of 4000 characters and getting exceeded.

This problem may also come when we try to CONCAT a VARCHAR2 with CLOB.
e.g.: select char1 || clob from dual

So here we can simply convert its first string to CLOB and avoid this error.
After converting first string to CLOB, CONCAT operator will return string of CLOB type


Solution:
SELECT TO_CLOB(LPAD('x',4000,'x')) || LPAD('x',4000,'x')  || LPAD('x',4000,'x') 
FROM DUAL