Team Fly | ![]() ![]() |
SQL> insert into XCUSTOMER values(XMLTYPE(' 2 <customer> 3 <name>Chris Smith</name> 4 <address>116 Main Street 5 Big City 6 U.S.A.</address> 7 <telephone>123 555-1234</telephone> 8 </customer>')) 9 /
7. Let's see our data. Enter the following SQL statement:
SQL> select * from xcustomer;
8. You should now see output resembling the following on your screen:
SYS_NC_ROWINFO$ ------------------------------------------------------------- <customer> <name>Chris Smith</name> <address>116 Main Street Big City U.S.A.</address> <telephone>123 555-1234</telephone> </customer>
This project illustrated how you can define tables that will store XML documents natively, as well as how to insert XML documents using a simple insert statement.
Now that we have been creating and loading XML documents into Oracle XML DB, let's take a look at what we have. An important view that you should be aware of is the view named resource_view. resource_view returns one row for each document or folder in the repository to which you have access. For example, we can get a list of all XML documents under the home/xteoma/xmldata/folder by executing this query:
SQL> select any_path 2 from resource_view 3 where under_path(res,'/home/xteoma/xmldata/)=1 4 and extractValue(res,'/Resource/ContentType')='text/xml'; ANY_PATH ------------------------------- /home/xteoma/xmldata/inv20040067.xml /home/xteoma/xmldata/products.xml
Team Fly | ![]() ![]() |