Solved

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

Posted on 2006-06-27
4
4,978 Views
Last Modified: 2012-08-14
Hi,
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 gather_emd_data.sh
#!/bin/bash
set -x
PATH=/bin:/opt/local/bin:/usr/dt/bin:/usr/openwin/bin:/usr/bin:/opt/local/cse/bin:/bin:/apps/oracle/bin/
export PATH
ORACLE_HOME=/apps/oracle
export ORACLE_HOME
sqlplus -silent << EOF
acsview/viewonly@CN
 set line 1000;
 set pagesize 0;
 set sqlprompt '';
 set echo off;
 set feedback off;
 set trimspool on;
spool cdukes;
SELECT '<ERRTEXT>' || ee.error_text || '</ERRTEXT><EXPL>' || ed.ERROR_EXPLANATION_TEXT || '</EXPL><ACTION>' || ed.ERROR_ACTION_TEXT
|| '</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';
EOF


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
information.</ACTION><LINKS></LINKS>

<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>

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

0
Comment
Question by:cdukes
  • 2
  • 2
4 Comments
 
LVL 9

Accepted Solution

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

http://asktom.oracle.com/pls/ask/f?p=4950:8:12466981671588140497::NO::F4950_P8_DISPLAYID,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.

e.g.:

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.

Cheers,
Neo

0
 

Author Comment

by:cdukes
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?
0
 

Author Comment

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

Expert Comment

by:neo9414
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.
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

Suggested Solutions

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…
Truncate is a DDL Command where as Delete is a DML Command. Both will delete data from table, but what is the difference between these below statements truncate table <table_name> ?? delete from <table_name> ?? The first command cannot be …
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Via a live example, show how to take different types of Oracle backups using RMAN.

757 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now