DBMS_XMLSTORE
provides the ability to store XML data in relational tables.
See Also:
This chapter contains the following sections:
Table 131-1 Types of DBMS_XMLSTORE
Type | Description |
---|---|
|
The type of the query context handle. This is the return type of NEWCONTEXT. |
Table 131-2 DBMS_XMLSTORE Package Subprograms
Method | Description |
---|---|
Clears the key column list. |
|
Clears the update column list. |
|
It closes/deallocates a particular save context. |
|
Deletes records specified by data from the XML document, from the table specified at the context creation time. |
|
Inserts the XML document into the table specified at the context creation time. |
|
Creates a save context, and returns the context handle. |
|
This method adds a column to the key column list. |
|
Names the tag used in the XML document., to enclose the XML elements corresponding to the database. |
|
Adds a column to the "update column list". |
|
Updates the table given the XML document. |
Clears the key column list.
PROCEDURE clearKeyColumnList( ctxHdl IN ctxType);
Parameter | IN / OUT | Description |
---|---|---|
ctxHdl |
(IN) |
Context handle. |
Clears the update column list.
PROCEDURE clearUpdateColumnList( ctxHdl IN ctxType);
Parameter | IN / OUT | Description |
---|---|---|
ctxHdl |
(IN) |
Context handle. |
Closes/deallocates a particular save context.
PROCEDURE closeContext( ctxHdl IN ctxType);
Parameter | IN / OUT | Description |
---|---|---|
ctxHdl |
(IN) |
Context handle. |
Deletes records specified by data from the XML document from the table specified at the context creation time, and returns the number of rows deleted.
Syntax | Description |
---|---|
FUNCTION deleteXML(
|
Uses a VARCHAR2 type for the xDoc parameter. |
FUNCTION deleteXML(
|
Uses a CLOB type for the xDoc parameter. |
FUNCTION deleteXML(
|
Uses an XMLType type for the xDoc parameter. |
Parameter | IN / OUT | Description |
---|---|---|
ctxHdl |
(IN) |
Context handle. |
xDoc |
(IN) |
String containing the XML document. |
Inserts the XML document into the table specified at the context creation time, and returns the number of rows inserted.
Syntax | Description |
---|---|
FUNCTION insertXML(
|
Passes in the xDoc parameter as a VARCHAR2 . |
FUNCTION insertXML(
|
Passes in the xDoc parameter as a CLOB . |
FUNCTION insertXML(
|
Passes in the xDoc parameter as an XMLType . |
Parameter | IN / OUT | Description |
---|---|---|
ctxHdl |
(IN) |
Context handle. |
xDoc |
(IN) |
String containing the XML document. |
Creates a save context, and returns the context handle.
FUNCTION newContext( targetTable IN VARCHAR2) RETURN ctxType;
Parameter | IN / OUT | Description |
---|---|---|
targetTable |
(IN) |
The target table into which to load the XML document. |
This method adds a column to the "key column list". The value for the column cannot be NULL
. In case of update or delete, the columns in the key column list make up the WHERE
clause of the statement. The key columns list must be specified before updates can complete; this is optional for delete operations
PROCEDURE setKeyColumn( ctxHdl IN ctxType, colName IN VARCHAR2);
Parameter | IN / OUT | Description |
---|---|---|
ctxHdl |
(IN) |
Context handle. |
colName |
(IN) |
Column to be added to the key column list; cannot be NULL . |
Names the tag used in the XML document, to enclose the XML elements corresponding to databse records.
PROCEDURE setRowTag( ctxHdl IN ctxType, tag IN VARCHAR2);
Parameter | IN / OUT | Description |
---|---|---|
ctxHdl |
(IN) |
Context handle. |
tag |
(IN) |
Tag name. |
Adds a column to the update column list. In case of insert, the default is to insert values to all the columns in the table; on the other hand, in case of updates, the default is to only update the columns corresponding to the tags present in the ROW
element of the XML document. When the update column list is specified, the columns making up this list alone will get updated or inserted into.
PROCEDURE setUpdateColumn( ctxHdl IN ctxType, colName IN VARCHAR2);
Parameter | IN / OUT | Description |
---|---|---|
ctxHdl |
(IN) |
Context handle. |
colName |
(IN) |
Column to be added to the update column list. |
Updates the table specified at the context creation time with data from the XML document, and returns the number of rows updated. The options are described in the following table.
Syntax | Description |
---|---|
FUNCTION updateXML(
|
Passes in the xDoc parameter as a VARCHAR2 . |
FUNCTION updateXML(
|
Passes in the xDoc parameter as a CLOB . |
FUNCTION updateXML(
|
Passes in the xDoc parameter as a XMLType . |
Parameter | IN / OUT | Description |
---|---|---|
ctxHdl |
(IN) |
Context handle. |
xDoc |
(IN) |
String containing the XML document. |