Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8808757
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T02:42:04+00:00 2026-06-14T02:42:04+00:00

Currently I have the following query: SELECT CASE WHEN (‘[Param.3]’ = ‘SELECTED’) THEN (SELECT

  • 0

Currently I have the following query:

SELECT 
    CASE 
       WHEN ('[Param.3]' = 'SELECTED')
          THEN (SELECT RTRIM(XMLELEMENT("Rowset", XMLAGG(RW.R ORDER BY RW."ID")), ' ' ) AS Orders
                FROM TMTABLE UL, XMLTABLE('Rowsets/Rowset/Row' PASSING UL.TEXT COLUMNS "ID" NUMBER(19) PATH 'ID', R xmltype path '.') AS RW
                WHERE ID BETWEEN '[Param.1]' and '[Param.2]')
       WHEN ('[Param.3]' = 'ALL' )
          THEN (SELECT RTRIM(XMLELEMENT("Rowset", XMLAGG(RW.R ORDER BY RW."ID")) , ' ' ) AS Orders
                FROM TMTABLE UL, XMLTABLE('Rowsets/Rowset/Row' PASSING UL.TEXT COLUMNS "ID" NUMBER(19) PATH 'ID', R xmltype path '.') AS RW)
    END AS Orders
FROM 
    dual

This query is working fine if there are small number of XML rows to be merged into single row with XML AGG. But if the number of XML Rows to be merged are higher, this query is throwing the following error:

ORA-19011: Character string buffer too small

What change do I need to apply to make this work?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T02:42:06+00:00Added an answer on June 14, 2026 at 2:42 am

    You need to add .getClobVal() to your XMLType result, before the RTRIM.

    XMLAGG works fine with large amounts of data. And TRIM works fine with CLOBs. But when you put them together, Oracle tries to convert the XMLType into a VARCHAR2 instead of a CLOB.

    Example:

    create or replace function test_function return clob is
        v_clob clob;
    begin
        v_clob := v_clob || lpad('a', 4000, 'a');
        v_clob := v_clob || lpad('b', 4000, 'b');
        return v_clob;
    end;
    /
    
    --Works fine, returns an XMLType
    select xmlagg(xmlelement("asdf", test_function)) from dual;
    
    --Works fine, returns a CLOB
    select trim(test_function) from dual;
    
    --ORA-19011: Character string buffer too small
    select trim(xmlagg(xmlelement("asdf", test_function))) from dual;
    
    --Works
    select trim(xmlagg(xmlelement("asdf", test_function)).getClobVal()) from dual;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Dear all, I have a select query that currently produces the following results: DoctorName
I currently have the following query: SELECT group_concat(DISTINCT usrFirst, usrLast) as receiver_name //etc When
Currently I have the following code: switch (publicationType) { case PublicationType.Book: return Session.Query<Publication>() .Where(p
I currently have the following query: select min(nw_lpdTEMP) AS Min_Lkpmp_Temp_C, max(nw_lpdPH) AS Max_Lkpmp_PH, (select
I currently have the following SQL Query: SELECT con_Content, cot_Name, pag_Name FROM [Page] inner
I currently have the following SQL query that lists all the names of all
Currently I have following XML: <Rowsets> <Rowset> <Row> <DrilldownDepth>0</DrilldownDepth> <ScheduleWeek>---</ScheduleWeek> <ABC>---</ABC> <PQR>1500</PQR> <XYZ>15000</XYZ> <Quant>285</Quant>
I currently have the following Get-ChildItem -recurse -include file.ext | Select-String -pattern c: |
I currently have the following in select expert to select a bunch of fields:
I have the following query: SELECT IF(dissolution_date IS NULL, YEAR(CURDATE()) - YEAR(incorporation_date), YEAR(dissolution_date) -

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.