How Do You Insert XML Document To Oracle Database Using INSPROC

I am having problem inserting an XML document into an Oracle database. this is what i have:

my $sql = "<?xml version="1.0"?>
<ROWSET><ROW num="1"><USER_ID>999</USER_ID><FIRST_NAME>test</FIRST_NAME><LAST_NAME>test</LAST_NAME></ROW></ROWSET>

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

     $cursor->execute();
   $dbh->commit;
};
$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.
buruAsked:
Who is Participating?
 
ozoCommented:
my $sql = "<?xml version="1.0"?>
<ROWSET><ROW num="1"><USER_ID>999</USER_ID><FIRST_NAME>test</FIRST_NAME><LAST_NAME>test</LAST_NAME></ROW></ROWSET>

#is not a valid Perl statement due to unbalanced quotes
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.