ORACLE - ORA-01489: result of string concatenation is too long

Posted on 2006-06-27
Last Modified: 2012-08-14
I don't know Jack about Oracle so dumb it down for me :-)

Someone gave me a script to run to get some data dumped to text for an app that I'm working on.
The script works partially, but some rows return the above error.
Here's what I have:

% more
set -x
export PATH
sqlplus -silent << EOF
 set line 1000;
 set pagesize 0;
 set sqlprompt '';
 set echo off;
 set feedback off;
 set trimspool on;
spool cdukes;
|| '</ACTION><LINKS>' ||  ed.ERROR_LINKS_TEXT || '</LINKS>' FROM ACS.emd_error ee, ACS.emd_error_detail ed where ee.ERROR_ID = ed.ER
ROR_ID and ed.LOCALE_CD = 'en_US';

Here are the last 3 fields that get exported:

<ERRTEXT>%CWAN_RP-6-IMAGE_UPGRADE: Bootflash image upgrade [chars] for slot [int]/[int][chars]</ERRTEXT><EXPL>The bootflash image on the CWAN line card has been automatically upgraded.</EXPL><ACTION>No action is required.</ACTION><LINKS></LINKS>
<ERRTEXT>%DEBUGGER-0-CCHAIN: [chars]</ERRTEXT><EXPL>This message shows a line from the call chain and is part of a fatal error dump. The CIP
has encountered an unrecoverable problem and is printing out contextual information about where
the problem occurred. A fatal error dump consists of the following parts:
Headlines with software and hardware versions
The load map of all the dynamically loaded code segments
All the interrupt stacks currently in use
The trace table
The first 1
KB of CIP low core memory
The first 1
KB of the stack of the currently active task</EXPL><ACTION>To capture all these error messages, ensure that you have set the logging buffered
command to 64000, or log to a system log server. Frequently such a fatal error dump is immediately
preceded by some additional CIP error messages. Ensure that you capture those messages as well.
Contact your Cisco technical support representative and provide the representative with the gathered

<ERRTEXT>%AT-3-DOMLOOP: Loop detected on domain [dec] [[chars]]</ERRTEXT><EXPL>The domain router has detected a routing loop. Routing loops are not allowed. The
domain router runs a background loop detection process. The domain router starts this process when
it receives a new zone list from a domain that is identical to the list in the main routing table and
whose network range length matches that in this list. The loop detection process sends several
AppleTalk NBP loopback packets. When one of these packets is received on an interface that does
not belong to the original domain, the domain router first shuts off all the domains involved in the
loop and then shuts off all the interfaces in these domains. The loop detection does not catch all
types of loops. The user must ensure that no loop exists.</EXPL><ACTION>Disable the cause of the routing loop. Then use the clear appletalk command
to restart the interfaces involved.</ACTION><LINKS></LINKS>

<ERRTEXT>%FR_VCB-3-PROCESS_SWITCHING: Switching error - vcb [chars] - [chars]</ERRTEXT><EXPL>An error occurred while packets were being switched across the VC bundle.</EXPL><ACTION>Delete the VC bundle and employ a PVC to substitute for the VC bundle.</ACTION><LINKS></LINKS>
<ERRTEXT>%FRATM-3-CONFIG_ERROR: [chars]</ERRTEXT><EXPL>An internal software error has occurred.</EXPL><ACTION>Copy the error message exactly as it appears on the console or in the system
log. Issue the show tech-support command to gather data that might help identify the nature of the
error. If you cannot determine the nature of the error from the error message text or from the show
tech-support command output, contact your Cisco technical support representative and provide the
representative with the gathered information.</ACTION><LINKS></LINKS>

ORA-01489: result of string concatenation is too long

Question by:cdukes
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2

Accepted Solution

neo9414 earned 500 total points
ID: 16992140
This link from asktom should help you out...,F4950_P8_CRITERIA:1197835631433

basically, your concatenation result is going above 4000 bytes. SQL can handle only 4000 bytes.

one easy way will be to modify the sql using substr to return only 4000 characters. for this you have the luxury of 3936 characters. cause 64 characters are being used by the XML tags and you don;t want to chop them off. so jus tfigure out some good numbers for each of the column to take the substring(substr) depending on the size of the columns.


SELECT '<ERRTEXT>' || substr(ee.error_text1,936) || '</ERRTEXT><EXPL>' || substr(ed.ERROR_EXPLANATION_TEXT,1,1000)|| '</EXPL><ACTION>' || substr(ed.ERROR_ACTION_TEXT,1,1000)
|| '</ACTION><LINKS>' ||  substr(ed.ERROR_LINKS_TEXT,1,1000) || '</LINKS>' FROM ACS.emd_error ee, ACS.emd_error_detail ed where ee.ERROR_ID = ed.ER
ROR_ID and ed.LOCALE_CD = 'en_US';

you can distribute the numbers according to your requirements. There will be truncation of some data but at least you will get the full result.



Author Comment

ID: 16992165
Not sure I understand, what data would be truncated? Is there no way to get everything dumped to a text file?
One would think this would be a simple task?

Author Comment

ID: 16992213
That appears to have done the trick, all 27k records look like they exported ok.
Thanks for teh help!

Expert Comment

ID: 16993219
if you use a pl/sql procedure to do your task then it can be done without truncation. In pl/sql, varchar can extend to 32K which should be enough. however, with procedure the data file will be generated on the server.

You can tell that "someone" who gave you the script about the problem you faced. he should be able to help you out.

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
SQL Developer 6 75
Oracle collections 15 39
Oracle Distributed Transaction Lock Error ORA-01591 8 69
Procedure syntax 5 50
Why doesn't the Oracle optimizer use my index? Querying too much data Most Oracle developers know that an index is useful when you can use it to restrict your result set to a small number of the total rows in a table. So, the obvious side…
Note: this article covers simple compression. Oracle introduced in version 11g release 2 a new feature called Advanced Compression which is not covered here. General principle of Oracle compression Oracle compression is a way of reducing the d…
Via a live example show how to connect to RMAN, make basic configuration settings changes and then take a backup of a demo database
This video shows setup options and the basic steps and syntax for duplicating (cloning) a database from one instance to another. Examples are given for duplicating to the same machine and to different machines

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question