How Do You Insert XML Document To Oracle Database Using INSPROC

Posted on 2005-04-28
Last Modified: 2012-05-05
I am having problem inserting an XML document into an Oracle database. this is what i have:

my $sql = "<?xml version="1.0"?>

eval {
     my $cursor = $dbh->prepare(q{
            INSPROC('member', '$sql' );

$dbh is a handle that has already been defined and working properly.

The problem i have is whenever I run this Perl script I always get a Java error saying that :
Java exception: oracle.xml.sql.OracleXMLSQLException: Start of root element expected.

If I hardcode the XML document string  in the INSPROC call, it works fine. It inserts the data into the table member. It is always when I pass in $sql. It seems to me that it cannot find an XML document when i pass in $sql.
Question by:buru
    1 Comment
    LVL 84

    Accepted Solution

    my $sql = "<?xml version="1.0"?>

    #is not a valid Perl statement due to unbalanced quotes

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Better Security Awareness With Threat Intelligence

    See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

    I've just discovered very important differences between Windows an Unix formats in Perl,at least 5.xx.. MOST IMPORTANT: Use Unix file format while saving Your script. otherwise it will have ^M s or smth likely weird in the EOL, Then DO NOT use m…
    Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
    Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
    This video is in connection to the article "The case of a missing mobile phone (". It will help one to understand clearly the steps to track a lost android phone.

    760 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

    8 Experts available now in Live!

    Get 1:1 Help Now