I got ” ORA-01489: result of string concatenation is too long ” error in Oracle database.
ORA-01489: result of string concatenation is too long
Details of error are as follows.
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.
SQL> SELECT LPAD('A',4000,'A') || LPAD('A',4000,'A') || LPAD('A',4000,'A') FROM DUAL; SELECT LPAD('A',4000,'A') || LPAD('A',4000,'A') || LPAD('A',4000,'A') FROM DUAL * ERROR at line 1: ORA-01489: result of string concatenation is too long
result of string concatenation is too long
This ORA-01489 errors are related with the result of string concatenation is too long.
You should Make sure that the result is less than the maximum size.
To solve this error, you should use the TO_CLOB function as follows.
SELECT TO_CLOB(LPAD(‘A’,4000,’A’)) || LPAD(‘A’,4000,’A’) || LPAD(‘A’,4000,’A’) FROM DUAL;
If you got this error when you used the LISTAGG, then you can try to use XMLAGG function.
Do you want to learn Oracle Database for Beginners, then read the following articles.
Oracle Tutorial | Oracle Database Tutorials for Beginners ( Junior Oracle DBA )