Server access to order elements

The preceding example showed uses of get and set methods in a client environment. You can also call those methods in SQL statements in the server:

select order_doc>>getOrderElement("CustomerId"), 
 	order_doc>>getOrderElement("CustomerName"),
 	order_doc>>getOrderElement("Date")
 from order_docs
select order_doc>>getItemElement(1, "ItemId"),
 	order_doc>>getItemElement(1, "ItemName"),
 	order_doc>>getItemElement(1, "Quantity"), 
 	order_doc>>getItemAttribute(1, "Quantity", "unit")
 from order_docs
update order_docs
 set order_doc = order_doc>>setItemElement(1, "ItemName",
 	"Wrench")
update order_docs
 set order_doc = order_doc>>setItemElement(2, "ItemId", "967")
select order_doc>>getItemElement(1, "ItemName"),
 	order_doc>>getItemElement(2, "ItemId")
 from order_docs
update order_docs
 set order_doc = order_doc>>setItemAttribute(2, "Quantity",
 	"unit", "6")
select order_doc>>getItemAttribute(2, "Quantity", "unit")
 from order_docs