Printing out results in case of object-relational table (Oracle)

I have made a table with this structure:
CREATE OR REPLACE TYPE Boat AS OBJECT(
Name varchar2(30),
Ident number,
CREATE OR REPLACE TYPE Type_boats AS TABLE OF Boat;
CREATE TABLE HOUSE(
Name varchar2(40),
MB Type_boats)
NESTED TABLE MB store as P_Boat;
INSERT INTO House VALUES ('Name',Type_boats(Boat('Boat1', 1)));
I am using java to print out all the results by calling a procedure.
CREATE OR REPLACE package House_boats
PROCEDURE add(everything works here)
PROCEDURE results_view;
END House_boats;
CREATE OR REPLACE Package.body House_boats AS
PROCEDURE add(everything works here) AS LANGUAGE JAVA
Name House_boats.add(...)
PROCEDURE results_view AS LANGUAGE JAVA
Name House_boats.resuts_view();
END House_boats;
However, I am not able to get Results.view working in case of object-relation table. This is how I do it in the situation of relational table.
CALL House_boats.results_view();
House_boats.java file which is loaded using LOADJAVA:
import java.sql.*;
import java io.*;
public class House_boats {
public static void results_view ()
   throws SQLException
   { String sql =
   "SELECT * from House";
   try { Connection conn = DriverManager.getConnection
("jdbc:default:connection:");
   PreparedStatement pstmt = conn.prepareStatement(sql);
   ResultSet rset = pstmt.executeQuery();
  printResults(rset);
  rset.close();
  pstmt.close();
   catch (SQLException e) {System.err.println(e.getMessage());
static void printResults (ResultSet rset)
   throws SQLException { String buffer = "";
   try { ResultSetMetaData meta = rset.getMetaData();
   int cols = meta.getColumnCount(), rows = 0;
   for (int i = 1; i <= cols; i++)
   int size = meta.getPrecision(i);
   String label = meta.getColumnLabel(i);
   if (label.length() > size) size = label.length();
   while (label.length() < size) label += " ";
  buffer = buffer + label + " "; }
  buffer = buffer + "\n";
   while (rset.next()) {
  rows++;
   for (int i = 1; i <= cols; i++) {
   int size = meta.getPrecision(i);
   String label = meta.getColumnLabel(i);
   String value = rset.getString(i);
   if (label.length() > size) size = label.length();
   while (value.length() < size) value += " ";
  buffer = buffer + value + " ";  }
  buffer = buffer + "\n";   }
   if (rows == 0) buffer = "No data found!\n";
   System.out.println(buffer); }
   catch (SQLException e) {System.err.println(e.getMessage());}  }
How do I print out the results correctly in my case of situation?
Thank you in advance

I have made a table with this structure:
I am using java to print out all the results by calling a procedure.
However, I am not able to get Results.view working in case of object-relation table. This is how I do it in the situation of relational table.
How do I print out the results correctly in my case of situation?
There are several things wrong with your code and methodology
1. The code you posted won't even compile because there are several syntax issues.
2. You are trying to use/test Java in the database BEFORE you get the code working outside the DB
3. Your code is not using collections in JDBC properly
I suggest that you use a different, proven approach to developing Java code for use in the DB
1. Use SIMPLE examples and then build on them. In this case that means don't add collections to the example until ALL other aspects of the app work properly.
2. Create and test the Java code OUTSIDE of the database. It is MUCH easier to work outside the database and there are many more tools to help you (e.g. NetBeans, debuggers, DBMS_OUTPUT windows, etc). Trying to debug Java code after you have already loaded it into the DB is too difficult. I'm not aware of anyone, even at the expert level, that develops that way.
3. When using complex functionality like collections first read the Oracle documentation (JDBC Developer Guide and Java Developer's Guide). Those docs have examples that are known to work.
http://docs.oracle.com/cd/B28359_01/java.111/b31225/chfive.htm
http://docs.oracle.com/cd/E11882_01/java.112/e16548/oraarr.htm#sthref583
The main issue with your example is #3 above; you are not using collections properly:
String value = rset.getString(i);
A collection is NOT a string so why would you expect that to work for a nested table?
A collection needs to be treated like a collection. You can even treat the collection as a separate result set. Create your code outside the database and use the debugger in NetBeans (or other) on this replacement code for your 'printResults' method:
static void printResults (ResultSet rset) throws SQLException {
    try {
       ResultSetMetaData meta = rset.getMetaData();
       while (rset.next()) {
           ResultSet rs = rset.getArray(2).getResultSet();
           rs.next();
           String ndx = rs.getString(1);
           Struct struct = (Struct) rs.getObject(2);
           System.out.println(struct.getSQLTypeName());
           Object [] oa = struct.getAttributes();
           for (int j = 0; j < oa.length; j++) {
              System.out.println(oa[j]);
    } catch  (SQLException e) {
       System.err.println(e.getMessage());
That code ONLY deals with column 2 which is the nested table. It gets that collection as a new resultset ('rs'). Then it gets the contents of that nested table as an array of objects and prints out the attributes of those objects so you can see them.
Step through the above code in a debugger so you can SEE what is happening. NetBeans also lets you enter expressions such as 'rs' in an evaluation window so you can dynamically try the different methods to see what they do for you.
Until you get you code working outside the database don't even bother trying to load it into the DB and create a Java stored procedure.
Since your current issue has nothing to do with this forum I suggest that you mark this thread ANSWERED and repost it in the JDBC forum if you need further help with this issue.
https://forums.oracle.com/community/developer/english/java/database_connectivity
When you repost you can include a link to this current thread if you want. Once your Java code is actually working then try the Java Stored procedure examples in the Java Developer's Guide doc linked above.
At the point you have any issues that relate to Java stored procedures then you should post them in the SQL and PL/SQL forum
https://forums.oracle.com/community/developer/english/oracle_database/sql_and_pl_sql

Similar Messages

  • Retrieve xml data from a relational table(oracle) with datatype as xmltyp

    Hello Avijit, any resolution for this issue?

    hi .... I am trying to retrieve xml data from a relational table with datatype as xmltyp. The SQ is retrieving rows but the xml parser give transformation error . The transformation retrieve xml data from a relational table(oracle) with datatype as xmltyp returned a row error status on receiving an input row on group retrieve xml data from a relational table(oracle) with datatype as xmltyp.  ERROR : An XML document was truncated and thus not processed. Input row from SQ_XMLTYPE_TEST: Rowdata: ( RowType=0(insert) Src Rowid=5 Targ Rowid=5 DOCUMENT (DataInput:Char.64000:): "<?xml version='1.0' encoding='UTF-8'?><main><DATA_RECORD> <OFFER_ID>434345</OFFER_ID> <ADDR>sec -2 salt lake</ADDR> <CITY>kolkata</CITY> (DISPLAY TRUNCATED)(TRUNCATED)" )  thanks in advance Avijit

  • When i print out cd album case inserts-the songs all print in one glob and then the photo of album on same page prints out normal-only happens on my itunes -not anywhere else i print ok thanks

    hi-i need help- when i try to print a cd jewel case insert(i did this many times)the songs side will print out on top of each other like one big glob-and the other half the photo of album comes out correct-i thought it was my old printer so of course got a new one-still does the same crap-help me

    I believe that insufficient RAM may be the source of some of your problems. If you have a RAM of somewhere 4 to 8GB, you will experience smoother computing. 3GB doesn't seem right, so you might want to learn more by going to this site:
    http://www.crucial.com/store/drammemory.aspx
    I don't know what know what's happening with your optical drive, but it seems you use your drive quite a bit. In that case, look into a lens cleaner for your machine. It's inexpensive, works quite well.
    I hope you'll post here with your results!

  • SQL Server 2012 Management Studio:In the Database, how to print out or export the old 3 dbo Tables that were created manually and they have a relationship for 1 Parent table and 2 Child tables?How to handle this relationship in creating a new XML Schema?

    Hi all,
    Long time ago, I manually created a Database (APGriMMRP) and 3 Tables (dbo.Table_1_XYcoordinates, dbo.Table_2_Soil, and dbo.Table_3_Water) in my SQL Server 2012 Management Studio (SSMS2012). The dbo.Table_1_XYcoordinates has the following columns: file_id,
    Pt_ID, X, Y, Z, sample_id, Boring. The dbo.Table_2_Soil has the following columns: Boring, sample_date, sample_id, Unit, Arsenic, Chromium, Lead. The dbo.Table_3_Water has the following columns: Boring, sample_date, sample_id, Unit, Benzene, Ethylbenzene,
    Pyrene. The dbo.Table_1_XYcoordinates is a Parent Table. The dbo.Table_2_Soil and the dbo.Table_3_Water are 2 Child Tables. The sample_id is key link for the relationship between the Parent Table and the Child Tables.
    Problem #1) How can I print out or export these 3 dbo Tables?
    Problem #2) If I right-click on the dbo Table, I see "Start PowerShell" and click on it. I get the following error messages: Warning: Failed to load the 'SQLAS' extension: An exception occurred in SMO while trying to manage a service. 
    --> Failed to retrieve data for this request. --> Invalid class.  Warning: Could not obtain SQL Server Service information. An attemp to connect to WMI on 'NAB-WK-02657306' failed with the following error: An exception occurred in SMO while trying
    to manage a service. --> Failed to retrieve data for this request. --> Invalid class.  .... PS SQLSERVER:\SQL\NAB-WK-02657306\SQLEXPRESS\Databases\APGriMMRP\Table_1_XYcoordinates>   What causes this set of error messages? How can
    I get this problem fixed in my PC that is an end user of the Windows 7 LAN System? Note: I don't have the regular version of Microsoft Visual Studio 2012 in my PC. I just have the Microsoft 2012 Shell (Integrated) program in my PC.
    Problem #3: I plan to create an XML Schema Collection in the "APGriMMRP" database for the Parent Table and the Child Tables. How can I handle the relationship between the Parent Table and the Child Table in the XML Schema Collection?
    Problem #4: I plan to extract some results/data from the Parent Table and the Child Table by using XQuery. What kind of JOIN (Left or Right JOIN) should I use in the XQuerying?
    Please kindly help, answer my questions, and advise me how to resolve these 4 problems.
    Thanks in advance,
    Scott Chang    

    In the future, I would recommend you to post your questions one by one, and to the appropriate forum. Of your questions it is really only #3 that fits into this forum. (And that is the one I will not answer, because I have worked very little with XSD.)
    1) Not sure what you mean with "print" or "export", but when you right-click a database, you can select Tasks from the context menu and in this submenu you find "Export data".
    2) I don't know why you get that error, but any particular reason you want to run PowerShell?
    4) If you have tables, you query them with SQL, not XQuery. XQuery is when you query XML documents, but left and right joins are SQL things. There are no joins in XQuery.
    As for left/right join, notice that these two are equivalent:
    SELECT ...
    FROM   a LEFT JOIN b ON a.col = b.col
    SELECT ...
    FROM   b RIGHT JOIN a ON a.col = b.col
    But please never use RIGHT JOIN - it gives me a headache!
    There is nothing that says that you should use any of the other. In fact, if you are returning rows from parent and child, I would expect an inner join, unless you want to cater for parents without children.
    Here is an example where you can study the different join types and how they behave:
    CREATE TABLE apple (a int         NOT NULL PRIMARY KEY,
                        b varchar(23) NOT NULL)
    INSERT apple(a, b)
       VALUES(1, 'Granny Smith'),
             (2, 'Gloster'),
             (4, 'Ingrid-Marie'),
             (5, 'Milenga')
    CREATE TABLE orange(c int        NOT NULL PRIMARY KEY,
                        d varchar(23) NOT NULL)
    INSERT orange(c, d)
       VALUES(1, 'Agent'),
             (3, 'Netherlands'),
             (4, 'Revolution')
    SELECT a, b, c, d
    FROM   apple
    CROSS  JOIN orange
    SELECT a, b, c, d
    FROM   apple
    INNER  JOIN orange ON apple.a = orange.c
    SELECT a, b, c, d
    FROM   apple
    LEFT   OUTER JOIN orange ON apple.a = orange.c
    SELECT a, b, c, d
    FROM   apple
    RIGHT  OUTER JOIN orange ON apple.a = orange.c
    SELECT a, b, c, d
    FROM   apple
    FULL OUTER JOIN orange ON apple.a = orange.c
    go
    DROP TABLE apple, orange
    Erland Sommarskog, SQL Server MVP, [email protected]

  • MULTIPLE ROWS IN OBJECT RELATIONAL TABLE, HELP

    Hi,
    Here is my problem explanation. Please help. I have created an object type address, and a relational table called employee. One of the column in employee table is based on the type address. Now suppose I want to have 5 differrent addresses for a perticular employee how can I have it stored? The empno is the primary key .Here is the data strucure
    address( line1 varchar2(30),city varchar2(30), state varchar2(20), zip varchar2(13))
    employee
    (empno number,
    name varchar2(60),
    emp_add address)
    Thanks
    Feroz

    Well you could give your employees a nested table of addresses. But as William said, you really ought to use relational tables for this situation.
    I haven't yet come across a compelling argument for using Types instead of tables for data storage, and there are lots of drawbacks. Duplication of data is just one.
    Cheers, APC

  • Help with constraints on object relational tables

    Hi
    I am looking to create an object relational database with a check constraint on the relationships. For example:
    * I have table called person_tab which is a table of person_t type.
    * Person_t type is inherited by the manager_t type and the applicant_t type.
    * I have a second table called interview_tab of interview_t type.
    * The interview table has two columns (manager and appilcant) that are scope restrained to the person table.
    * I would also like to put check constraints on these columns to say:
    ----- Manager: check the person_number is less than 20000
    ----- Applicant: check the person_number is greater than 19999
    Can anyone tell me if this is possible and if so how can it be done?
    Thanks in advance
    Stephen

    You have circular dependencies (manager_t depends upon interview_list_t depends upon interview_t depends upon manager_t) which I don't think is a good idea. But then that's probably just my old-fashioned relational head baulking at this new-fangled OO way of looking at data models. However, my experience with using types and subtypes in Oracle does teach me that this is a complete pain in the neck, because it makes changing your Type definitions a very awkward process.
    am I right in saying I cannot use the check constraint?I think so. If the value range for ID is a property of being a Manager or an Applicant then properly that should be enforced by those types not by the Interview type. Then all that Interviews needs to worry about is that it gets instantiated with attributes of the correct Type.
    I've simplified your model a bit. To start with I'm going to create a single PERSONS table to store both managers and applicants...
    SQL> CREATE TYPE person_t AS OBJECT (
      2  personno NUMBER,
      3  surname VARCHAR2(30),
      4  forename VARCHAR2(30),
      5  dob DATE
      6  ) NOT FINAL;
      7  /
    Type created.
    SQL>
    SQL> CREATE OR REPLACE TYPE applicant_t UNDER person_t
      2  (qualifications varchar2(200))
      3  FINAL ;
      4  /
    Type created.
    SQL>
    SQL> CREATE OR REPLACE TYPE manager_t UNDER person_t
      2  (extension varchar2(5)) FINAL;
      3  /
    Type created.
    SQL>
    SQL> CREATE OR REPLACE TYPE interview_t AS OBJECT (
      2  interviewno NUMBER,
      3  idate DATE,
      4  itime NUMBER,
      5  interest NUMBER,
      6  is_made_by REF manager_t,
      7  attended_by REF applicant_t
      8  ) ;
      9  /
    Type created.
    SQL>
    SQL>
    SQL> CREATE TABLE persons OF person_t
      2  /
    Table created.
    SQL> CREATE TABLE interviews OF interview_t
      2  /
    Table created.
    SQL> Okay let's create some objects...
    SQL> declare
      2     mgr manager_t := manager_t(1,'RUNCITER', 'GLEN', sysdate - (42*365), 'x1234');
      3     app applicant_t := applicant_t(2,  'CHIP', 'JOE', sysdate - (38*365), 'BSc, MSc');
      4     intv interview_t;
      5     m_ref REF  person_t;
      6     a_ref REF person_t;
      7  begin
      8     INSERT INTO persons p VALUES mgr
      9         RETURNING REF(p) INTO m_ref   ;
    10     INSERT INTO persons p VALUES app
    11         RETURNING REF(p) INTO a_ref   ;
    12     insert into interviews
    13     values (interview_t(1001, sysdate, 45, 5, TREAT(m_ref AS REF manager_t)
            , TREAT(a_ref AS REF applicant_t)));
    14  end;
    15  /
    PL/SQL procedure successfully completed.
    SQL> SELECT i.interviewno, i.is_made_by.surname, i.attended_by.surname
      2  FROM interviews i
      3  /
    INTERVIEWNO IS_MADE_BY.SURNAME             ATTENDED_BY.SURNAME                 
           1001 RUNCITER                       CHIP                                
    SQL> Have we got integrity?
    SQL> rollback
      2  /
    Rollback complete.
    SQL>
    SQL> declare
      2     mgr manager_t := manager_t(1,'RUNCITER', 'GLEN', sysdate - (42*365), 'x1234');
      3     app applicant_t := applicant_t(2,  'CHIP', 'JOE', sysdate - (38*365), 'BSc, MSc');
      4     intv interview_t;
      5     m_ref REF  person_t;
      6     a_ref REF person_t;
      7  begin
      8     INSERT INTO persons p VALUES mgr
      9         RETURNING REF(p) INTO m_ref   ;
    10     INSERT INTO persons p VALUES app
    11         RETURNING REF(p) INTO a_ref   ;
    12     insert into interviews
    13     values (interview_t(1001, sysdate, 45, 5, TREAT(a_ref AS REF manager_t)
             , TREAT(m_ref AS REF applicant_t)));
    14  end;
    15  /
    PL/SQL procedure successfully completed.
    SQL>
    SQL> SELECT i.interviewno, i.is_made_by.surname, i.attended_by.surname
      2  FROM interviews i
      3  /
    INTERVIEWNO IS_MADE_BY.SURNAME             ATTENDED_BY.SURNAME                 
           1001                                                                    
    SQL> Kind of, but it's not very satisfactory. Let's use separate tables for MANAGERS and APPLICANTS...
    SQL> rollback
      2  /
    Rollback complete.
    SQL>
    SQL> CREATE TABLE managers OF manager_t
      2  /
    Table created.
    SQL>
    SQL> CREATE TABLE applicants OF applicant_t
      2  /
    Table created.
    SQL> declare
      2     mgr manager_t := manager_t(1,'RUNCITER', 'GLEN', sysdate - (42*365), 'x1234');
      3     app applicant_t := applicant_t(2,  'CHIP', 'JOE', sysdate - (38*365), 'BSc, MSc');
      4     intv interview_t;
      5     m_ref REF  manager_t;
      6     a_ref REF applicant_t;
      7  begin
      8     INSERT INTO managers m VALUES mgr
      9         RETURNING REF(m) INTO m_ref   ;
    10     INSERT INTO applicants a VALUES app
    11         RETURNING REF(a) INTO a_ref   ;
    12     insert into interviews values (interview_t(1001, sysdate, 45, 5, m_ref, a_ref));
    13 
    14  end;
    15  /
    PL/SQL procedure successfully completed.
    SQL>
    SQL> SELECT i.interviewno, i.is_made_by.surname, i.attended_by.surname
      2  FROM interviews i
      3  /
    INTERVIEWNO IS_MADE_BY.SURNAME             ATTENDED_BY.SURNAME                 
           1001 RUNCITER                       CHIP                                
    SQL> rollback
      2  /
    Rollback complete.
    SQL> declare
      2     mgr manager_t := manager_t(1,'RUNCITER', 'GLEN', sysdate - (42*365), 'x1234');
      3     app applicant_t := applicant_t(2,  'CHIP', 'JOE', sysdate - (38*365), 'BSc, MSc');
      4     intv interview_t;
      5     m_ref REF  manager_t;
      6     a_ref REF applicant_t;
      7  begin
      8     INSERT INTO managers m VALUES mgr
      9         RETURNING REF(m) INTO m_ref   ;
    10     INSERT INTO applicants a VALUES app
    11         RETURNING REF(a) INTO a_ref   ;
    12     insert into interviews values (interview_t(1001, sysdate, 45, 5, a_ref, m_ref));
    13 
    14  end;
    15  /
       insert into interviews values (interview_t(1001, sysdate, 45, 5, a_ref, m_ref));
    ERROR at line 12:
    ORA-06550: line 12, column 69:
    PL/SQL: ORA-00932: inconsistent datatypes: expected REF APC.APPLICANT_T got REF
    APC.MANAGER_T
    ORA-06550: line 12, column 4:
    PL/SQL: SQL Statement ignored
    SQL>I hope that's useful to you.
    Cheers, APC
    Layout of SQL*Plus session tweaked for readability
    Message was edited by:
    APC

  • Querying XML data in  Object Relational tables

    Hi,
    Can someone help me?
    I have registered the purchaseorder.xsd in my database schema.
    [ http://www.oracle.com/technology/oramag/oracle/03-jul/o43xml.html ]
    declare
    l_bfile bfile;
    begin
    l_bfile := bfilename(
    'XMLSAMP', 'purchaseOrder.xsd');
    dbms_lob.open(l_bfile);
    dbms_xmlschema.registerschema('http://localhost:8080/purchaseOrder.xsd', l_bfile);
    dbms_lob.close(l_bfile);
    end;
    This has created a table "PURCHASEORDER"
    SYS_NC_ROWINFO$ SYS.XMLTYPE
    It has also created object types.
    select object_name from user_objects where object_type = 'TYPE' and object_name like 'XDBPO%'
    XDBPO_ACTIONS_TYPE
    XDBPO_ACTION_COLLECTION
    XDBPO_ACTION_TYPE
    XDBPO_LINEITEMS_TYPE
    XDBPO_LINEITEM_TYPE
    XDBPO_PART_TYPE
    XDBPO_REJECTION_TYPE
    XDBPO_SHIPINSTRUCTIONS_TYPE
    XDBPO_TYPE
    I have also inserted an xml into that table.
    INSERT INTO "PURCHASEORDER"
    VALUES
    xmltype
    getFileContent('ADAMS-20011127121040988PST.xml','XMLSAMP')
    Now how do I retrieve the data from this table and the other object types?
    Is extractvalue the only method? I have gone thru examples in the net but everything uses the element names in xml document and not the object type names.
    For example to retreive the lineitem details, this query can be used
    SELECT extractValue(value(d),'/Description')
    FROM "PURCHASEORDER" p,
    table (xmlsequence(extract(p.SYS_NC_ROWINFO$,'/PurchaseOrder/LineItems/LineItem/Description'))) d
    But I want to retreive it from "XDBPO_LINEITEM_TYPE".
    Is this possible?
    Can someone help me please?
    Thanks in advance.
    Jay

    #1. If you had taken the time to read some of the other posts in the forum all of the answers you needed were all there..
    #2. As PM's we are not expected to spend a lot of time dealing with the forums. In general we are expected only to step in and answer the questions that are not easily answered by carefully reading existing posts or deal with cases were the wrong answer is supplied.
    #3. I'm technically on vacation, and posted to that effect last week, so pushing for an answer is not at all appreciated...
    #4. The problem is extremely simple, at least as stated in your simple example.
    Given the schema.. Note It's been annotated
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xdb="http://xmlns.oracle.com/xdb" xdb:storeVarrayAsTable="true">
         <xs:element name="Bill">
              <xs:complexType>
                   <xs:sequence>
                        <xs:element ref="InvCtlN"/>
                        <xs:element ref="MedBU"/>
                        <xs:element ref="Lineitem" maxOccurs="unbounded"/>
                   </xs:sequence>
              </xs:complexType>
         </xs:element>
         <xs:element name="InvCtlN">
              <xs:simpleType>
                   <xs:restriction base="xs:byte">
                   </xs:restriction>
              </xs:simpleType>
         </xs:element>
         <xs:element name="LineCode">
              <xs:simpleType>
                   <xs:restriction base="xs:int">
                   </xs:restriction>
              </xs:simpleType>
         </xs:element>
         <xs:element name="Lineitem">
              <xs:complexType>
                   <xs:sequence>
                        <xs:element ref="Type"/>
                        <xs:element ref="LineCode"/>
                   </xs:sequence>
              </xs:complexType>
         </xs:element>
         <xs:element name="MedBU">
              <xs:simpleType>
                   <xs:restriction base="xs:string">
                   </xs:restriction>
              </xs:simpleType>
         </xs:element>
         <xs:element name="SampleFile" xdb:defaultTable="SAMPLE_FILE_TABLE">
              <xs:complexType>
                   <xs:sequence>
                        <xs:element ref="Bill" maxOccurs="unbounded"/>
                   </xs:sequence>
              </xs:complexType>
         </xs:element>
         <xs:element name="Type">
              <xs:simpleType>
                   <xs:restriction base="xs:string">
                   </xs:restriction>
              </xs:simpleType>
         </xs:element>
    </xs:schema>and the following instance
    <SampleFile xmlns:xdb="http://xmlns.oracle.com/xdb" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="testcase.xsd">
         <Bill>
              <InvCtlN>1</InvCtlN>
              <MedBU>ABC</MedBU>
              <Lineitem>
                   <Type>P1</Type>
                   <LineCode>99214</LineCode>
              </Lineitem>
         </Bill>
         <Bill>
              <InvCtlN>2</InvCtlN>
              <MedBU>DEF</MedBU>
              <Lineitem>
                   <Type>P2</Type>
                   <LineCode>99215</LineCode>
              </Lineitem>
              <Lineitem>
                   <Type>P3</Type>
                   <LineCode>99216</LineCode>
              </Lineitem>
         </Bill>
         <Bill>
              <InvCtlN>3</InvCtlN>
              <MedBU>HJK</MedBU>
              <Lineitem>
                   <Type>P4</Type>
                   <LineCode>99217</LineCode>
              </Lineitem>
         </Bill>
    </SampleFile>The following appears to be what you are looking for
    SQL*Plus: Release 10.2.0.2.0 - Production on Mon Feb 20 22:42:53 2006
    Copyright (c) 1982, 2005, Oracle.  All Rights Reserved.
    SQL> spool registerSchema_&4..log
    SQL> set trimspool on
    SQL> connect &1/&2
    Connected.
    SQL> --
    SQL> declare
      2    result boolean;
      3  begin
      4    result := dbms_xdb.createResource('/home/&1/xsd/&4',
      5                                      bfilename(USER,'&4'),nls_charset_id('AL32UTF8'));
      6  end;
      7  /
    old   4:   result := dbms_xdb.createResource('/home/&1/xsd/&4',
    new   4:   result := dbms_xdb.createResource('/home/OTNTEST/xsd/testcase.xsd',
    old   5:                                    bfilename(USER,'&4'),nls_charset_id('AL32UTF8'));
    new   5:                                    bfilename(USER,'testcase.xsd'),nls_charset_id('AL32UTF8'));
    PL/SQL procedure successfully completed.
    SQL> commit
      2  /
    Commit complete.
    SQL> alter session set events='31098 trace name context forever'
      2  /
    Session altered.
    SQL> begin
      2    dbms_xmlschema.registerSchema
      3    (
      4      schemaURL => '&3',
      5      schemaDoc => xdbURIType('/home/&1/xsd/&4').getClob(),
      6      local     => TRUE,
      7      genTypes  => TRUE,
      8      genBean   => FALSE,
      9      genTables => &5
    10    );
    11  end;
    12  /
    old   4:     schemaURL => '&3',
    new   4:     schemaURL => 'testcase.xsd',
    old   5:     schemaDoc => xdbURIType('/home/&1/xsd/&4').getClob(),
    new   5:     schemaDoc => xdbURIType('/home/OTNTEST/xsd/testcase.xsd').getClob(),
    old   9:     genTables => &5
    new   9:     genTables => TRUE
    PL/SQL procedure successfully completed.
    SQL> quit
    Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - Production
    With the Partitioning, OLAP and Data Mining options
    SQL*Plus: Release 10.2.0.2.0 - Production on Mon Feb 20 22:42:55 2006
    Copyright (c) 1982, 2005, Oracle.  All Rights Reserved.
    SQL> spool insertFile_&3..log
    SQL> set trimspool on
    SQL> connect &1/&2
    Connected.
    SQL> --
    SQL> set timing on
    SQL> set long 10000
    SQL> --
    SQL> insert into &4 values (xmltype(bfilename(USER,'&3'),nls_charset_id('AL32UTF8')))
      2  /
    old   1: insert into &4 values (xmltype(bfilename(USER,'&3'),nls_charset_id('AL32UTF8')))
    new   1: insert into SAMPLE_FILE_TABLE values (xmltype(bfilename(USER,'testcase.xml'),nls_charset_id('AL32UTF8')
    1 row created.
    Elapsed: 00:00:00.06
    SQL> commit
      2  /
    Commit complete.
    Elapsed: 00:00:00.00
    SQL> quit
    Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - Production
    With the Partitioning, OLAP and Data Mining options
    SQL*Plus: Release 10.2.0.2.0 - Production on Mon Feb 20 22:42:55 2006
    Copyright (c) 1982, 2005, Oracle.  All Rights Reserved.
    SQL> spool testcase.log
    SQL> --
    SQL> connect &1/&2
    Connected.
    SQL> --
    SQL> --
    SQL> -- Testcase code here
    SQL> --
    SQL> set trimspool on
    SQL> set autotrace on explain
    SQL> set timing on
    SQL> set pages 10 lines 160 long 100000
    SQL> --
    SQL> column INVCTLN format  9999
    SQL> column MEDBU   format  A10
    SQL> column TYPE    format  A10
    SQL> column LINECODE format 999999999
    SQL> create or replace view MASTER_TABLE_VIEW
      2  (
      3     INVCTLN,
      4     MEDBU
      5  )
      6  as
      7  select extractValue(value(bill),'/Bill/InvCtlN'),
      8         extractValue(value(bill),'/Bill/MedBU')
      9    from SAMPLE_FILE_TABLE t,
    10         table(xmlsequence(extract(value(t),'/SampleFile/Bill'))) Bill
    11  /
    View created.
    Elapsed: 00:00:00.04
    SQL> create or replace view DETAIL_TABLE_VIEW
      2  (
      3     INVCTLN,
      4     TYPE,
      5     LINECODE
      6  )
      7  as
      8  select extractValue(value(bill),'/Bill/InvCtlN'),
      9         extractValue(value(LineItem),'/Lineitem/Type'),
    10         extractValue(value(LineItem),'/Lineitem/LineCode')
    11    from SAMPLE_FILE_TABLE t,
    12         table(xmlsequence(extract(value(t),'/SampleFile/Bill'))) Bill,
    13         table(xmlsequence(extract(value(bill),'/Bill/Lineitem'))) LineItem
    14  /
    View created.
    Elapsed: 00:00:00.05
    SQL> set autotrace on explain
    SQL> --
    SQL> select * from MASTER_TABLE_VIEW
      2  /
    INVCTLN MEDBU
          1 ABC
          2 DEF
          3 HJK
    Elapsed: 00:00:00.05
    Execution Plan
    Plan hash value: 2362844891
    | Id  | Operation          | Name               | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT   |                    |     3 |  6165 |   805   (1)| 00:00:10 |
    |   1 |  NESTED LOOPS      |                    |     3 |  6165 |   805   (1)| 00:00:10 |
    |*  2 |   TABLE ACCESS FULL| SAMPLE_FILE_TABLE  |     1 |    30 |     3   (0)| 00:00:01 |
    |*  3 |   INDEX RANGE SCAN | SYS_IOT_TOP_159053 |     3 |  6075 |     1   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       2 - filter(SYS_CHECKACL("ACLOID","OWNERID",xmltype('<privilege
                  xmlns="http://xmlns.oracle.com/xdb/acl.xsd"
                  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                  xsi:schemaLocation="http://xmlns.oracle.com/xdb/acl.xsd
                  http://xmlns.oracle.com/xdb/acl.xsd DAV:http://xmlns.oracle.com/xdb/dav.xsd"><rea
                  d-properties/><read-contents/></privilege>'))=1)
       3 - access("NESTED_TABLE_ID"="SAMPLE_FILE_TABLE"."SYS_NC0000800009$")
    Note
       - dynamic sampling used for this statement
    SQL> select * from DETAIL_TABLE_VIEW
      2  /
    INVCTLN TYPE         LINECODE
          1 P1              99214
          3 P4              99217
          2 P2              99215
          2 P3              99216
    Elapsed: 00:00:00.07
    Execution Plan
    Plan hash value: 971642473
    | Id  | Operation               | Name               | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT        |                    |     4 |  8352 |   813   (0)| 00:00:10 |
    |   1 |  NESTED LOOPS           |                    |     4 |  8352 |   813   (0)| 00:00:10 |
    |   2 |   MERGE JOIN CARTESIAN  |                    |     4 |  8220 |   805   (0)| 00:00:10 |
    |*  3 |    TABLE ACCESS FULL    | SAMPLE_FILE_TABLE  |     1 |    30 |     3   (0)| 00:00:01 |
    |   4 |    BUFFER SORT          |                    |     4 |  8100 |   802   (0)| 00:00:10 |
    |   5 |     INDEX FAST FULL SCAN| SYS_IOT_TOP_159055 |     4 |  8100 |   802   (0)| 00:00:10 |
    |*  6 |   INDEX UNIQUE SCAN     | SYS_IOT_TOP_159053 |     1 |    33 |     2   (0)| 00:00:01 |
    |*  7 |    INDEX RANGE SCAN     | SYS_C0022871       |     1 |       |     0   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       3 - filter(SYS_CHECKACL("ACLOID","OWNERID",xmltype('<privilege
                  xmlns="http://xmlns.oracle.com/xdb/acl.xsd"
                  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                  xsi:schemaLocation="http://xmlns.oracle.com/xdb/acl.xsd
                  http://xmlns.oracle.com/xdb/acl.xsd DAV:http://xmlns.oracle.com/xdb/dav.xsd"><read-pro
                  perties/><read-contents/></privilege>'))=1)
       6 - access("NESTED_TABLE_ID"="SYS_NTh/v83GzKQ1evte63P5QRog=="."SYS_NC0000700008$")
           filter("NESTED_TABLE_ID"="SAMPLE_FILE_TABLE"."SYS_NC0000800009$")
       7 - access("NESTED_TABLE_ID"="SYS_NTh/v83GzKQ1evte63P5QRog=="."SYS_NC0000700008$")
    Note
       - dynamic sampling used for this statement
    SQL> quit
    Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - Production
    With the Partitioning, OLAP and Data Mining options
    C:\xdb\otn\362337>

  • How do I  print out the attributes of objects from a  Vector?  Help !

    Dear Java People,
    I have created a video store with a video class.I created a vector to hold the videos and put 3 objects in the vector.
    How do I print out the attributes of each object in the vector ?
    Below is the driver and Video class
    Thank you in advance
    Norman
    import java.util.*;
    public class TryVideo
    public static void main(String[] args)
    Vector videoVector = new Vector();
    Video storeVideo1 = new Video(1,"Soap Opera", 20);
    Video storeVideo2 = new Video(2,"Action Packed Movie",25);
    Video storeVideo3 = new Video(3,"Good Drama", 10);
    videoVector.add(storeVideo1);
    videoVector.add(storeVideo2);
    videoVector.add(storeVideo3);
    Iterator i = videoVector.interator();
    while(i.hasNext())
    System.out.println(getVideoName() + getVideoID() + getVideoQuantity());
    import java.util.*;
    public class Video
    public final static int RENT_PRICE = 3;
    public final static int PURCHASE_PRICE = 20;
    private int videoID;
    private String videoName;
    private int videoQuantity;
    public Video(int videoID, String videoName, int videoQuantity)
    this.videoID = videoID;
    this.videoName = videoName;
    this.videoQuantity = videoQuantity;
    public int getVideoID()
    return videoID;
    public String getVideoName()
    return videoName;
    public int getVideoQuantity()
    return videoQuantity;
    }

    Dear Bri81,
    Thank you for your reply.
    I tried the coding as you suggested
    while(i.hasNext())
    System.out.println( i.next() );
    but the error message reads:
    "CD.java": Error #: 354 : incompatible types; found: void, required: java.lang.String at line 35
    Your help is appreciated
    Norman
    import java.util.*;
    public class TryCD
       public static void main(String[] args)
         Vector cdVector = new Vector();
         CD cd_1 = new CD("Heavy Rapper", "Joe", true);
         CD cd_2 = new CD("Country Music", "Sam", true);
         CD cd_3 = new CD("Punk Music", "Mary", true);
         cdVector.add(cd_1);
         cdVector.add(cd_2);
         cdVector.add(cd_3);
         Iterator i = cdVector.iterator();
         while(i.hasNext())
           System.out.println( i.next() );
    public class CD
       private String item;
       private boolean borrowed = false;
       private String borrower = "";
       private int totalNumberOfItems;
       private int totalNumberOfItemsBorrowed;
       public CD(String item,String borrower, boolean borrowed)
         this.item = item;
         this.borrower = borrower;
         this.borrowed = borrowed;
       public String getItem()
         return item;
       public String getBorrower()
         return borrower;
       public boolean getBorrowed()
         return borrowed;
       public String toString()
          return System.out.println( getItem() + getBorrower());

  • How to print out contents of an object

    Hello, I am having a problem printing out the contents of an object I have created.
    ListReturn test = new ListReturn("ADMNTEST", "JUL", "2002", con);
    System.out.println(test);I see this:
    com.home.tools.reporting.ListReturn@6cd7d5
    But my "test" varible should be populated with a collection. How can I print out my object????

    One of the methods in your Object should be public String toString().
    In this method, iterate over the collection in your object and print out the bits of readable data you think would be useful to display and append it to the end of a String that you return.

  • Print-out different on Officejet 6500A and Officejet 8600Plus

    Dear Sir,
    I have file on Words program, that I never changes the page layout, but everytime I print that file, in either of those to printer they never be the same print-out result, meaning :
    If I print the same file on 6500A the result are not the same as I print on 8600 Plus, I didn't changes anything on the same file (page layout).
    Thank you for the help
    DJ27

    This can happen if the paper size, type and other printer settings are not same while printing the same document. If this is not the quality and mainly the print format, please check primarily the paper size and paper type setting on both the printer before printing.
    I work for HP but my posts and replies are my own.
    Say Thanks by clicking the Kudos Star in the post that helped you.
    Please mark the post that solves your problem as Accepted Solution

  • PrintWriter question- is it possible to print out a table?

    Hi everyone,
    I am taking the information retrieved from a database and printing it out to a text file using FileOutputStream and PrintWriter. My question is can i format the printout in any way-- like print out certain records in some sort of table, or make some text bold.
    I don't know if the code is relevant, so i paraphrased it here:
    FileOutputStream fos = new FileOutputStream(x);
    PrintWriter w = new PrintWriter(new OutputStreamWriter(fos));
    <here i connect to database>
    <a couple of w.print() statements and w.println() statements>     
    w.close();

    You can print data to a file in any form you want. The catch is, as far as i know, you have to lay it out manually. You must convert the data to strings and use white space to lay it out how you want it to look in the text file. Looking over some text I think you would use BufferedWriter to write strings to a file. I don't know any short and easy way, maybe some of the more experienced people will help.
    Check the java API on file i/o start at file and work down and see what classes do what you want them to do. If the file is online check the java.net stuff.
    If you are trying to print a table to a printer an easy way to do that is make the table in an applet, then print the applet from explorer or netscape.

  • Print out lists of formats with their settings

    I would like the ability to print out a complete list of paragraph, character, table, and cross-reference formats (with their settings) for inclusion in a local style guide.

    Julee,
    Those files were .zip files wrapped in 7zip wrappers - very strange. Any way, I've attached the MIF_munch here in a single .zip file.
    Note: the file is named Mif_munch.zip.txt to fool the upload file type restrictions. Just delete the .txt extension and unzip.
    It might take a few hours or so to clear the scanning queue.

  • Can ODM or/and DM4j support Object-Relational features?

    I'd like to apply data mining on some object-relational tables, however, it seemed that DM4j does't support user-defined object attributes. Did I miss something? Will ODM itself support object-relational, or I need to wait for a later version. I'm using ODM 9.2.0.4 now.

    ODM does not support the direct access of object types.
    In ODM 10.1 the pl/sql api does support two object types that are predefined by ODM.
    Currently there are no plans to support object types directly.

  • Removing tags and joining xml to a relational table

    db ver 11.2
    New to do the whole XML thing so trying hard to figure it out.
    I want to join from cdata value to a relational table
    the XML is
    <?xml version="1.0"?>
    <ROWSET>
    <ROW>
      <RN>1</RN>
      <EMP_ROW>
       <EMP_ROW_ROW>
        <FNAME>pete</FNAME>
        <ADDRESS>x1 rd</ADDRESS>
       </EMP_ROW_ROW>
       <EMP_ROW_ROW>
        <FNAME>pete</FNAME>
        <ADDRESS>x1 rd</ADDRESS>
       </EMP_ROW_ROW>
       <EMP_ROW_ROW>
        <FNAME>pete2</FNAME>
        <ADDRESS>x2 rd</ADDRESS>
       </EMP_ROW_ROW>
       <EMP_ROW_ROW>
        <FNAME>pete3</FNAME>
        <ADDRESS>x4 rd</ADDRESS>
       </EMP_ROW_ROW>
       <EMP_ROW_ROW>
        <FNAME>pete</FNAME>
       </EMP_ROW_ROW>
       <EMP_ROW_ROW>
        <FNAME>pete3</FNAME>
        <ADDRESS>x4 rd</ADDRESS>
       </EMP_ROW_ROW>
      </EMP_ROW>
    </ROW>
    <ROW>
      <RN>2</RN>
      <EMP_ROW>
       <EMP_ROW_ROW>
        <FNAME>pete</FNAME>
       </EMP_ROW_ROW>
      </EMP_ROW>
    </ROW>
    <ROW>
      <RN>3</RN>
      <EMP_ROW>
       <EMP_ROW_ROW>
        <FNAME>pete3</FNAME>
        <ADDRESS>x4 rd</ADDRESS>
       </EMP_ROW_ROW>
      </EMP_ROW>
    </ROW>
    <ROW>
      <RN>4</RN>
      <EMP_ROW>
       <EMP_ROW_ROW>
        <FNAME>pete4</FNAME>
        <ADDRESS>a str</ADDRESS>
       </EMP_ROW_ROW>
       <EMP_ROW_ROW>
        <FNAME>pete3</FNAME>
        <ADDRESS>b str</ADDRESS>
       </EMP_ROW_ROW>
      </EMP_ROW>
    </ROW>
    <ROW>
      <RN>5</RN>
      <EMP_ROW>
       <EMP_ROW_ROW>
        <FNAME>bob1</FNAME>
        <ADDRESS>c str</ADDRESS>
       </EMP_ROW_ROW>
      </EMP_ROW>
    </ROW>
    <ROW>
      <RN>6</RN>
      <EMP_ROW>
      </EMP_ROW>
    </ROW>
    <ROW>
      <RN>7</RN>
      <EMP_ROW>
      </EMP_ROW>
    </ROW>
    <ROW>
      <RN>8</RN>
      <EMP_ROW>
      </EMP_ROW>
    </ROW>
    <ROW>
      <RN>9</RN>
      <EMP_ROW>
      </EMP_ROW>
    </ROW>
    <ROW>
      <RN>10</RN>
      <EMP_ROW>
      </EMP_ROW>
    </ROW>
    <ROW>
      <RN>11</RN>
      <EMP_ROW>
      </EMP_ROW>
    </ROW>
    <ROW>
      <RN>12</RN>
      <EMP_ROW>
      </EMP_ROW>
    </ROW>
    <ROW>
      <RN>13</RN>
      <EMP_ROW>
      </EMP_ROW>
    </ROW>
    <ROW>
      <RN>14</RN>
      <EMP_ROW>
      </EMP_ROW>
    </ROW>
    <ROW>
      <RN>15</RN>
      <EMP_ROW>
      </EMP_ROW>
    </ROW>
    <ROW>
      <RN>16</RN>
      <EMP_ROW>
      </EMP_ROW>
    </ROW>
    <ROW>
      <RN>17</RN>
      <EMP_ROW>
      </EMP_ROW>
    </ROW>
    <ROW>
      <RN>18</RN>
      <EMP_ROW>
      </EMP_ROW>
    </ROW>
    <ROW>
      <RN>19</RN>
      <EMP_ROW>
      </EMP_ROW>
    </ROW>
    <ROW>
      <RN>20</RN>
      <EMP_ROW>
      </EMP_ROW>
    </ROW>
    </ROWSET>the relational table is:
    create table t(
    rn  number primary key
    with 20 rows 1 to 20the results should be in a relational table
    RN               XML
    1        <EMP_ROW>
              <EMP_ROW_ROW>
            <FNAME>pete</FNAME>
           <ADDRESS>x1 rd</ADDRESS>
         </EMP_ROW_ROW>
       <EMP_ROW_ROW>
        <FNAME>pete</FNAME>
        <ADDRESS>x1 rd</ADDRESS>
       </EMP_ROW_ROW>
       <EMP_ROW_ROW>
        <FNAME>pete2</FNAME>
        <ADDRESS>x2 rd</ADDRESS>
       </EMP_ROW_ROW>
         <EMP_ROW_ROW>
          <FNAME>pete3</FNAME>
          <ADDRESS>x4 rd</ADDRESS>
         </EMP_ROW_ROW>
         <EMP_ROW_ROW>
          <FNAME>pete</FNAME>
         </EMP_ROW_ROW>
         <EMP_ROW_ROW>
          <FNAME>pete3</FNAME>
          <ADDRESS>x4 rd</ADDRESS>
         </EMP_ROW_ROW>
        </EMP_ROW>
    2       <EMP_ROW>
       <EMP_ROW_ROW>
        <FNAME>pete</FNAME>
       </EMP_ROW_ROW>
      </EMP_ROW>I am wanting to join on the <RN> to the RN in the relational table.
    Been trying at this for a bit .. seems like xmltable and xquery should get me there but have problems.

    I guess since there are many and duplicate <RN> in the XML the function returns one row
    <RN>1</RN><RN>2</RN><RN>3</RN><RN>4</RN><RN>5</RN><RN>6</RN><RN>7</RN><RN>8</RN><RN>9</RN><RN>10</RN><RN>11</RN><RN>12</RN><RN>13</RN><RN>14</RN><RN>15</RN><RN>16</RN><RN>17</RN><RN>18</RN><RN>19</RN><RN>20</RN>     "<?xml version="1.0"?>
    <ROWSET>
    <ROW>
      <RN>1</RN>
      <EMP_ROW>
       <EMP_ROW_ROW>
        <FNAME>pete</FNAME>
        <ADDRESS>x1 rd</ADDRESS>
       </EMP_ROW_ROW>
       <EMP_ROW_ROW>
        <FNAME>pete</FNAME>
        <ADDRESS>x1 rd</ADDRESS>
       </EMP_ROW_ROW>
       <EMP_ROW_ROW>
        <FNAME>pete2</FNAME>
        <ADDRESS>x2 rd</ADDRESS>
       </EMP_ROW_ROW>
       <EMP_ROW_ROW>
        <FNAME>pete3</FNAME>
        <ADDRESS>x4 rd</ADDRESS>
       </EMP_ROW_ROW>
       <EMP_ROW_ROW>
        <FNAME>pete</FNAME>
       </EMP_ROW_ROW>
       <EMP_ROW_ROW>
        <FNAME>pete3</FNAME>
        <ADDRESS>x4 rd</ADDRESS>
       </EMP_ROW_ROW>
      </EMP_ROW>
    </ROW>
    <ROW>
      <RN>2</RN>
      <EMP_ROW>
       <EMP_ROW_ROW>
        <FNAME>pete</FNAME>
       </EMP_ROW_ROW>
      </EMP_ROW>
    </ROW>
    <ROW>
      <RN>3</RN>
      <EMP_ROW>
       <EMP_ROW_ROW>
        <FNAME>pete3</FNAME>
        <ADDRESS>x4 rd</ADDRESS>
       </EMP_ROW_ROW>
      </EMP_ROW>
    </ROW>
    <ROW>
      <RN>4</RN>
      <EMP_ROW>
       <EMP_ROW_ROW>
        <FNAME>pete4</FNAME>
        <ADDRESS>a str</ADDRESS>
       </EMP_ROW_ROW>
       <EMP_ROW_ROW>
        <FNAME>pete3</FNAME>
        <ADDRESS>b str</ADDRESS>
       </EMP_ROW_ROW>
      </EMP_ROW>
    </ROW>
    <ROW>
      <RN>5</RN>
      <EMP_ROW>
       <EMP_ROW_ROW>
        <FNAME>bob1</FNAME>
        <ADDRESS>c str</ADDRESS>
       </EMP_ROW_ROW>
      </EMP_ROW>
    </ROW>
    <ROW>
      <RN>6</RN>
      <EMP_ROW>
      </EMP_ROW>
    </ROW>
    <ROW>
      <RN>7</RN>
      <EMP_ROW>
      </EMP_ROW>
    </ROW>
    <ROW>
      <RN>8</RN>
      <EMP_ROW>
      </EMP_ROW>
    </ROW>
    <ROW>
      <RN>9</RN>
      <EMP_ROW>
      </EMP_ROW>
    </ROW>
    <ROW>
      <RN>10</RN>
      <EMP_ROW>
      </EMP_ROW>
    </ROW>
    <ROW>
      <RN>11</RN>
      <EMP_ROW>
      </EMP_ROW>
    </ROW>
    <ROW>
      <RN>12</RN>
      <EMP_ROW>
      </EMP_ROW>
    </ROW>
    <ROW>
      <RN>13</RN>
      <EMP_ROW>
      </EMP_ROW>
    </ROW>
    <ROW>
      <RN>14</RN>
      <EMP_ROW>
      </EMP_ROW>
    </ROW>
    <ROW>
      <RN>15</RN>
      <EMP_ROW>
      </EMP_ROW>
    </ROW>
    <ROW>
      <RN>16</RN>
      <EMP_ROW>
      </EMP_ROW>
    </ROW>
    <ROW>
      <RN>17</RN>
      <EMP_ROW>
      </EMP_ROW>
    </ROW>
    <ROW>
      <RN>18</RN>
      <EMP_ROW>
      </EMP_ROW>
    </ROW>
    <ROW>
      <RN>19</RN>
      <EMP_ROW>
      </EMP_ROW>
    </ROW>
    <ROW>
      <RN>20</RN>
      <EMP_ROW>
      </EMP_ROW>
    </ROW>
    </ROWSET>
    "

  • Retrieving data from a relational table and CLOB as a whole XML file

    I created the table lob_example and I have managed to insert XML document into it using XML SQL Utility. In this document I put contents of <DESCRIPTION> tag into CDATA section.
    LOB_EXAMPLE
    Name Null? Type
    ID NOT NULL NUMBER
    DESCRIPTION CLOB
    NAME VARCHAR2(40)
    But I could not retrieve this data properly. I can think of only one solution - to parse and build the whole XMLDocument. I found the suggestion of another solution to use Oracle8i views to do that in http://technet.oracle.com/tech/xml/infoocs/otnwp/about_oracle_xml_products.htm, but this text is not clear enough for me.
    I would like to quote the fragment from document mentioned above, which is ambiguous for me:
    "Combining XML Documents and Data Using Views
    Finally, if you have a combination of structured and unstructured XML data, but still want to view and operate on it as a whole, you can use Oracle8i views. Views enable you to construct an object on the "fly" by combining XML data stored in a variety of ways. So, you can store structured data (such as employee data, customer data, and so on) in one location within object -relational tables, and store related unstructured data (such as descriptions and comments) within a CLOB. When you need to retrieve the data as a whole, you simply construct the structure from the various pieces of data with the use of type constructors in the view's select statement. The XML SQL Utility then enables retrieving the constructed data from the view as a single XML document."
    The main question is - how to use type constructors in the view's select statement?

    Hello
    Sorry for asking the same question again, but any responses would be greatly appreciated.
    How to use type constructors in the view's select statement?
    I could not find any answers for this question on Technet. Maybe the other approaches are more efficient to combine the part of data from CLOB with data from other column types?
    Thank you

Maybe you are looking for