Solved

Oracle XML Help

Posted on 2013-11-13
8
425 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
  • 4
  • 4
8 Comments
 
LVL 76

Expert Comment

by:slightwv (䄆 Netminder)
Comment Utility
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
Comment Utility
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
Comment Utility
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
 
LVL 76

Expert Comment

by:slightwv (䄆 Netminder)
Comment Utility
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
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.

 

Author Comment

by:nssudha
Comment Utility
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 76

Expert Comment

by:slightwv (䄆 Netminder)
Comment Utility
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 76

Accepted Solution

by:
slightwv (䄆 Netminder) earned 500 total points
Comment Utility
>>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
Comment Utility
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

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

Background In several of the companies I have worked for, I noticed that corporate reporting is off loaded from the production database and done mainly on a clone database which needs to be kept up to date daily by various means, be it a logical…
From implementing a password expiration date, to datatype conversions and file export options, these are some useful settings I've found in Jasper Server.
This video explains at a high level about the four available data types in Oracle and how dates can be manipulated by the user to get data into and out of the database.
This video shows how to Export data from an Oracle database using the Datapump Export Utility.  The corresponding Datapump Import utility is also discussed and demonstrated.

743 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

12 Experts available now in Live!

Get 1:1 Help Now