Loading

ORA-01489: result of string concatenation is too long

  https://www.cnblogs.com/ShineTan/p/3298645.html

SELECT LPAD('x',4000,'x') || LPAD('x',4000,'x')   FROM DUAL;

修改为:

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

 spool的条件中增加:

set long 20000000
set longchunksize 255

 

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

 

posted @ 2024-10-26 14:44  stono  阅读(41)  评论(0编辑  收藏  举报