ORA-01706 with XMLTABLE and basing a VARCHAR2(4000) column on an XPath substring function

(Doc ID 2375419.1)

Last updated on APRIL 05, 2018

Applies to:

Oracle Database - Enterprise Edition - Version 11.2.0.4 and later
Information in this document applies to any platform.

Symptoms

A SQL query references an XML object in a CLOB column of a table and one of the columns in the XMLTABLE definition is MESSAGE_TEXT varchar2(4000) PATH 'substring(msgText,1,4000)'.  If the msgText value is in excess of 4000 characters, the SQL statement fails with ORA-01706.

SELECT m.message_text
FROM test_clob x, XMLTABLE('/chatTranscript/message'
PASSING xmltype(x.col_clob)
COLUMNS
MESSAGE_TEXT varchar2(4000) PATH 'substring(msgText,1,4000)')
mSQL> SQL> 2 3 4 5
6 /
ERROR:
ORA-01706: user function result value was too large

 

This statement should not fail as the substring is taking the first 4000 characters.


Cause

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms