Oracle8i Application Developer's Guide - XML Release 3 (8.1.7) Part Number A86030-01 |
Library | Service | Contents | Index

Using XML-SQL Utility (XSU), 21 of 26

## Storing XML in the Database Using DBMS_XMLSave

The steps involved in using the XML-SQL Utility storage engine follow:

1. Create a context handle by calling the DBMS_XMLSave.getCtx function and supplying it the table name to use for the DML operations.

2. In case of inserts, you can set the list of columns to insert into using the `setUpdateColNames` function. The default is to insert values into all the columns.

   For updates, the list of key columns must be supplied. Optionally the list of columns to update may also be supplied. In this case, the tags in the XML document matching the key column names will be used in the WHERE clause of the update statement and the tags matching the update column list will be used in the SET clause of the update statement.

   For deletes the default is to create a WHERE clause to match all the tag values present in each ROW element of the document supplied. To override this behavior you can set the list of key columns. In this case only those tag values whose tag names match these columns will be used to identify the rows to delete (in effect used in the WHERE clause of the delete statement).

3. Supply an XML document to the `insertXML`, `updateXML` or `deleteXML` functions to insert, update and delete respectively.

4. You can repeat the last operation any number of times.

5. Close the context.

Use the same examples as for the Java case, `OracleXMLSave` class examples.

| Copyright © 1996-2000, Oracle Corporation. All Rights Reserved. |
Library | Service | Contents | Index