Solved

Oracle XML Help

Posted on 2013-11-13
8
437 Views
Last Modified: 2013-11-13
Hi,

I am generating an XML file through SQL query. I have a descriptive column output with open and closed brackets inside the output. For example: Congestive Heart Failure (CHF). When I generate XML, I am getting an error LPX-00210: expected '=' insetad of '>' Error at line 1. Could you please help me resolve this issue?

Thanks in advance!
Sudhakar.
0
Comment
Question by:nssudha
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
8 Comments
 
LVL 77

Expert Comment

by:slightwv (䄆 Netminder)
ID: 39644993
You are likely using string concatenation to generate the XML?

I suggest you use the native SQL calls like XMLELEMENT, XMLFOREST, etc... to do it.  This will properly encode the data.

If you can provide some sample data and expected results, we can create a test case for you.
0
 

Author Comment

by:nssudha
ID: 39645049
I am using native SQL calls only. XMLSERIALIZE, XMLELEMENT, XMLFOREST, XMLAGG etc. In fact, I was helped by one of the experts here to spool the XML result to a file in a custom XML output.

Thanks,
Sudhakar.
0
 

Author Comment

by:nssudha
ID: 39645073
Hi slightwv,

You only helped my answer my question to generate xml. Here is the answer you provided me. I am using the same one to generate another XML. In that the descriptive field with what I explained in my question was giving issues to me.

Thanks,
Sudhakar.

drop table tab1 purge;
create table tab1(col1 clob);

insert into tab1 (
select xmlserialize(document
      xmlelement("FootNoteDetails",
            xmlelement("HeaderInformation",
                  xmlforest(
                        'ORDR-Footnote' as "DataSource",
                        sysdate as "DateCreated",
                        sysdate as "DateLastUpdated",
                        mycount as "OrdersCount"
                  )
            ),
            xmlagg(
                  xmlelement("FootNote",
                        xmlforest(
                              trim(orderid) as "OrderID",
                              orderdesc as "OrderDesc"
                        )
                  )
            order by orderid)
      )
version '1.0' indent)
from (
select orderid, orderdesc, count(*) over() mycount from myorders
)
group by mycount
)
/
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 77

Expert Comment

by:slightwv (䄆 Netminder)
ID: 39645078
Are you sure it is a data problem?

Can you post sample data and the query that generates the error so we can try to reproduce it?

We need something to go on other than just the error message.
0
 

Author Comment

by:nssudha
ID: 39645106
When I initially got the error for the entire file, I removed all the columns except for one and kept on trying to generate the file. When I added the descriptive column to the output, I got the error. When I removed it and kept all others, I got the output without any errors. That's how I came to the conclusion. Can you use the same example I provided to you in my above reply? You may just have to add a comments field and insert a value with open and closed parenthesis as I explained in my question above.

Thanks,
Sudhakar.
0
 
LVL 77

Expert Comment

by:slightwv (䄆 Netminder)
ID: 39645120
Looks like we cross posted.

I was able to run what you posted using 11.2.0.2 and 12.1.0.1.

Does it fail for you?

If so, what is your Oracle version (all 4 numbers please).
0
 
LVL 77

Accepted Solution

by:
slightwv (䄆 Netminder) earned 500 total points
ID: 39645130
>>You may just have to add a comments field and insert a value with open and closed parenthesis as I explained in my question above.

Please add to the test case with data that generates the error.  I cannot make it up for you.  You know what is generating the error.

You may need to experiment with your actual data to narrow down the exact row/column causing it.

Or, you are introducing a syntax error when editing the script.

Either way, I need something that I can run to reproduce the error.
0
 

Author Comment

by:nssudha
ID: 39645274
Please ignore my question. It was my mistake while typing the identifier for the descriptive field.

I typed Comment as "as Comnt". "as" inside the identifier caused the issue.
0

Featured Post

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Cursors in Oracle: A cursor is used to process individual rows returned by database system for a query. In oracle every SQL statement executed by the oracle server has a private area. This area contains information about the SQL statement and the…
Configuring and using Oracle Database Gateway for ODBC Introduction First, a brief summary of what a Database Gateway is.  A Gateway is a set of driver agents and configurations that allow an Oracle database to communicate with other platforms…
Via a live example, show how to take different types of Oracle backups using RMAN.
This video shows how to copy an entire tablespace from one database to another database using Transportable Tablespace functionality.

732 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