Home > Ask the Oracle Experts > (Archive) App Dev: PL/SQL and XML Questions & Answers > Rolling back Oracle XSU
Ask The Oracle Expert: Questions & Answers
EMAIL THIS

Rolling back Oracle XSU

Lewis Cunningham EXPERT RESPONSE FROM: Lewis Cunningham

Pose a Question
Other Oracle Categories
Meet all Oracle Experts
Become an Expert for this site


Oracle tips, scripts, and expert advice
Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us    Add to Google


>
QUESTION POSED ON: 11 July 2005
I have a question regarding the use of the folowing methods:
  • OracleXMLSave.insertXML(String xml)
  • OracleXMLSave.updateXML(String xml)

In the API those methods only return the number of rows (represented by an int) that have been "touched." Some of the Oracle XSU that I create contains several inserts/updates and I would like the opportunity to rollback if just one of those inserts/updates fails, but this seems impossible as I only get the aforementioned int and not exceptions thrown within the API. Do you have a solution to this problem?


>
EXPERT RESPONSE
It looks like you're using the Java API. IT should work the same as the PL/SQL package DBMS_XMLSAVE which is what I use.

When I use DBMS_XMLSAVE, I do get any exceptions that are raised. Here is a sample that shows that:

SQL> declare
  2 
  3     insCtx DBMS_XMLSave.ctxType;
  4     rows number;
  5     queryCtx DBMS_XMLQuery.ctxType;
  6     result CLOB;
  7 
  8   begin
  9 
 10     queryCtx := DBMS_XMLQuery.newContext('select * from emp');
 11  
 12     DBMS_XMLQuery.setRowTag(queryCtx,'ROW');      
 13     DBMS_XMLQuery.setRowSetTag(queryCtx,'ROWSET');
 14 
 15     result := DBMS_XMLQuery.getXML(queryCtx);
 16 
 17      insCtx := DBMS_XMLSave.newContext('emp');
 18      rows := DBMS_XMLSave.insertXML(insCtx,  result );
 19      DBMS_XMLSave.closeContext(insCtx);           
 20  end;
 21  /
declare
*
ERROR at line 1:
ORA-29532: Java call terminated by uncaught Java exception:
oracle.xml.sql.OracleXMLSQLException:
'oracle.jdbc.driver.OracleSQLException:
ORA-00001: unique constraint (SCOTT.PK_EMP) violated
' encountered during processing ROW element 14.  All prior XML row
changes were
rolled back. in the XML document.
ORA-06512: at "SYS.DBMS_XMLSAVE", line 115
ORA-06512: at line 18
If you aren't getting your exceptions propagated, you might want to check your code for a null exception handler.


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us    Add to Google


RELATED CONTENT
(Archive) App Dev: PL/SQL and XML
Detect if a column is NUMBER or VARCHAR2 in PL/SQL
Loading data into Oracle
Log execution time for a procedure
Hiding objects in a schema
Query for five most recent dates
Connecting with Visual Basic
SQL ANSI standards and compliance
Developing a parser for recognizing HTML tags
Oracle and SOAP
Concatenating XML fragments

Oracle XML, SOA, Web services
Oracle XML DB generates power for electrical agency
Oracle updates Microsoft developer tools
Oracle vs. SAP: The SOA factor
Oracle's content management software plan takes shape
Top five data management buzzwords
Oracle updates free Web development tool
Podcast: Oracle vs. SAP -- SOA and Web services security
Oracle open sources TopLink at EclipseCon
Oracle or SQL Server for developing social networking site?
Oracle Database 11g to feature XML enhancements

Oracle error messages
ORA-12560 error with Oracle 10g Instant Client
Unable to view Oracle tables in NetBeans
IMP-00017 error message with Oracle import
Can't open database after failed backup export
Query on dblink returning ORA-12545 error
RMAN not working at command prompt
Unique constraint violations, "parent key not found" errors
Insufficient privileges error when creating stored procedure
IMP-00010 error with import from 10g to 9i
ORA-12801 error while loading seed data

RELATED GLOSSARY TERMS
Terms from Whatis.com − the technology online dictionary
DSML  (SearchOracle.com)

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary



Search and Browse the Expert Answer Center
Search and browse more than 25,000 question and answer pairs from more than 250 TechTarget industry experts.
Browse our Expert Advice

HomeNewsTopicsTipsAsk the ExpertsMultimediaWhite PapersProductsBlogs
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides enterprise IT professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective IT purchase decisions and managing their organizations' IT projects - with its network of technology-specific Web sites, events and magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Reprints  |  Site Map




All Rights Reserved, Copyright 2003 - 2008, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts