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

  • Home
  • SEARCH
  • 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 9178813
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T17:38:29+00:00 2026-06-17T17:38:29+00:00

I am writing a client application that calls a stored procedure from an Oracle

  • 0

I am writing a client application that calls a stored procedure from an Oracle database via a select statement. The stored procedure returns a cursor. I need to define aliases for the columns returned by this cursor, and I need to do it within my select statement.

I cannot make any changes to the Oracle database. I cannot write any PLSQL. The only thing I can do with this database is query it.

Please advise.


Background: This stored procedure is one of many called inside an application framework. Currently, all calls return their results in XML format, using this syntax to do the conversion:

select XMLType.createXML(package_name.storedProcName('1', '2', '3')).getClobVal() as sresult  from dual;

However, this cursor contains two columns with the same name (specifically “NAME”). When this query is run in TOAD, the column automatically gets appended a “_1”, however the XMLType results in illogical XML, like this:

<?xml version="1.0"?>
<ROWSET>
    <ROW>
        <ID>1</ID>
        <NAME>BRUCE WAYNE</NAME>
        <NAME>BATMAN</NAME>
    </ROW>
</ROWSET>

This is why I must alias the columns before they are converted to XMLType. I want the query output to contain no duplicate column names so that the XML can be like this instead (with no duplicate tags):

<?xml version="1.0"?>
<ROWSET>
    <ROW>
        <ID>1</ID>
        <NAME>BRUCE WAYNE</NAME>
        <OTHER_NAME>BATMAN</OTHER_NAME>
    </ROW>
</ROWSET>
  • 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-17T17:38:31+00:00Added an answer on June 17, 2026 at 5:38 pm

    i would go for a stylesheet for this.

    eg:

    SQL> select XMLType.createXML(foo()).transform(xmltype('<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
      2  <xsl:template match="/ROWSET/ROW/NAME[2]">
      3     <NAME_1>
      4             <xsl:apply-templates select="@*|node()"/>
      5     </NAME_1>
      6  </xsl:template>
      7  <xsl:template match="@*|node()">
      8     <xsl:copy>
      9             <xsl:apply-templates select="@*|node()"/>
     10     </xsl:copy>
     11  </xsl:template>
     12  </xsl:stylesheet>')) as sresult  from dual
     13  /
    
    SRESULT
    --------------------------------------------------------------------------------
    <ROWSET>
      <ROW>
        <ID>1</ID>
        <NAME>BRUCE WAYNE</NAME>
        <NAME_1>BATMAN</NAME_1>
      </ROW>
      <ROW>
        <ID>2</ID>
        <NAME>CLARK KENT</NAME>
        <NAME_1>SUPERMAN</NAME_1>
      </ROW>
    </ROWSET>
    

    i.e. we replace the 2nd NAME occurrence (/ROWSET/ROW/NAME[2]) in the ROW element with NAME_1. everything else gets copied as-is.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Writing a client application that sends images to a server via a webservice. As
I am writing a web application that takes a script input from a client-side
I'm writing a client application to communicate with a server program via UDP. The
I am writing a TCP server application using Winsock. The client that connects to
I'm writing a small (C#) client application that sends data using a TCP/IP connection
I'm writing a client/server application that requires the server needs to be able to
I'm currently writing a client in ActionScript 3 that talks to a Red5 application/media
I have been writing a SOAP client application in C++ on Ubuntu using OpenSSL
I am writing a client-side .NET application which is expected to use a lot
I am writing a Java client/server GUI application using sockets and here is the

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.