A customizable example for different result sets

This section demonstrates how you can store XML documents or the data that they contain in an Adaptive Server database using the ResultSet class and its methods for handling result sets. You can customize the ResultSet class for your database application.

Contrast the ResultSet document type and the Order document type:

For this example, you create and work with XML ResultSet documents that contain the same data as the XML Order documents.

First, create the orders table and its data:

create table orders 
 	(customer_id varchar(5) not null,
 	order_date datetime not null,
 	item_id varchar(5) not null,
 	quantity int not null, 
 	unit smallint default 1)
insert into orders values ("123", "1999/05/07", "987", 5, 1)
insert into orders values ("123", "1999/05/07", "654", 3, 12)
insert into orders values ("123", "1999/05/07", "579", 1, 1)

Also, create the following SQL table to store complete XML ResultSet documents:

create table resultset_docs
 	(id char(5),
 	rs_doc xml.resultsets.ResultSetXml)