Improve company productivity with a Business Account.Sign Up

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 5165
  • Last Modified:

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

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

  • 2
  • 2
1 Solution
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.


cdukesAuthor Commented:
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?
cdukesAuthor Commented:
That appears to have done the trick, all 27k records look like they exported ok.
Thanks for teh help!
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.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now