Array of XMLType

I'm getting the following error when attempting to cast an array of XMLType to OPAQUE[]:
java.sql.SQLException: Internal Error: makeJavaArray doesn't support type 2007
I was wondering if there were some smarter people out there that know whether or not I can do an array of XMLType through Java.
Thanks,
Joe
The type:
create or replace
type xml_tbl as table of xmltype;The procedure:
create or replace
procedure getXml_tbl(p_out out nocopy xml_tbl)
as
begin
select b bulk collect into p_out
from my_xml;
end;The method:
    public void getXmlTable(Connection conn) {
        //table of XMLType
        String sqlString =
            "begin getXml_tbl(?); end;"; //return a table of XMLType
        OracleCallableStatement cs = null;
        Connection dbConn = conn;
        oracle.sql.ARRAY rArray = null;
        OPAQUE[] op = null;
        System.out.print("statement string=" + sqlString + "\n");
        // Output: statement string=begin getXml_tbl(?); end;
        try {
            // Setup callable statement
            cs = (OracleCallableStatement)dbConn.prepareCall(sqlString);
            // Register out parameter of the proc
            cs.registerOutParameter(1, OracleTypes.ARRAY, "XML_TBL");
            // Execute callable statement
            cs.execute();
            // Shove the results from the callable statement into an oracle.sql.ARRAY
            rArray = cs.getARRAY(1);
            // Print out the type:
            System.out.println("rArray is of type: " +
                               rArray.getSQLTypeName());
            // Output: rArray is of type: JCHANCELLOR.XML_TBL
            // Print out the base type of the array:
            System.out.println("rArray's base type is: " +
                               rArray.getBaseType());
            // Output: rArray's base type is: 2007
            // Attempting to put the Array in something that can be read by Java
            // and then be used by xml:
            op = (OPAQUE[])rArray.getArray();
            // SQLException occurs:
            // Internal Error: makeJavaArray doesn't support type 2007
        } catch (SQLException e) {
            e.printStackTrace();
            System.out.println(e.getMessage());
        } finally {
            try {
                dbConn.close();
                cs.close();
            } catch (SQLException e) {
                e.printStackTrace();
                System.out.println(e.getMessage());
    }

Hi Joe
Did you find out a way to do this? Convert XMLTYpe array to a java array.
The solutions like trunign into a select statement won't work for me as i need to use a BULK COLLECT. This particular table contains more than a million rows.
Rgds
Ramraj

Similar Messages

  • SQLException "Expected 'EOF'" when extracting XMLType from ResultSet

    Hi,
    I am trying to implement a Java method that returns the nodes matching a given xpath expression. The query is working fine and the code is mostly working. The problem is getting the information out of an XmlType in Java.
    The query is as follows:
    ---8<--
    select extract(res, '/xdb:Resource/xdb:Contents'||:xpath,
    'xmlns:xdb="http://xmlns.oracle.com/xdb/XDBResource.xsd" '||:ns) node
    from resource_view
    where under_path(res, :path) = 1;
    ---8<--
    xpath = '//n:PostalCode'
    ns = 'xmlns:n="uri:cosmos:schema:company:1.0"'
    path = '/home/contactmgr'
    And the Java code:
    ---8<---
    resultSet = statement.executeQuery();
    while (resultSet.next())
    OPAQUE opaque = (OPAQUE) resultSet.getObject(1);
    if (opaque != null)
    XMLType myNode = XMLType.createXML(opaque);
    String testString = myNode.getStringVal();
    Document testDocument = myNode.getDOM();
    ---8<---
    The testString contains the expected result (messy, but workable), i.e. "<PostalCode xmlns="uri:cosmos:schema:company:1.0">GU1 4LY</PostalCode>\n<PostalCode xmlns="uri:cosmos:schema:company:1.0">TW18 4AQ</PostalCode>\n". These are the two postal codes in the first document.
    The call to myNode.getDOM() fails with an SQLException and a message of "Expected 'EOF'".
    I appreciate that the returned xml is a fragment and as such it shouldn't be possible to return an org.w3c.dom.Document instance. However, when I try using myNode.getDocumentFragment() I still get an SQLException but with no message or any other details.
    The method is currently expected to return a list of Nodes.
    Any ideas?

    The Oracle 10G XDB Developers Guide (http://download-west.oracle.com/docs/cd/B13789_01/appdev.101/b10790/xdb03usg.htm#sthref209) offers the following:
    "The extract() function returns the node or nodes that match the XPath expression. Nodes are returned as an instance of XMLType. The results of extract() can be either a document or DocumentFragment."
    To provide for the fact that an XPath expression may match multiple nodes in any given document, I modified the query to use xmlsequence(). This should then return an array of XmlType instances.
    --8<--
    select xmlsequence(extract(res, '/xdb:Resource/xdb:Contents'||?,
    'xmlns:xdb="http://xmlns.oracle.com/xdb/XDBResource.xsd"
    '||?)) nodes
    from resource_view
    where under_path(res, ?) = 1;
    --8<--
    The Java JDBC code then looks like this:
    --8<--
    OPAQUE[] myRawNodes = (OPAQUE[]) myResultSet.getArray(1).getArray();
    for (int i = 0; i < myRawNodes.length; i++)
    OPAQUE myOpaque = (OPAQUE) myRawNodes[ i ];
    if (myOpaque != null)
    XMLType myNode = XMLType.createXML(myOpaque);
    myCollection.add(myNode.getDOM());
    --8<--
    Testing this out however, I get the following exception:
    java.sql.SQLException: Internal Error: makeJavaArray doesn't support type 2007
    To re-iterate: my goal is to:
    a) evaluate an XPath expression that will return a list of nodes against all the documents under a particular path in the resource_view;
    b) extract all the returned nodes using JDBC; and
    c) return the collection of nodes to the caller.
    Any ideas?

  • Parsing XMLType into an associative array

    I'm try to build a procedure that can take an XMLType as a parameter. What I would like to do be able to extract both the node names and the string values from each tag of the XML and put them into basically a key --> value associative array.
    Ex:
    <envelope>
    <node1>value1</node1>
    <node2>value2</node2>
    </envelope>
    Would be put into an array structured like: array['node1'] = 'value1', array['node2'] = 'value2', etc.
    I'm not entirely sure how I go about looping through the XMLType and extracting each node name and its value. I'm not worried about repeating tag names.. I know that will not be an issue in any of the XMLTypes that I'm using.
    Would anyone be able to offer any suggestions? If not how to go about doing exactly that, then at least some insight as to how I can loop through and extract nodes and/or values without specifying the specific XPaths?
    Thanks in advance!

    Hi Roger,
    This is a good description of your process. Just add your Oracle DB Version somewhere. Want you want is a method to map your XML to a relationship design (some special variant of object-relational-modelling).
    I still see two choices:
    The programmatic approach (as you described):
    Have multiple procedures where you input an XML. Each procedure is reflecting a different part of the transformation process. So it depends from the Message which procedure you will call.
    Example
    SQL*Plus: Release 9.2.0.2.0 - Production on Thu Aug 14 17:53:25 2008
    Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.
    Connected to:
    Oracle9i Enterprise Edition Release 9.2.0.8.0 - 64bit Production
    With the Partitioning, OLAP and Oracle Data Mining options
    JServer Release 9.2.0.8.0 - Production
    SQL> create table testtab (username varchar2(100));
    Table created.
    /* the following insert part should be in some packaged procedure, */
    /* this just don't work on my 9i version, but should in 10g  */
    SQL> insert into testtab (username)
      2  select substr(extractvalue(column_value,'*/text()'),1,100)
      3  from table(xmlsequence(extract( xmltype('<envelope>'||
      4               '<username>Roger</username>'||
      5               '<username>Sven</username>'||
      6               '</envelope>'),'envelope/username')));
    2 rows created.
    SQL> select * from testtab;
    USERNAME
    Roger
    Sven
    SQL> The declarative approach:
    Insert the XML into a SchemaBased Table. The XML Schema will provide the mapping to your relational tables automagically. Problem here is the writing, handling and evolving of the XML Schema (Sub schemas are allowed too).

  • [Oracle 11g] Store filename as VARCHAR2 and its content as XMLType

    Hi all,
    The version of Oracle used is 11.2.0.3.0.
    I would like to load a XML file into a table from AIX with a Shell script.
    Here is the test case table:
    ALTER  TABLE mytable DROP PRIMARY KEY CASCADE;
    DROP   TABLE mytable CASCADE CONSTRAINTS;
    CREATE TABLE mytable (
       filename VARCHAR2 (50 BYTE),
       created DATE,
       content SYS.XMLTYPE,
       CONSTRAINT pk_mytable PRIMARY KEY (filename) USING INDEX
    XMLTYPE content STORE AS BINARY XML;The problem is to store the the file name too.
    So I add a step to create the control file from a generic one like this:
    #!/bin/ksh
    FILES=$(sample.xml)
    CTL=generic.CTL
    for f in $FILES
    do
        cat $CTL | sed -e "s/:FILE/$f/g" > $f.ctl
        sqlldr scott/tiger@mydb control=$f.ctl data=$f
        rc=$?
        echo "Return code: $rc."
    doneThe filename and the data are stored in the table, but I get this error message after executing the Shell script:
    SQL*Loader: Release 11.2.0.3.0 - Production on Mon Jun 11 13:42:21 2012
    Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.
    SQL*Loader-275: Data is in control file but "INFILE *" has not been specified.
    Commit point reached - logical record count 64And here is the content of the log file:
    SQL*Loader: Release 11.2.0.3.0 - Production on Mon Jun 11 14:13:43 2012
    Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.
    SQL*Loader-275: Data is in control file but "INFILE *" has not been specified.
    Control File:   sample.ctl
    Data File:      sample.xml
      Bad File:     sample.bad
      Discard File:  none specified
    (Allow all discards)
    Number to load: ALL
    Number to skip: 0
    Errors allowed: 50
    Bind array:     64 rows, maximum of 256000 bytes
    Continuation:    none specified
    Path used:      Conventional
    Table MYTABLE, loaded from every logical record.
    Insert option in effect for this table: APPEND
       Column Name                  Position   Len  Term Encl Datatype
    FILENAME                                                  CONSTANT
        Value is 'sample.xml'
    CONTENT                           DERIVED     *  EOF      CHARACTER
        Dynamic LOBFILE.  Filename in field FILENAME
    Record 2: Rejected - Error on table MYTABLE.
    ORA-00001: unique constraint (PK_MYTABLE) violated
    Record 3: Rejected - Error on table MYTABLE.
    ORA-00001: unique constraint (PK_MYTABLE) violated
    Record 4: Rejected - Error on table MYTABLE.
    ORA-00001: unique constraint (PK_MYTABLE) violated
    Record 5: Rejected - Error on table MYTABLE.
    ORA-00001: unique constraint (PK_MYTABLE) violated
    and so on...
    Record 52: Rejected - Error on table MYTABLE.
    ORA-00001: unique constraint (PK_MYTABLE) violated
    MAXIMUM ERROR COUNT EXCEEDED - Above statistics reflect partial run.
    Table MYTABLE:
      1 Row successfully loaded.
      51 Rows not loaded due to data errors.
      0 Rows not loaded because all WHEN clauses were failed.
      0 Rows not loaded because all fields were null.
    Space allocated for bind array:                   1664 bytes(64 rows)
    Read   buffer bytes: 1048576
    Total logical records skipped:          0
    Total logical records read:            64
    Total logical records rejected:        51
    Total logical records discarded:        0
    Run began on Mon Jun 11 14:13:43 2012
    Run ended on Mon Jun 11 14:13:43 2012
    Elapsed time was:     00:00:00.23
    CPU time was:         7586:56:08.38It seems that the control file try to insert as many rows than the number of lines in the file sample.xml !!!
    So, I cannot check if load is done correctly since return code is allways 2!
    Is it the correct way to solve my problem ?
    What can I do to get it better ?

    Another question !
    Here is an other way of doing it.
    #!/bin/ksh
    FILEPATH=./data/sample.xml
    FILENAME=$(basename ${FILEPATH})
    CTLFILE=load_data.ctl
    cat > ${CTLFILE} <<EOF
    LOAD DATA
    INFILE *
    INTO TABLE mytable APPEND
        filename CONSTANT "${FILEPATH}",
        created "SYSDATE",
        content LOBFILE (filename) TERMINATED BY EOF
    BEGINDATA
    ${FILEPATH}
    EOF
    sqlldr scott/tiger@mydb control=${CTLFILE}
    rc=$?
    echo "Return code: $rc."I've tested this script, it's okay.
    Now I want to store the basename of the file : ${FILENAME}.
    How can I do that ?
    The problem is that I can no more write "LOBFILE (filename)" because it does not point to the correct path of the file !!!
    Someone can help me please ?
    Thanks.

  • Require help on Array of Nested tables and Oracle Object type

    Hi All,
    I have a scenario where I have some millions of records received from a flat file and the record is stored in Table as below:
    Tablename: FILE_RECORD
    Rows:
    FILE_REG_ID = 1
    RECORD_NBR = 1     
    PROCESSED_IND = U
    RECORD= 00120130326006A
    FILE_REG_ID = 1
    RECORD_NBR = 2     
    PROCESSED_IND = U
    RECORD= 00120130326003
    1) I have to read these records at once and
    a) Split the RECORD column to get various other data Eg: Fld1=001, Fld2=20130326, Fld3 = 003
    b) send as an Array to Java.
    2) Java will format this into XML and sent to other application.
    3) The other application returns a response as Successful or Failure to Java in XML
    4) Java will send RECORD_NBR and the corresponding response as Success or Failure back to PLSQL
    5) PLSQL should match the RECORD_NBR and update the PROCESSED_IND = P.
    I 'm able to achieve this using SQL Table type by creating a TYPE for Each of the fields (Flds) however the problem is Java cannot Access the parameters as the TYPE are of COLUMN Types
    Eg: For RECORD_NBR
    SUBTYPE t_record_nbr IS FILE_RECORD.T010_RECORD_NBR%TYPE;
    Can you please let me know how I can achieve this to support Java, I know one way that is by creating an OBJECT TYPE and a TABLE of the OBJECT TYPE.
    Eg: T_FILE_RECORD_REC IS OBJECT
    FILE_REG_ID number(8), RECORD_NBR number (10), PROCESSED_IND varchar2(1), RECORD varchar(20)
    Create type T_FILE_RECORD_TAB IS TABLE OF T_FILE_RECORD_REC
    However I'm facing a problem to populate an Array of records, I know I'm missing something important. Hence please help.
    It would be helpful to provide some guidelines and suggestions or Pseudo or a Code to achieve this. Rest all I can take up further.
    Thanks in advance,

    I know once way that is creating a OBJECT TYPE and a TABLE of OBJECT TYPE, howeve I feel I'm missing something to achieve this.You're right, you need SQL object types created at the database level. Java doesn't know about locally defined PL/SQL types
    However you can do without all this by creating the XML directly in PL/SQL (steps 1+2) and passing the document to Java as XMLType or CLOB.
    Are you processing the records one at a time?

  • Range partitioning on virtual column based on binary xmltype column

    Alright, our DBA finally got around to upgrading to 11.2.0.2. Now I'm running into another issue:
    CREATE TABLE USER.DI_D2
        ID NUMBER(19, 0) NOT NULL ,
        XML SYS.XMLTYPE ,
        PRIMARY KEY ( ID )
      XMLTYPE XML STORE AS SECUREFILE BINARY XML
      VIRTUAL COLUMNS
        ts AS (TO_TIMESTAMP(extractvalue(xml,'/d:d/c:dHeader/c:creationTime',
            'xmlns:d="http://www.example.com/m/d/schema/di"
             xmlns:c="http://www.example.com/m/schema/common"'),'YYYY-MM-DD"T"HH24:MI:SS'))
      PARTITION BY RANGE (ts)
        PARTITION d_p2012_07 VALUES LESS THAN (TO_DATE('1-8-2012','DD-MM-YYYY')),
        PARTITION d_px VALUES LESS THAN (MAXVALUE)
      );On our old 11.2.0.1 install this command works fine (tho due to other issues 11.2.0.1 doesn't work for our search queries)
    On our 11.2.0.2 install, I get the following error:
    Error at Command Line:10 Column:37
    Error report:
    SQL Error: ORA-14513: Partitiekolom mag niet van het gegevenstype object zijn.
    14513. 00000 -  "partitioning column may not be of object datatype"
    *Cause:    Partitioning column specified by the user was an object datatype
               (object, REF, nested table, array) which is illegal.
    *Action:   Ensure that no partitioning column is an object datatype.Anyone know what's up with that? What changed between the 2 DB versions that could cause this to fail?

    Alright, seems that's just a display issue then.
    Looking in user_lobs like suggested above gives
    TABLE_NAME COLUMN_NAME SECUREFILE
    DI_D       XMLDATA     YES        I was opening the table in SQL Developer and then looking in the tab SQL (12th tab); with a XmlType table it seems to always show Basicfile even if it's actually a Securefile.
    I'd like to use the suggested xmlcast/xmlquery solution, however it doesn't seem to play well with our custom timestamp format.
    "CREATION_TIME" AS (XMLCAST(XMLQUERY('declare default element namespace "http://www.example.com/m/d/schema/i";declare namespace c="http://www.example.com/m/schema/common";/d/c:dHeader/c:creationTime' PASSING OBJECT_VALUE RETURNING CONTENT) AS TIMESTAMP))
    Error at Command Line:1 Column:0
    Error report:
    SQL Error: ORA-54002: In de uitdrukking van een virtuele kolom kunnen alleen zuivere functies worden opgegeven.
    "CREATION_TIME" AS (TO_TIMESTAMP(XMLQUERY('declare default element namespace "http://www.example.com/m/d/schema/i";declare namespace c="http://www.example.com/m/schema/common";/d/c:dHeader/c:creationTime' PASSING OBJECT_VALUE RETURNING CONTENT),'YYYY-MM-DD"T"HH24:MI:SS'))
    Error at Command Line:9 Column:45
    Error report:
    SQL Error: ORA-00932: inconsistente gegevenstypen: - verwacht, - gekregen
    00932. 00000 -  "inconsistent datatypes: expected %s got %s"
    *Cause:   
    *Action:
    "CREATION_TIME" AS (TO_TIMESTAMP(EXTRACTVALUE("OBJECT_VALUE",'/di:d/c:dHeader/c:creationTime','xmlns:di="http://www.example.com/m/d/schema/i" xmlns:c="http://www.example.com/m/schema/common"'),'YYYY-MM-DD"T"HH24:MI:SS'))
    table "USER"."DI_D" created.

  • Insert data into the xml schema-based xmltype table problem!

    Hello, there,
    I got problem in inserting data into the xmltype table after registered XML schema and created table. details see below:
    1) xml schema:
    <?xml version="1.0" encoding="UTF-8"?>
    <!-- edited with XMLSpy v2007 sp2 (http://www.altova.com) by Constantin Ilea (EMERGIS INC) -->
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.emergis.com/eHealth/EHIP/data/meta/profile:v1" targetNamespace="http://www.emergis.com/eHealth/EHIP/data/meta/profile:v1" elementFormDefault="qualified">
         <!-- ************** PART I: BEGIN SIMPLE OBJECT TYPE DEFINITIONS ********************************** -->
         <xs:simpleType name="RoutingType">
              <xs:restriction base="xs:string">
                   <xs:enumeration value="Synch"/>
                   <xs:enumeration value="Asynch"/>
              </xs:restriction>
         </xs:simpleType>
         <xs:simpleType name="StatusType">
              <xs:restriction base="xs:string">
                   <xs:enumeration value="ACTIVE"/>
                   <xs:enumeration value="VOID"/>
                   <xs:enumeration value="PENDING"/>
              </xs:restriction>
         </xs:simpleType>
         <xs:simpleType name="SenderApplicationType">
              <xs:restriction base="xs:string">
                   <xs:enumeration value="PR"/>
                   <xs:enumeration value="CR"/>
                   <xs:enumeration value="POS"/>
                   <xs:enumeration value="CPP"/>
                   <xs:enumeration value="Other"/>
              </xs:restriction>
         </xs:simpleType>
         <xs:simpleType name="ServiceTypeType">
              <xs:restriction base="xs:string">
                   <xs:enumeration value="IS"/>
                   <xs:enumeration value="WS"/>
              </xs:restriction>
         </xs:simpleType>
         <xs:simpleType name="RouteDirect">
              <xs:restriction base="xs:string">
                   <xs:enumeration value="Request"/>
                   <xs:enumeration value="Reply"/>
                   <xs:enumeration value="None"/>
              </xs:restriction>
         </xs:simpleType>
         <xs:simpleType name="Indicator">
              <xs:annotation>
                   <xs:documentation>can we also change the value to "ON" and "OFF" instead? in this way this cn be shared by all type of switch indicator</xs:documentation>
              </xs:annotation>
              <xs:restriction base="xs:string">
                   <xs:enumeration value="YES"/>
                   <xs:enumeration value="NO"/>
              </xs:restriction>
         </xs:simpleType>
         <xs:simpleType name="RuleType">
              <xs:restriction base="xs:string">
                   <xs:enumeration value="ControlAct"/>
                   <xs:enumeration value="WSPolicy"/>
                   <xs:enumeration value="AccessControl"/>
                   <xs:enumeration value="Certification"/>
                   <xs:enumeration value="MessageConformance"/>
                   <xs:enumeration value="Variant"/>
                   <xs:enumeration value="Routing"/>
              </xs:restriction>
         </xs:simpleType>
         <xs:simpleType name="HL7Result">
              <xs:restriction base="xs:string">
                   <xs:enumeration value="ACCEPT"/>
                   <xs:enumeration value="REFUSE"/>
                   <xs:enumeration value="REJECT"/>
                   <xs:enumeration value="ACK"/>
              </xs:restriction>
         </xs:simpleType>
         <xs:simpleType name="IIPType">
              <xs:restriction base="xs:string">
                   <xs:enumeration value="PUT"/>
                   <xs:enumeration value="GET/LIST"/>
                   <xs:enumeration value="NOTIF"/>
              </xs:restriction>
         </xs:simpleType>
         <xs:simpleType name="ProfileTypeType">
              <xs:restriction base="xs:string">
                   <xs:enumeration value="IIPProfile"/>
                   <xs:enumeration value="BizOperationProfile"/>
                   <xs:enumeration value="OrchestrationProfile"/>
                   <xs:enumeration value="DomainObjectProfile"/>
                   <xs:enumeration value="ServiceProfile"/>
                   <xs:enumeration value="ExceptionProfile"/>
                   <xs:enumeration value="CustomizedProfile"/>
                   <xs:enumeration value="SystemProfile"/>
                   <xs:enumeration value="HL7XMLSchemaProfile"/>
                   <xs:enumeration value="EnricherParametersProfile"/>
              </xs:restriction>
         </xs:simpleType>
         <xs:simpleType name="ParameterType">
              <xs:restriction base="xs:string">
                   <xs:enumeration value="String"/>
                   <xs:enumeration value="Object"/>
                   <xs:enumeration value="Number"/>
                   <xs:enumeration value="Document"/>
              </xs:restriction>
         </xs:simpleType>
         <!-- ************** PART I: END SIMPLE OBJECT TYPE DEFINITIONS ********************************** -->
         <!-- ************** PART II: BEGIN COMPLEX OBJECT TYPE DEFINITIONS ********************************** -->
         <!-- *********************** begin new added objects, by rshan *************************************** -->
         <xs:complexType name="ProfileType">
              <xs:annotation>
                   <xs:documentation>
              1.Profile IS USED TO BE AN WRAPPER ELEMENT FOR ALL KIND OF PROFILES NO MATTER WHAT KIND OF PROFILE IT IS
              2.ProfileID used to uniquely identify the current profile
              3.ProfileData used to hold all the necessary profile related data
              </xs:documentation>
              </xs:annotation>
              <xs:sequence>
                   <xs:element name="ProfileID" type="ProfileIDType">
                        <xs:annotation>
                             <xs:documentation>this will hold all the common attributes, espically the global unique identifier to the profile, no matter what type of profile is</xs:documentation>
                        </xs:annotation>
                   </xs:element>
                   <xs:element name="ProfileData" type="ProfileDataType">
                        <xs:annotation>
                             <xs:documentation>all the non-common profile meta data that attached to each specific profile type such as IIPProfile, OrchestrationProfile, and BizOperationProfile will be placed here</xs:documentation>
                        </xs:annotation>
                   </xs:element>
              </xs:sequence>
         </xs:complexType>
         <xs:complexType name="ProfileIDType">
              <xs:annotation>
                   <xs:documentation>global unique identifier and all the common attributes across all different profiles, the @ID and @Type together will be used as the primary key to identify the profile data</xs:documentation>
              </xs:annotation>
              <xs:attribute name="ID" type="xs:ID" use="required">
                   <xs:annotation>
                        <xs:documentation>ID is the global unique identifier to the profile, no matter what type of profile it is</xs:documentation>
                   </xs:annotation>
              </xs:attribute>
              <xs:attribute name="Name"/>
              <xs:attribute name="Description"/>
              <xs:attribute name="Version">
                   <xs:annotation>
                        <xs:documentation>version of the profile data</xs:documentation>
                   </xs:annotation>
              </xs:attribute>
              <xs:attribute name="Type" type="ProfileTypeType" use="required">
                   <xs:annotation>
                        <xs:documentation>value to identify the ProfileType type within
                        IIPProfile,BizOperationProfile,OrchestrationProfile,DomainObjectProfile
                        ServiceProfile,ExceptionProfile,SystemProfile,HL7XMLSchemaProfile,
                        EnricherParametersProfile,CustomizedProfile
                        </xs:documentation>
                   </xs:annotation>
              </xs:attribute>
              <xs:attribute name="Status" type="StatusType" default="ACTIVE">
                   <xs:annotation>
                        <xs:documentation>used to show the related profile data status like "ACTIVE","PENDING","VOID"...</xs:documentation>
                   </xs:annotation>
              </xs:attribute>
              <!--
              <xs:sequence>
                   <xs:element name="ProfileReference" type="ProfileIDType" minOccurs="0" maxOccurs="unbounded">
                        <xs:annotation>
                             <xs:documentation>this will be the place to hold the integrity relationship with other profiles like foreign key if existed and necessary to show up</xs:documentation>
                        </xs:annotation>
                   </xs:element>
              </xs:sequence>
              -->
         </xs:complexType>
         <xs:complexType name="ProfileDataType">
              <xs:annotation>
                   <xs:documentation>meta data associated tightly to each specific type of profile</xs:documentation>
              </xs:annotation>
              <xs:choice>
                   <xs:element name="EnricherParametersProfileData" type="EnricherParametersDataType">
                        <xs:annotation>
                             <xs:documentation>Enricher Parameters related profile data
                   1. one instance of this type may contains all the related System metadata.
                   2. idType part may use to identify different version/release/status
                   </xs:documentation>
                        </xs:annotation>
                   </xs:element>
                   <xs:element name="ExtendProfileData" type="ExtendProfileDataType">
                        <xs:annotation>
                             <xs:documentation>If needed, any profile data not defined within the current release scope can be added here </xs:documentation>
                        </xs:annotation>
                   </xs:element>
              </xs:choice>
         </xs:complexType>
         <xs:complexType name="ExtendProfileDataType">
              <xs:sequence>
                   <xs:element name="ExtendProfile" type="xs:anyType" minOccurs="0"/>
              </xs:sequence>
         </xs:complexType>
         <xs:complexType name="EnricherParametersDataType">
              <xs:sequence>
                   <xs:element name="EnricherParameter" type="EnricherParameter" maxOccurs="unbounded"/>
              </xs:sequence>
         </xs:complexType>
         <xs:complexType name="EnricherParameter">
              <xs:sequence>
                   <xs:element ref="Enricher"/>
              </xs:sequence>
              <xs:attribute name="serviceName" type="xs:string" use="required"/>
              <xs:attribute name="interactionID" type="xs:string"/>
         </xs:complexType>
         <xs:element name="Enricher">
              <xs:annotation>
                   <xs:documentation>Comment describing your root element</xs:documentation>
              </xs:annotation>
              <xs:complexType>
                   <xs:sequence>
                        <xs:element name="Parameters" type="Parameters"/>
                        <xs:element ref="Section" maxOccurs="unbounded"/>
                   </xs:sequence>
              </xs:complexType>
         </xs:element>
         <xs:complexType name="ValueType">
              <xs:attribute name="field" use="required"/>
              <xs:attribute name="value"/>
              <xs:attribute name="action"/>
         </xs:complexType>
         <xs:element name="Section">
              <xs:complexType>
                   <xs:sequence>
                        <xs:element name="Value" type="ValueType" minOccurs="0" maxOccurs="unbounded"/>
                        <xs:element ref="Section" minOccurs="0" maxOccurs="unbounded"/>
                   </xs:sequence>
                   <xs:attribute name="path" use="required"/>
              </xs:complexType>
         </xs:element>
         <xs:complexType name="Parameters">
              <xs:sequence>
                   <xs:element name="Parameter" minOccurs="0" maxOccurs="unbounded">
                        <xs:complexType>
                             <xs:attribute name="name" use="required"/>
                             <xs:attribute name="reference"/>
                        </xs:complexType>
                   </xs:element>
              </xs:sequence>
         </xs:complexType>
         <xs:complexType name="RuleList">
              <xs:annotation>
                   <xs:documentation>an array of rules</xs:documentation>
              </xs:annotation>
              <xs:sequence>
                   <xs:element name="Rule" type="RuleProfile" minOccurs="0" maxOccurs="unbounded"/>
              </xs:sequence>
         </xs:complexType>
         <xs:complexType name="RuleProfile">
              <xs:attribute name="RName" use="required"/>
              <xs:attribute name="RType" type="RuleType" use="required"/>
              <xs:attribute name="Status" default="ON">
                   <xs:annotation>
                        <xs:documentation>By default is ON (or if is missing)</xs:documentation>
                   </xs:annotation>
              </xs:attribute>
              <xs:attribute name="Order"/>
              <xs:attribute name="Direction" type="RouteDirect">
                   <xs:annotation>
                        <xs:documentation>Request / Reply</xs:documentation>
                   </xs:annotation>
              </xs:attribute>
         </xs:complexType>
         <!-- ************** PART II: END COMPLEX OBJECT TYPE DEFINITIONS *********************************** -->
         <!-- ************** PART III: BEGIN ROOT ELEMENTS DEFINITIONS ********************************* -->
         <!-- 0) Profile wrapper root element
    Profile IS USED TO BE AN WRAPPER ELEMENT FOR ALL KIND OF PROFILES NO MATTER WHAT KIND OF PROFILE IT IS
    -->
         <xs:element name="Profile" type="ProfileType">
              <xs:annotation>
                   <xs:documentation>Profile IS USED TO BE AN WRAPPER ELEMENT FOR ALL KIND OF PROFILES NO MATTER WHAT KIND OF PROFILE IT IS</xs:documentation>
              </xs:annotation>
         </xs:element>
    </xs:schema>
    2)register xml schema:
    SQL> begin
    2 dbms_xmlschema.registerSchema
    3 (
    4 schemaurl=>'http://rac3-1-vip:8080/home/'||USER||'/xsd/EHIPProfile_v00.xsd',
    5 schemadoc=>xdbURIType('/home/'||USER||'/xsd/EHIPProfile_v00.xsd').getClob(),
    6 local=>True,
    7 gentypes=>True,
    8 genbean=>False,
    9 gentables=>False
    10 );
    11 End;
    12 /
    PL/SQL procedure successfully completed.
    SQL>
    SQL>
    3) xml data:
    <?xml version="1.0" encoding="UTF-8"?>
    <!--Sample XML file generated by XMLSpy v2007 sp2 (http://www.altova.com)-->
    <Profile xmlns="http://www.emergis.com/eHealth/EHIP/data/meta/profile:v1">
         <ProfileID Type="EnricherParametersProfile" Status="ACTIVE" ID="EnricherPP.ID.0001" Name="EnricherPP.ID.0001" Description="EnricherPP.ID.0001" Version="01"/>
         <ProfileData>
              <EnricherParametersProfileData>
                   <EnricherParameter serviceName="LRS_BusinessDomainObject.lrs.businessDomainObject.domainObjectBuilder.concrete.ExceptionCreators:createExceptionV50CategoryCanonicalPart" interactionID="">
                   <Enricher>
                        <Parameters>
                             <Parameter name="MESSAGE_ID" reference="test"/>
                        </Parameters>
                        <Section path="HEADER">
                             <Section path="RESPONSE_TYPE">
                                  <Value field="value" value="I"/>
                             </Section>
                             <Section path="HL7_STANDARD_VERSION">
                                  <Value field="value" value="HL7V3"/>
                             </Section>
                             <Section path="DESIRED_ACKNOWLEDGMENT_TYPE">
                                  <Value field="value" value="NE"/>
                             </Section>
                             <Section path="SENDING_NETWORK_ADDRESS">
                                  <Value field="value" value=""/>
                             </Section>
                             <Section path="SENDING_APPLICATION_IDENTIFIER">
                                  <Value field="root" value="2.16.840.1.113883.3.133.1.3"/>
                                  <Value field="extension" value=""/>
                             </Section>
                             <Section path="SENDING_APPLICATION_NAME">
                                  <Value field="value" value="NL HIAL"/>
                             </Section>
                        </Section>
                   </Enricher>
         </EnricherParameter>
              <EnricherParameter serviceName="LRS_BusinessDomainObject.lrs.businessDomainObject.domainObjectBuilder.concrete.DomainObjectCreators:createFindClientsAssociatedIdentifersRequestObject" interactionID="PRPA_IN101105CA">
                   <Enricher>
                        <Parameters>
                             <Parameter name="MESSAGE_ID" reference="test"/>
                        </Parameters>
                        <Section path="HEADER">
                             <Section path="RESPONSE_TYPE">
                                  <Value field="value" value="I"/>
                             </Section>
                             <Section path="HL7_STANDARD_VERSION">
                                  <Value field="value" value="HL7V3"/>
                             </Section>
                             <Section path="PROCESSING_CODE">
                                  <Value field="value" value="T"/>
                             </Section>
                             <!--
                             <Section path="PROCESSING_MODE_CODE">
                                  <Value field="value" value="T"/>
                             </Section>
                             -->                         
                             <Section path="DESIRED_ACKNOWLEDGMENT_TYPE">
                                  <Value field="value" value="NE"/>
                             </Section>
                             <Section path="RECEIVER_NETWORK_ADDRESS">
                                  <Value field="value" value="prsunew.moh.hnet.bc.ca"/>
                             </Section>
                             <Section path="RECEIVER_APPLICATION_IDENTIFIER">
                                  <Value field="root" value="2.16.840.1.113883.3.40.5.1"/>
                                  <Value field="extension" value=""/>
                             </Section>
                             <Section path="SENDING_NETWORK_ADDRESS">
                                  <Value field="value" value=""/>
                             </Section>
                             <Section path="SENDING_APPLICATION_IDENTIFIER">
                                  <Value field="root" value="2.16.840.1.113883.3.133.1.3"/>
                                  <Value field="extension" value=""/>
                             </Section>
                             <Section path="SENDING_APPLICATION_NAME">
                                  <Value field="value" value="NL HIAL"/>
                             </Section>
                        </Section>
                   </Enricher>
         </EnricherParameter>
              <EnricherParameter serviceName="LRS_BusinessDomainObject.lrs.businessDomainObject.domainObjectBuilder.concrete.DomainObjectContentEnrichers:enrichPRRequest" interactionID="">
    <!--Sample XML file generated by XMLSpy v2007 sp2 (http://www.altova.com)-->
    <Enricher>
         <Parameters>
              <Parameter name="MESSAGE_IDENTIFIER" reference="test"/>
         </Parameters>
         <Section path="HEADER">
              <Section path="HL7_STANDARD_VERSION">
                   <Value field="value" value="V3PR2"/>
              </Section>
              <!--POS/CPP populated ?-->
              <!--Not sure if this should be set as a variance within EHIP or if we expect the POS/CPP to provide this value-->
              <Section path="PROCESSING_CODE">
                   <Value field="value" value="T"/>
              </Section>
              <!--POS/CPP populated ?-->
              <Section path="PROCESSING_MODE_CODE">
                   <Value field="value" value="T"/>
              </Section>
              <!--POS/CPP populated ?-->
              <Section path="DESIRED_ACKNOWLEDGMENT_TYPE">
                   <Value field="value" value="NE"/>
              </Section>
              <!-- note:We Expect PRS to give us a web service address -->                    
              <!--<Section path="RECEIVER_NETWORK_ADDRESS">
                   <Value field="value" value="_http://PRSServer/svcName"/>
              </Section>
              -->
              <Section path="RECEIVER_APPLICATION_IDENTIFIER[0]">
                   <Value field="root" value="2.16.840.1.113883.3.40.1.14"/>
                   <Value field="extension" value="SIT1"/>
              </Section>
              <!-- note: values of the fields to be provided by PRS -->
              <Section path="RECEIVER_APPLICATION_NAME[0]">
                   <Value field="value" value="receiverAppName"/>
              </Section>
              <!-- note: RECEIVER_ORGANIZATION has an extra trailing space, as in the Excel mapping spreadsheet -->
              <!-- note: values of the fields to be specified by PRS later -->
              <Section path="RECEIVER_AGENT/RECEIVER_ORGANIZATION/RECEIVER_ORGANIZATION_IDENTIFIER[0]">
                   <Value field="root" value="2.16.840.1.113883.3.40.4.1"/>
                   <Value field="extension" value="receiverOrgId"/>
              </Section>
              <Section path="SENDING_APPLICATION_NAME[0]">
                   <Value field="value" value="NLPRSCLNT"/>
              </Section>
              <!-- note: SENDING_ORGANIZATION has an extra trailing space, as in the Excel mapping spreadsheet -->
              <!-- note: values of the fields to be specified by PRS later -->
              <Section path="SENDING_AGENT/SENDING_ORGANIZATION/SENDING_ORGANIZATION_IDENTIFIER[0]">
                   <Value field="root" value="2.16.840.1.113883.4.3.57"/>
                   <Value field="extension" value="3001"/>
              </Section>
              <Section path="PERFORMER/HEALTHCARE_WORKER_IDENTIFIER[0]">
                   <Value field="root" value="2.16.840.1.113883.4.3.57"/>
                   <Value field="extension" value="HIAL_USR"/>
              </Section>          
         </Section>
         <Section path="PAYLOAD">
              <!--<Section path="QUERY_STATUS_CODE">
                   <Value field="value" value="New"/>
              </Section>-->
              <!-- note: AUDIT has an extra trailing space, as in the Excel mapping spreadsheet -->
              <Section path="AUDIT[0]/AUDIT_INFORMATION">
                   <Value field="code" value="LATEST"/>
                   <Value field="codeSystem" value="PRSAuditParameters"/>
              </Section>
              <!-- note: CONFIDENCE has an extra trailing space, as in the Excel mapping spreadsheet -->
              <Section path="CONFIDENCE/CONFIDENCE_VALUE">
                   <Value field="value" value="100"/>
              </Section>
              <!-- note: HISTORY has an extra trailing space, as in the Excel mapping spreadsheet -->
              <Section path="HISTORY/INCLUDE_HISTORY_INDICATOR">
                   <Value field="value" value="false"/>
              </Section>
              <!-- note: JURISDICTION has an extra trailing space, as in the Excel mapping spreadsheet -->
              <Section path="JURISDICTION/JURISDICTION_TYPE">
                   <Value field="value" value="NL"/>
              </Section>
              <!-- note: RESPONSE_OBJECT has an extra trailing space, as in the Excel mapping spreadsheet -->
              <Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[0]">
                   <Value field="code" value="GRS_ADDRESS"/>
              </Section>
              <Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[1]">
                   <Value field="code" value="GRS_ELECTRONIC_ADDRESS"/>
              </Section>
              <Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[2]">
                   <Value field="code" value="GRS_IDENTIFIER"/>
              </Section>
              <Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[3]">
                   <Value field="code" value="GRS_ORGANIZATION_NAME"/>
              </Section>
              <Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[4]">
                   <Value field="code" value="GRS_PERSONAL_NAME"/>
              </Section>
              <Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[5]">
                   <Value field="code" value="GRS_REGISTRY_IDENTIFIER"/>
              </Section>
              <Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[6]">
                   <Value field="code" value="GRS_TELEPHONE"/>
              </Section>
              <Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[7]">
                   <Value field="code" value="PRS_CONDITION"/>
              </Section>
              <Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[8]">
                   <Value field="code" value="PRS_CONFIDENTIALITY_INDICATOR"/>
              </Section>
              <Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[9]">
                   <Value field="code" value="PRS_DEMOGRAPHIC_DETAIL"/>
              </Section>
              <Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[10]">
                   <Value field="code" value="PRS_DISCIPLINARY_ACTION"/>
              </Section>
              <Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[11]">
                   <Value field="code" value="PRS_INFORMATION_ROUTE"/>
              </Section>
              <Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[12]">
                   <Value field="code" value="PRS_NOTE"/>
              </Section>
              <Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[13]">
                   <Value field="code" value="PRS_PROVIDER_CREDENTIAL"/>
              </Section>
              <Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[14]">
                   <Value field="code" value="PRS_PROVIDER_EXPERTISE"/>
              </Section>
              <Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[15]">
                   <Value field="code" value="PRS_PROVIDER_RELATIONSHIP"/>
              </Section>
              <Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[16]">
                   <Value field="code" value="PRS_STATUS"/>
              </Section>
              <Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[17]">
                   <Value field="code" value="PRS_WORK_LOCATION"/>
              </Section>
              <Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[18]">
                   <Value field="code" value="PRS_WORK_LOCATION_ADDRESS"/>
              </Section>
              <Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[19]">
                   <Value field="code" value="PRS_WORK_LOCATION_DETAIL"/>
              </Section>
              <Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[20]">
                   <Value field="code" value="PRS_WORK_LOCATION_ELECTRONIC_ADDRESS"/>
              </Section>
              <Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[21]">
                   <Value field="code" value="PRS_WORK_LOCATION_INFORMATION_ROUTE"/>
              </Section>
              <Section path="RESPONSE_OBJECT[0]/PROVIDER_QUERY_RESPONSE_OBJECT[22]">
                   <Value field="code" value="PRS_WORK_LOCATION_TELEPHONE"/>
              </Section>
              <!-- note: ROLE_CLASS has an extra trailing space, as in the Excel mapping spreadsheet -->
              <Section path="ROLE_CLASS /ROLE_CLASS_VALUE">
                   <Value field="value" value="LIC"/>
              </Section>
              <Section path="SORT_CONTROL[0]/SORT_CONTROL_ELEMENT_NAME">
                   <Value field="code" value="PrincipalPerson.name.value.family"/>
              </Section>
              <Section path="SORT_CONTROL[0]/SORT_CONTROL_DIRECTION_CODE">
                   <Value field="value" value="A"/>
              </Section>
         </Section>
    </Enricher>
         </EnricherParameter>
              </EnricherParametersProfileData>
         </ProfileData>
    </Profile>
    the data is valid against the schema through XML Spy tool... and loaded into the XDB repository...
    4) create table and insert data:
    SQL> CREATE TABLE EHIP_PROFILE OF SYS.XMLTYPE
    2 XMLSCHEMA "http://rac3-1-vip:8080/home/EHIPSBUSER1/xsd/EHIPProfile_v00.xsd" ELEMENT "Profile"
    3 ;
    Table created.
    SQL>
    SQL> alter table EHIP_PROFILE
    2 add CONSTRAINT EHIP_PROF_PK PRIMARY KEY(XMLDATA."ProfileID"."ID",XMLDATA."ProfileID"."Type");
    Table altered.
    SQL>
    SQL>
    SQL>
    SQL>
    SQL> select xdbURIType('/home/'||USER||'/ProfileData/EnricherPP.ID.0001.xml').getClob() from dual;
    XDBURITYPE('/HOME/'||USER||'/PROFILEDATA/ENRICHERPP.ID.0001.XML').GETCLOB()
    <?xml version="1.0" encoding="UTF-8"?>
    <!--Sample XML file generated by XMLSpy
    SQL>
    SQL>
    SQL> insert into ehip_profile values(xmltype.createXML(xdbURIType('/home/'||USER||'/ProfileData/EnricherPP.ID.0001.xml').getClob()));
    insert into ehip_profile values(xmltype.createXML(xdbURIType('/home/'||USER||'/ProfileData/EnricherPP.ID.0001.xml').getClob()))
    ERROR at line 1:
    ORA-21700: object does not exist or is marked for delete
    what's the problem caused the "ORA-21700: object does not exist or is marked for delete" error?
    Thanks in advance for your help?

    Thanks Marco,
    Here're my environment:
    SQL> select INSTANCE_NUMBER, INSTANCE_NAME,HOST_NAME,VERSION from v$instance;
    INSTANCE_NUMBER INSTANCE_NAME HOST_NAME VERSION
    2 rac32 RAC3-2 10.2.0.3.0
    I followed your suggested in the above, and always purge recyclebin, but still got the same problem. because in 10gr2, there's no dbms_xmlschema.purge_schema available,
    and I did checked the recyclebin after force the delete of schema, nothing inside. any other recommendation?

  • Axis: passing arrays as parameters to webservices

    Hi,
    I'm using axis to setup a webservice.
    In my client application, I need to pass an array of bytes to the webservice.
    How would I set this up when creating my call?
    Here is how I setup my calls:
    call.removeAllParameters();
    call.setOperationName("methodName");
    call.addParameter("paramName1", XMLType.XSD_?, ParameterMode.IN);
    call.setReturnType( XMLType.XSD_BOOLEAN );
    Boolean ret = (Boolean) call.invoke(new Object[]{ bytes });
    where 'bytes' is the array of bytes.
    The question marks are where I don't know what to do.
    Can anyone help me?

    Try XMLType.SOAP_ARRAY (there is an example at this URL: http://www.bii.a-star.edu.sg/infoscience/seg/fileTransfer.asp)

  • Array of blob

    I have to do a bulk files insert in vb.net to a oracle db table. I've my bytes array and I would to pass that to a stored procedure.
    So in my stored I've declared:
    TYPE blobarray IS TABLE OF BLOB
    INDEX BY BINARY_INTEGER;
    PROCEDURE prc_set_files (
    p_files blobarray,
    p_out OUT INTEGER,
    p_the_cur OUT cur
    Then, in my vb.net function, I've mapped my bytes array as a parameter like this:
    Dim filesArray(2)() As Byte
    commandParameters(i).OracleDbType = OracleDbType.Blob
    commandParameters(i).CollectionType = OracleCollectionType.PLSQLAssociativeArray
    commandParameters(i).Value = filesArray
    But doesn't work (no exception, only doesn't write). If I don't pass the vb array, it works.
    Could anyone help me?
    Thanks

    Hi,
    It is currently a limitation of the OCI layer that only scalar types can be used for associative arrays. As such, blobs, clobs, timestamps, intervals, and I suppose xmltypes, cannot be used.
    I'm a little surprised you're not getting an error or exception. I'd rather expect an ora-600 to occur, based on the enhancement request that was filed for support to be added for non-scalar types.
    cheers,
    Greg

  • Enqueuing XMLType

    I am trying to enqueue an XMLType value and have some questions.
    I tried to use a JMS ObjectMessage. But when I tried to setObject with the XMLType value, I get the following error:
    oracle.jms.AQjmsException: JMS-157: IO Exception
    Caused by: java.io.NotSerializableException: oracle.jdbc.driver.T4CConnection
    I looked at the demos that came with the Oracle installation and found one which uses the AdtMessage with XMLType values. However, when I looked at the Javadoc for the classes related to the AdtMessage type, there were notes indicating that the methods would be deprecated sometime in the future.
    So, my questions are:
    1. Is using any of the JMS Message types out of the question for XMLType? If not, which Message type should I use? And what payload type should I use for the queue table? I know that I can convert the value to a byte array, but I was hoping to still persist the value as an XMLType. Is that possible? I've been trying to locate the Javadoc for the oracle.AQ packages, but have been unable to.
    2. If I do need to use the AdtMessage type, should I be concerned about the deprecation warnings? Is it the case that these methods will merely be replaced by others? Or that support for this functionality will be going away?
    Thanks so much for your help.

    Code i used to complete the jms option with xml
    dbms_aqadm.create_queue_table(
    queue_table => 'change_q_tab',
    multiple_consumers => FALSE,
    storage_clause => 'TABLESPACE &x_tablespace',
    sort_list => 'PRIORITY,ENQ_TIME',
    message_grouping => DBMS_AQADM.NONE,
    queue_payload_type =>'sys.aq$_jms_text_message',
    comment => 'Creating queue table');
    dbms_aqadm.create_queue(
    queue_name => 'COST_CHANGE_Q',
    queue_table => 'change_q_tab',
    max_retries => 2,
    comment => 'cost change queue');
    PROCEDURE enqCostChange(
    p_cost_change IN VARCHAR2
    ,p_priority IN NUMBER          default LOW_PRIORITY
    IS
    PROC_NM constant VARCHAR2(30) := 'enqCostChange';
    v_enqueue_opt DBMS_AQ.enqueue_options_t;
    v_message_props DBMS_AQ.message_properties_t;
    v_message_handle RAW(16);
    -- for JMS
    v_cost_change sys.aq$_jms_text_message;
    v_agent     sys.aq$_agent := sys.aq$_agent(' ', null, 0);
    BEGIN
    -- Construct the message for ENQ operation.
    --JMS Construction
    v_cost_change := sys.aq$_jms_text_message.construct;
    v_cost_change.set_replyto(v_agent);
    v_cost_change.set_type('mcd://xmlns');
    v_cost_change.set_text(p_cost_change);
    -- Set proper options and properties
    v_enqueue_opt.visibility := DBMS_AQ.ON_COMMIT;
    v_message_props.PRIORITY := p_priority ;
    DBMS_AQ.enqueue (
    queue_name => 'COST_CHANGE_Q',
    enqueue_options => v_enqueue_opt,
    message_properties => v_message_props,
    payload => v_cost_change,
    msgid => v_message_handle );
    END enqCostChange;

  • Combining XML into Array

    BANNER
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
    PL/SQL Release 11.2.0.1.0 - Production
    CORE    11.2.0.1.0      Production
    TNS for Linux: Version 11.2.0.1.0 - Production
    NLSRTL Version 11.2.0.1.0 - ProductionI'm having trouble combining two pieces of sql using xml. I'm building an array of "items" using a select statement that works just fine. (contained_by is the parent of all the children in the array with the same contained by value)
    SELECT XMLELEMENT("itemArray", XMLAGG(extract(xml_data,'/item')))    
    FROM description_test
    WHERE contained_by = 181315;
    <itemArray>
       <item>...</item>
       <item>...</item>
       <item>...</item>
    </itemArray>Now, when I try to "attach" the parent, I can't seem to get it to work.
    SELECT p.naId, XMLCONCAT(extract(p.xml_data,'/fileUnit'),
               XMLAGG(XMLELEMENT("itemArray", extract(c.xml_data,'/item'))))
    FROM description_test p --parent,
    description_test c --child
    WHERE c.contained_by = p.naid;
    ORA-00937: not a single-group group function
    00937. 00000 -  "not a single-group group function"
    SELECT p.naId, XMLCONCAT(extract(p.xml_data,'/fileUnit'),
           XMLAGG(XMLELEMENT("itemArray", extract(c.xml_data,'/item'))))
    FROM description_test p, --parent,
    description_test c --child
    WHERE p.desc_type = 'FU'
    AND c.contained_by = p.naid
    and rownum < 5
    group by p.naid;
    ORA-00979: not a GROUP BY expression
    00979. 00000 -  "not a GROUP BY expression"what I'm expecting is the following to come back :
    <fileUnit>
       <some_data/>
       <more_data/>
       <itemArray>
          <item>...</item>
          <item>...</item>
          <item>...</item>
       </itemArray>
    </fileUnit>Not sure why this is not working. If I do the same thing without trying to build the xml array I get the following:
    SELECT p.naId, count(c.naid) AS CHILD_COUNT
    FROM description_test p,
    description_test c
    WHERE c.contained_by=p.naid
    group by p.naid;
    NAID  CHILD_COUNT
    135801     25
    174634     1
    137211     15
    136529     30
    143455     36
    145696     42Help is greatly appreciated. Thanks!!!

    Hi,
    As always, some sample data would help to understand the problem.
    From what you've posted so far, I assume something like this :
    create table description_test (
      naid number
    , contained_by number
    , xml_data xmltype
    insert into description_test values (1, null, xmltype('<fileUnit><some_data/><more_data/></fileUnit>'));
    insert into description_test values (2, null, xmltype('<fileUnit><some_data/><more_data/></fileUnit>'));
    insert into description_test values (3, 1, xmltype('<item>item 1.1</item>'));
    insert into description_test values (4, 1, xmltype('<item>item 1.2</item>'));
    insert into description_test values (5, 1, xmltype('<item>item 1.3</item>'));
    insert into description_test values (6, 2, xmltype('<item>item 2.1</item>'));
    insert into description_test values (7, 2, xmltype('<item>item 2.2</item>'));What you're trying to do implies grouping on an XMLType column, which is not possible since the XMLType object doesn't have any MAP or ORDER method.
    The solution is to use a subquery, like below.
    It also seems that you want insert, not concat :
    SQL> select p.naid
      2       , insertchildxml(
      3           p.xml_data
      4         , '/fileUnit'
      5         , 'itemArray'
      6         , (
      7             select xmlelement("itemArray", xmlagg(c.xml_data))
      8             from description_test c
      9             where c.contained_by = p.naid
    10           )
    11         ) as fileunit
    12  from description_test p
    13  where p.contained_by is null
    14  ;
    NAID FILEUNIT
       1 <fileUnit>
           <some_data/>
           <more_data/>
           <itemArray>
             <item>item 1.1</item>
             <item>item 1.2</item>
             <item>item 1.3</item>
           </itemArray>
         </fileUnit>
       2 <fileUnit>
           <some_data/>
           <more_data/>
           <itemArray>
             <item>item 2.1</item>
             <item>item 2.2</item>
           </itemArray>
         </fileUnit>

  • Calling a storedprocedure returning refcursor of xmltype

    Hi,
    I'm having issues with stored procedure, returning a refcursor of xmltypes. Most of the examples in the docs(http://docs.oracle.com/html/E10927_01/featXML.htm#i1012109) are always a direct query and I have yet to see one using a stored procedure.
    Here's a repro script:
    Register an xsd:
    BEGIN
    dbms_xmlschema.registerschema('http://www.testing.com/person.xsd',
    '<?xml version = "1.0" encoding = "utf-8"?>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
      elementFormDefault="qualified" attributeFormDefault="unqualified">
      <xs:element name="person">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="first_name" type="xs:string"/>
            <xs:element name="last_name" type="xs:string"/>
            <xs:element name="gender">
              <xs:simpleType>
                <xs:restriction base="xs:string">
                  <xs:enumeration value="male"/>
                  <xs:enumeration value="female"/>
                </xs:restriction>
              </xs:simpleType>
            </xs:element>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
    </xs:schema>',
    LOCAL => FALSE, -- local
    GENTYPES => FALSE, -- generate object types
    GENBEAN => FALSE, -- no java beans
    GENTABLES => TRUE, -- generate object tables
    FORCE => FALSE,
    options => dbms_xmlschema.register_binaryxml,
    OWNER => USER );
    END;
    --create a array of int type
    CREATE OR REPLACE
    type int_array_type as table of number;
    -- Create the table
    CREATE TABLE person
        ID NUMBER,
        xml_document XMLTYPE
      xmltype column xml_document STORE AS BINARY XML XMLSCHEMA "http://www.testing.com/person.xsd" element "person";
    -- insert some data
    INSERT INTO person (ID, xml_document)
    VALUES (1, XMLTYPE ('<?xml version="1.0" encoding="utf-8"?>
    <person xsi:noNamespaceSchemaLocation="http://www.testing.com/person.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      <first_name>John</first_name>
      <last_name>Doe</last_name>
      <gender>male</gender>
    </person>'));
    INSERT INTO person (ID, xml_document)
    VALUES (2, XMLTYPE ('<?xml version="1.0" encoding="utf-8"?>
    <person xsi:noNamespaceSchemaLocation="http://www.testing.com/person.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      <first_name>Jane</first_name>
      <last_name>Doe</last_name>
      <gender>female</gender>
    </person>'));
    Create the Package
    create or replace
    package test_pkg as
      TYPE refcursor IS REF CURSOR;
      type t_id_array is table of number index by binary_integer;
        -- user procs
      procedure udp_get_personlist (
          p_ids IN t_id_array,
          p_resultset out refcursor );
    end test_pkg;
    create or replace
    package body test_pkg as
      procedure udp_get_personlist (
          p_ids IN t_id_array,
          p_resultset out refcursor ) IS
          v_int_array_type int_array_type := int_array_type();
      begin
         FOR i IN 1..p_ids.COUNT LOOP
          v_int_array_type.extend(1);
          v_int_array_type(i) := p_ids(i);     
        END LOOP;   
        OPEN p_resultset FOR
        SELECT E.XML_DOCUMENT AS "person" FROM person E
        WHERE e.ID IN ( SELECT t.COLUMN_VALUE FROM TABLE ( v_int_array_type ) t );
      end udp_get_personlist;
    end test_pkg;And here is my ODP.NET code
    using (var con = new OracleConnection("<your oracle connection>"))
         using (var cmd = con.CreateCommand())
              cmd.CommandText = "test_pkg.udp_get_personlist";
              cmd.CommandType = CommandType.StoredProcedure;
              int[] ids = new int[] { 1, 2 };
              OracleParameter param1 = cmd.Parameters.Add("p_ids", OracleDbType.Int32);
              OracleParameter param2 = cmd.Parameters.Add("p_resultset", OracleDbType.RefCursor, ParameterDirection.Output);
              param1.CollectionType = OracleCollectionType.PLSQLAssociativeArray;
              param1.Value = ids;
              param1.Size = ids.Length;
              param1.ArrayBindSize = new int[] { 4, 4 };
              // Setup the ArrayBind Status for param2
              param1.ArrayBindStatus = new OracleParameterStatus[1] { OracleParameterStatus.Success }; //, OracleParameterStatus.Success };
              try
                   cmd.XmlQueryProperties.MaxRows = 1;
                   con.Open();
                   XmlReader r = cmd.ExecuteXmlReader(); // this always generates invalidoperationexception
                   // do something with the result
              catch (Exception)
                   throw;
              // Close and Dispose OracleConnection object
              con.Close();
              con.Dispose();
    }     Server/Tools information:
    Oracle is Standard - Oracle Database 11g Release 11.2.0.1.0 running on Windows Server 2003 Std
    ODP.NET (ie Oracle.DataAccess.DLL is 4.112.3.0);
    Visual Studio 2010 Ultimate SP1
    Any pointers in what I'm (obviously doing wrong) is greatly appreciated...
    thanks
    Edited by: 947266 on Sep 10, 2012 9:46 AM

    Was able to make it work
    using (var con = new OracleConnection("<your oracle connection>"))
         using (var cmd = con.CreateCommand())
              cmd.CommandText = "test_pkg.udp_get_personlist";
              cmd.CommandType = CommandType.StoredProcedure;
              int[] ids = new int[] { 1, 2 };
              OracleParameter param1 = cmd.Parameters.Add("p_ids", OracleDbType.Int32);
              OracleParameter param2 = cmd.Parameters.Add("p_resultset", OracleDbType.RefCursor, ParameterDirection.Output);
              param1.CollectionType = OracleCollectionType.PLSQLAssociativeArray;
              param1.Value = ids;
              param1.Size = ids.Length;
              param1.ArrayBindSize = new int[] { 4, 4 };
              // Setup the ArrayBind Status for param2
              param1.ArrayBindStatus = new OracleParameterStatus[1] { OracleParameterStatus.Success }; //, OracleParameterStatus.Success };
              try
                   cmd.XmlQueryProperties.MaxRows = 1;
                   con.Open();
                   int i = cmd.ExecuteNonQuery();
                            OracleRefCursor curs = (OracleRefCursor)cmd.Parameters["p_resultset"].Value;
                            OracleDataReader dr = curs.GetDataReader();
                            while (dr.Read())
                                Console.WriteLine(dr[0].ToString()); 
              catch (Exception)
                   throw;
              // Close and Dispose OracleConnection object
              con.Close();
              con.Dispose();
    }

  • Extract array elements using plsql

    I have an XMLTYPE variable containing the following SOAP envelope:
    <?xml version="1.0" encoding="US-ASCII"?>
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/1999/XMLSchema" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance">
    <soapenv:Body>
    <ns1:cleanseAddressResponse soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="urn:dbCleanseSoapBinding">
    <ns1:cleanseAddressReturn xsi:type="soapenc:Array" soapenc:arrayType="ns2:string[5]" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns2="http://www.w3.org/2001/XMLSchema">
    <item>1369 S 325 E STE 2323</item>
    <item/>
    <item>BOUNTIFUL</item>
    <item>UT</item>
    <item>84010</item>
    </ns1:cleanseAddressReturn>
    </ns1:cleanseAddressResponse>
    </soapenv:Body>
    </soapenv:Envelope>
    How can I extract individual values of ITEM using PLSQL? I can't seem to be able to extract anything out of this without raising ORA-30625 "method dispatch on NULL SELF argument is disallowed"

    You can create XMLSEQUENCE() from the extract() function and they get the value out.
    Or you can use the //item[1]/text() //item[2]/text().
    Does this make sense to you?

  • Stored proc with CLOB param to XMLType column

    I am using Oracle 8i client with the Oracle Provider for OLE DB to connect to an Oracle 9i database. It contains a table with several columns one of which is XMLType. We are trying to use a stored procedure to add rows to this table
    PROCEDURE SP_PUT_XML(
    P1 IN NUMBER,
    P2 IN NUMBER,
    P3 IN CLOB)
    Parameter P3 represents the xml document I am trying to insert.
    I have written a little C++ client program that uses the Oracle Provider for OLE DB to connect to the database and call this stored procedure. This program also reads in an UTF-8 encoded XML file and places it in a wchar_t array and then binds that array to the P3 parameter.
    When I run the program I get the following errors:
    Description: ORA-31011: XML parsing failed
    ORA-19202: Error occurred in XML processing
    LPX-00007: unexpected end-of-file encountered
    ORA-06512: at "MYSCHEMA.MYPACKAGE", line 97
    ORA-06512: at line 1
    When I recompile the client program to use a char array
    (and the exact same file as above) instead of a wchar_t array and bind that to the CLOB param, then the program works fine. no errors.
    How can I determine if the default encoding of the database is not compatible with the encoding of the xml file?

    You can probably retrieve the Boolean as a number data type, such as Int16. I haven't tried this myself, but that's what I've heard some users workaround Boolean.

  • Passing arrays using DII

    Following is the client code and config file i used to pass array.But still it fails.
    package simplebean;
    import javax.xml.rpc.Call;
    import javax.xml.rpc.Service;
    import javax.xml.rpc.JAXRPCException;
    import javax.xml.rpc.ServiceFactory;
    import javax.xml.rpc.ParameterMode;
    import javax.xml.rpc.encoding.XMLType;
    import javax.xml.namespace.*;
    public class HelloClient1 {
    private static String qnameService = "HelloWorld";
    private static String qnamePort = "HelloIFPort";
    private static String BODY_NAMESPACE_VALUE =
    "http://simplebean-hello.org/wsdl";
    private static String ENCODING_STYLE_PROPERTY =
    "javax.xml.rpc.encodingstyle.namespace.uri";
    private static String NS_XSD =
    "http://www.w3.org/2001/XMLSchema";
    private static String URI_ENCODING =
    "http://schemas.xmlsoap.org/soap/encoding/";
    public static void main(String[] args) {
    try {
    String endpoint= args[0];
    ServiceFactory factory =
    ServiceFactory.newInstance();
    Service service =
    factory.createService(new QName(qnameService));
    QName port = new QName(qnamePort);
    Call call = service.createCall();
    call.setPortTypeName(port);
    call.setTargetEndpointAddress(endpoint);
    call.setProperty(Call.SOAPACTION_USE_PROPERTY,
    new Boolean(true));
    call.setProperty(Call.SOAPACTION_URI_PROPERTY, "");
    call.setProperty(ENCODING_STYLE_PROPERTY, URI_ENCODING);
    call.setReturnType(XMLType.SOAP_ARRAY);
    call.setOperationName(new QName(BODY_NAMESPACE_VALUE,
    "reverse"));
    call.addParameter("arrayOfString_1", XMLType.SOAP_ARRAY,ParameterMode.IN);
    String par[] = {"Hello"};
    Object[] params = new Object[1];
    params[0] = par;
    String a[] = (String[])call.invoke(params);
    } catch (Exception ex) {
    ex.printStackTrace();
    configfile::
    <?xml version="1.0" encoding="UTF-8"?>
    <configuration
    xmlns="http://java.sun.com/xml/ns/jax-rpc/ri/config">
    <service name="HelloWorld" targetNamespace="http://simplebean-hello.org/wsdl"
    typeNamespace="http://simplebean-hello.org/types" packageName="simplebean">
    <interface name="simplebean.HelloIF"
    servantName="simplebean.HelloImpl"/>
    <typeMappingRegistry>
         <additionalTypes>
         <class name="java.lang.String[]"/>
         </additionalTypes>
         </typeMappingRegistry>
    </service>
    </configuration>

    There are a number of bugs when trying to pass custom objects dynamically. For example the client does not create the necesary serializer. Perhaps arrays are having the same problem too.
    Hugo

Maybe you are looking for