XML TYPE BNULL UPDATION

Sir,
I have XML content in a xml type identifier as shown below.
</VitalSummary>
<VitalMngId/>
     <FacilityTypeId>11</FacilityTypeId>
     <VitalLatesetMngRev>1</VitalLatesetMngRev>
     <VitalFrameId>0</VitalFrameId>
     <MeasureDateTime>20060707163420</MeasureDateTime>
     <CreatePractitioner>20060707163420</CreatePractitioner>
     <CreateDateTime>20060707163420</CreateDateTime>
     <DeleteFlag>0</DeleteFlag>
     <ConnectionNumber>0</ConnectionNumber>
     <PatientId>ANH1</PatientId>
     <ToUpdateFlag>true</ToUpdateFlag>
     <UpdatePractitioner>PRA1</UpdatePractitioner>
     <UpdateDateTime>20060707163420</UpdateDateTime>
</VitalSummary>
I want to know how I can set the value to the node <VitalMngId/> which is null.I can set value to other nodes using the code as shown below in a oracle Stored procedure.
PROCEDURE SET_VitalSummary(VitalSummary IN OUT xmltype);
TnodelistVitFID dbms_xmldom.DOMNodeList;
TnodeVitFID dbms_xmldom.DOMNode;
TnodelistVitMngId dbms_xmldom.DOMNodeList;
TnodeVitMngId dbms_xmldom.DOMNode;
Tdoc := dbms_xmldom.newDOMDocument(VitalSummary);
TnodelistVitFID := xslprocessor.selectNodes(dbms_xmldom.makeNode(Tdoc),'/VitalSummary/FacilityTypeId');
TnodeVitFID := dbms_xmldom.item(TnodelistVitFID , 0);
dbms_xmldom.setData(dbms_xmldom.getFirstChild(TnodeVitFID), '55');
I can change the value of <FacilityTypeId> from 11 to 55.
But I can't change the value of <VitalMngId> using the code as shown below because it is null
TnodelistVitMngId := xslprocessor.selectNodes(dbms_xmldom.makeNode(Tdoc),'/VitalSummary/VitalMngId');
TnodeVitMngId := dbms_xmldom.item(TnodelistVitMngId, 0);
dbms_xmldom.setData(dbms_xmldom.getFirstChild(TnodeVitFID), '10');
Can you inform me how i can set a value to xml node if it is null.
Regards,
Aneesh Kumar.P

Hi,
I got the Solution .Updation of the required xml null node in my example can be perform using the following statement
TnodeVitMngId := xmldom.appendChild(TnodeVitMngId, xmldom.makeNode(xmldom.createTextNode(Tdoc, '10')));
Regards,
Aneesh Kumar.P
Message was edited by:
user525828

Similar Messages

  • Updating xml type column

    Hi,
    I have a xml type column with content as follows
    <?xml version="1.0" encoding="utf-8"?>
    <PartInformation PartNumber="4393">
    <Maintenance />
    <Details>
    <Specs PartNumber="4393">
    <Type Code="K"></Type>
    </Specs>
    </Details>
    </PartInformation>
    <PartInformation PartNumber="4395">
    <Maintenance />
    <Details>
    <Specs PartNumber="4395">
    <Type Code="Z"></Type>
    </Specs>
    </Details>
    </PartInformation>
    I want to update the PartNumber="4393" to PartNumber="5789" for every occurrence .
    What is the easiest way to do it?
    Thanks

    Hi,
    Something like this?
    UPDATE your_table
    SET xmlcol = updatexml(xmlcol,'//*[@PartNumber="4393"]/@PartNumber','5789')
    WHERE ...

  • (updating xml value)adding an element in an xml type column

    Hi all,
    i hava a table that contains an xml-Type column (non schema based)
    i have inserted some data in it
    table:(id,xmlcolumn)
    ex:
    insert into t1 values(1,'<Chapters>
    <Chapter>ch1<Chapter>
    <Chapter>ch2<Chapter>
    </Chapters>')
    i need to add a new Chapter: <Chapter>ch3</Chapter>
    for the result of xml instance in the table to be:
    <Chapters>
    <Chapter>ch1<Chapter>
    <Chapter>ch2<Chapter>
    <Chapter>ch3<Chapter>
    </Chapters>
    plz if any one colud help

    SQL> DECLARE
      2      l_xml      XMLTYPE := XMLTYPE('<Chapters>
      3  <Chapter>ch1</Chapter>
      4  <Chapter>ch2</Chapter>
      5  </Chapters>');
      6      l_xsl      XMLTYPE;
      7      l_new_node VARCHAR2(100) := '<Chapter>ch3</Chapter>';
      8  BEGIN
      9      dbms_output.put_line('Before adding node:');
    10      dbms_output.put_line('----------------------------------------------------------------');
    11      dbms_output.put_line(l_xml.getStringVal());
    12      dbms_output.put_line('----------------------------------------------------------------');
    13      l_xsl := XMLTYPE('<?xml version="1.0"?>' ||
    14                       '<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"' ||
    15                       ' version="1.0"' || ' result-ns=""' || ' indent="no">' ||
    16                       '<xsl:output method="xml" media-type="text/xml" indent="no"/>' ||
    17                       '<xsl:template match="/">' ||
    18                           '<' ||l_xml.getRootElement() || '>' ||
    19                               ' <xsl:for-each select="/' || l_xml.getRootElement() ||'/Chapter">' ||
    20                                   '<xsl:copy-of select="." />' ||
    21                               '</xsl:for-each>' ||
    22                               l_new_node ||
    23                           '</' || l_xml.getRootElement() || '>' ||
    24                       '</xsl:template>' ||
    25                       '</xsl:stylesheet>');
    26      l_xml := l_xml.Transform(l_xsl);
    27      dbms_output.put_line('After adding node:');
    28      dbms_output.put_line('----------------------------------------------------------------');
    29      dbms_output.put_line(l_xml.getStringVal());
    30      dbms_output.put_line('----------------------------------------------------------------');
    31  END;
    32  /
    Before adding node:
    <Chapters>
    <Chapter>ch1</Chapter>
    <Chapter>ch2</Chapter>
    </Chapters>
    After adding node:
    <Chapters>
      <Chapter>ch1</Chapter>
      <Chapter>ch2</Chapter>
      <Chapter>ch3</Chapter>
    </Chapters>
    PL/SQL procedure successfully completed.
    SQL>

  • Xml to Oracle (Update more than one row)

    Hi,
    I want to update more than one row in table from .xml file. My xml file is as follows:
    <ROOT>
    <PROFILE PROFILEMASTER_PKEY="54" DB_MSTR_PKEY="2" PROFILE_NAME="Bhushans" DELIMETER="~" PRE_PROCESSOR="1" POST_PROCESSOR="10" PRE_PROCESSOR_TYPE="1" POST_PROCESSOR_TYPE="2" GROUPID="2" />
    <PROFILEDETAILS PROFILEMASTER_PKEY="54" TARGET_SOURCE_TABLE="FM_FEEDVALIDATION_LU" COLUMN_NAME="FEEDVALIDATION_ID" DATA_TYPE="NUMBER" DATA_SIZE="22" START_POSITION="12" END_POSITION="22" COLUMNORDER="1" PROFILEDETAILS_PKEY="399"/>
    <PROFILEDETAILS PROFILEMASTER_PKEY="54" TARGET_SOURCE_TABLE="FM_FEEDVALIDATION_LU" COLUMN_NAME="CHANGE_TYPE" DATA_TYPE="VARCHAR2" DATA_SIZE="1" START_POSITION="12" END_POSITION="144" COLUMNORDER="5" PROFILEDETAILS_PKEY="403"/>
    <OPTIONS PROFILEMASTER_PKEY ="54" LDR_SYNTX_DTLS_PKEY ="19" OPTIONVALUE="@" PROFILE_CFILE_PKEY="337" />
    <OPTIONS PROFILEMASTER_PKEY ="54" LDR_SYNTX_DTLS_PKEY ="19" OPTIONVALUE="~" PROFILE_CFILE_PKEY="336" />
    </ROOT>
    To update according to xml file, I have written following procedure. My procedure updates the table if u r updating 1 row. If you try to update more than 1 row, I mean .xml file contains more than 1 row then my procedure doesn't work. Please help to solve this problem.
    Procedure:
    create or replace procedure fm_prc_xml_dup_up
    as
    f utl_file.file_type;
    s varchar2(2000);
    v varchar2(3000);
    xml XMLType;
    v_pmpk number;
    v_sdtl_pk number;
    chng_typ VARCHAR2(20);
    type r1 is ref cursor;
    rcur r1;
    v1 varchar2(120);
    v2 number;
    begin
    f := utl_file.fopen('CITI', 'S.XML', 'R');
    loop
    utl_file.get_line(f, s);
    v := v || ' ' || s;
    end loop;
    exception
    when no_data_found then
    utl_file.fclose(f);
    xml := xmltype(v);
    SELECT extract(xml, 'ROOT/CHANGE/@CHANGETYPE').getstringval()
    INTO CHNG_TYP
    FROM DUAL;
    UPDATE FM_PROFILEMAST
    set db_mstr_pkey = extract(xml, 'ROOT/PROFILE/@DB_MSTR_PKEY').getnumberval(),
    profile_name = extract(xml, 'ROOT/PROFILE/@PROFILE_NAME').getstringval(),
    file_type = extract(xml, 'ROOT/PROFILE/@FILE_TYPE').getstringval(),
    delimiter = extract(xml, 'ROOT/PROFILE/@DELIMETER').getstringval(),
    pre_processor = extract(xml, 'ROOT/PROFILE/@PRE_PROCESSOR').getstringval(),
    post_processor = extract(xml, 'ROOT/PROFILE/@POST_PROCESSOR').getstringval(),
    pre_processor_type = extract(xml, 'ROOT/PROFILE/@PRE_PROCESSOR_TYPE').getstringval(),
    post_processor_type = extract(xml, 'ROOT/PROFILE/@POST_PROCESSOR_TYPE').getstringval(),
    groupid = extract(xml, 'ROOT/PROFILE/@GROUPID').getstringval(),
    change_type = 'U',
    change_by = chng_typ,
    change_dt = default,
    active_flag = default
    WHERE profilemaster_pkey = extract(xml, 'ROOT/PROFILE/@PROFILEMASTER_PKEY').getnumberval();
    UPDATE FM_PROFILEDET
    SET target_source_table = extract(xml, 'ROOT/PROFILEDETAILS/@TARGET_SOURCE_TABLE').getstringval(),
    column_name = extract(xml, 'ROOT/PROFILEDETAILS/@COLUMN_NAME').getstringval(),
    data_type = extract(xml, 'ROOT/PROFILEDETAILS/@DATA_TYPE').getstringval(),
    data_size = extract(xml, 'ROOT/PROFILEDETAILS/@DATA_SIZE').getnumberval(),
    start_position = extract(xml, 'ROOT/PROFILEDETAILS/@START_POSITION').getnumberval(),
    end_position = extract(xml, 'ROOT/PROFILEDETAILS/@END_POSITION').getnumberval(),
    change_by = chng_typ,
    change_dt = default,
    columnorder = extract(xml, 'ROOT/PROFILEDETAILS/@COLUMNORDER').getstringval(),
    column_format = extract(xml, 'ROOT/PROFILEDETAILS/@COLUMN_FORMAT').getstringval(),
    nullable = extract(xml, 'ROOT/PROFILEDETAILS/@NULLABLE').getstringval(),
    change_type ='U',
    active_flag = default
    WHERE profiledetails_pkey = extract(xml, 'ROOT/PROFILEDETAILS/@PROFILEDETAILS_PKEY').getstringval();
    UPDATE FM_PROFILE_CFILE
    SET profilemaster_pkey = extract(xml, 'ROOT/PROFILE/@PROFILEMASTER_PKEY').getnumberval(),
    ldr_syntx_dtls_pkey = extract(xml, 'ROOT/OPTIONS/@LDR_SYNTX_DTLS_PKEY').getstringval(),
    val = extract(xml, 'ROOT/OPTIONS/@OPTIONVALUE').getstringval(),
    change_by = chng_typ,
    change_dt = default,
    sub_line_seq = extract(xml, 'ROOT/OPTIONS/@SUB_LINE_SEQ').getstringval(),
    change_type = 'U',
    active_flag = default
    where profile_cfile_pkey = extract(xml, 'ROOT/OPTIONS/@PROFILE_CFILE_PKEY').getnumberval();
    END;

    Hi Bhushan,
    one where clause is missing in the main update.
    update fm_profiledet
    set (....)
    =(select ....)
    where id in (select your profiledetails_pkey from the xml). <--this where clause were missing.
    if xml extracting is too slow(xml very large) then you can create a procedure where exract your data from the xml and then update rows in for loop.
    something like this
    create procedure up_xmls(p_xml xmltype) is
    cursor cur_xml(p_xml xmltype) is
    select ......<--here you extract your xml
    begin
    for r_row in cur_xml(p_xml) loop
    update fm_profiledet set target_source_table=r_row.target_source_table
    where profiledetails_pkey=r_row.profiledetails_pkey;
    end loop;
    end;this should work:
    SQL> drop table fm_profiledet;
    Table dropped.
    SQL> create table fm_profiledet(
      2   profiledetails_pkey number
      3  ,target_source_table varchar2(100)
      4  ,column_name varchar2(100)
      5  ,data_type varchar2(100)
      6  ,data_size number
      7  ,start_position number
      8  ,change_type varchar2(100)
      9  )
    10  /
    Table created.
    SQL>
    SQL>
    SQL> insert into fm_profiledet
      2  values(399,'test','test1','test2',1,2,'A')
      3  /
    1 row created.
    SQL>
    SQL>
    SQL> insert into fm_profiledet
      2  values(403,'test3','test4','test5',3,4,'B')
      3  /
    1 row created.
    SQL> insert into fm_profiledet
      2  values(443,'test3','test4','test5',3,7,'B')
      3  /
    1 row created.
    SQL>
    SQL>
    SQL> select * from fm_profiledet;
    PROFILEDETAILS_PKEY TARGET_SOU COLUMN_NAM DATA_TYPE  DATA_SIZE START_POSITION CHANGE_TYP                               
                    399 test       test1      test2              1              2 A                                        
                    403 test3      test4      test5              3              4 B                                        
                    443 test3      test4      test5              3              7 B                                        
    SQL>
    SQL> create or replace directory xmldir as '/home/ants';
    Directory created.
    SQL>
    SQL>
    SQL>
    SQL> update fm_profiledet fm
      2  set (target_source_table,column_name, data_type, data_size, start_position,change_type)
      3  =(
      4    select  target_source_table
      5          , column_name
      6          , data_type
      7          , data_size
      8          , start_position
      9          , change_type
    10    from(
    11      select
    12        extractValue(value(x),'/PROFILEDETAILS/@PROFILEDETAILS_PKEY') profiledetails_pkey
    13      , extractValue(value(x),'/PROFILEDETAILS/@TARGET_SOURCE_TABLE') target_source_table
    14      , extractValue(value(x),'/PROFILEDETAILS/@COLUMN_NAME') column_name
    15      , extractValue(value(x),'/PROFILEDETAILS/@DATA_TYPE') data_type
    16      , extractValue(value(x),'/PROFILEDETAILS/@DATA_SIZE') data_size
    17      , extractValue(value(x),'/PROFILEDETAILS/@START_POSITION') start_position
    18      ,'U' change_type
    19     from
    20      table(xmlsequence(extract(xmltype(bfilename('XMLDIR','prof.xml')
    21                                      ,nls_charset_id('AL32UTF8'))
    22                               , '/ROOT/PROFILEDETAILS'))) x
    23    ) s
    24  where s.profiledetails_pkey=fm.profiledetails_pkey)
    25  where
    26    fm.profiledetails_pkey in (select
    27        extractValue(value(x),'/PROFILEDETAILS/@PROFILEDETAILS_PKEY') profiledetails_pkey
    28     from
    29      table(xmlsequence(extract(xmltype(bfilename('XMLDIR','prof.xml')
    30                                      ,nls_charset_id('AL32UTF8'))
    31                               , '/ROOT/PROFILEDETAILS'))) x
    32  );
    2 rows updated.
    SQL>
    SQL>
    SQL> select * from fm_profiledet;
    PROFILEDETAILS_PKEY TARGET_SOU COLUMN_NAM DATA_TYPE  DATA_SIZE START_POSITION CHANGE_TYP                               
                    399 FM_FEEDVAL FEEDVALIDA NUMBER            22             12 U                                        
                        IDATION_LU TION_ID                                                                                 
                    403 FM_FEEDVAL CHANGE_TYP VARCHAR2           1             12 U                                        
                        IDATION_LU E                                                                                       
                    443 test3      test4      test5              3              7 B                                        
    SQL> spool off;Ants
    Message was edited by:
    Ants Hindpere

  • Why can't I view the XML-type in my queries

    I have SQL Developer configured to connect to an Oracle 11g database, using the "thick net". I recently upgraded to version 2.1.1.64.
    I have an issue displaying XML-type results. If I execute a query that returns XML-types, I get the following error: oracle.sql.OPAQUE@e8bd13. Is there a patch, update or tweak I can do to get around this and display the actual results?
    Thanks.

    Can you see the sample schemas and the XMLTYPE in the OE Warehouses table, or does this also issue the same error.? You should be able to see the XML content using SQL Developer 2.1.
    Please note there is also an early adopter for 3.0.
    Sue

  • TopLink : attribute-mapping direct-xml-type-mapping

    hi
    Using TopLink Workbench 10g Release 3 (10.1.3.0.0) Build 060118 it is possible to configure a "Direct to XML Type" mapping.
    see http://www.oracle.com/technology/products/ias/toplink/doc/1013/main/_html/relmapun004.htm#CHDFIFEF
    In the TopLink map this results in a
    <opm:attribute-mapping xsi:type="toplink:direct-xml-type-mapping">Is there a way to configure this kind of attribute mapping using JDeveloper?
    thanks
    Jan Vervecken

    Hi Paul,
    The problem you're going to hit trying to do this with a TransformationMapping in 904 (as in my other post) is that during the UnitOfWork commit, when TopLink is checking for changes a .equals will end up being called on an XMLType instance which will throw a NullPointerException (in oracle.sql.Datum I think).
    One way to work around this (depending on the requirements for your app) is to set the isMutable flag on the TransformationMapping to false. This flag indicates that the value in the object's attribute isn't going to be changed, so we don't bother trying to check to see if it's changed. This will allow you to do reads, inserts and deletes with no problems.
    The downside is that if you need to be able to change the XML content in your objects model and do an update of the row, TopLink will never detect a change and never issue an update of the XMLType field.
    Incidentilly, if you happen to hit the same issue you had with the DirectToXMLTypeMapping where you were getting back an instance of java.sql.Opaque instead of the expected oracle.xdb.XMLType from JDBC, you should be able to handle that case in your AttributeTransformer by doing
    XMLType myXML = XMLType.createXML(myOpaque)
    Document = myXML.getDocument();
    Hope this helps
    Matt MacIvor

  • Reporting Services web service complex xml type report parameters

    Hi,
    I have the following xml type parameter in my request query that I use in reporting services.
    <Parameter Name="accountDetails" Type="XML" xmlns:d4p1="thevalue" xmlns:i="thevalue">
    <DefaultValue>
    <d4p1:AccountDetailDto>
    <d4p1:AccountNumber>12345</d4p1:AccountNumber>
    <d4p1:AccountType>Sales</d4p1:AccountType>
    </d4p1:AccountDetailDto>
    </DefaultValue>
    I want to know how I can assign values to the accountDetails parameter from report parameters, I've tried to call it from the dataset parameter properties but it doesn't return any values. I created Parameters!accountDetails.Value on the dataset parameters
    properties and assigned it the following value: it only returns empty columns
    ="<AccountDetailDto><AccountNumber>"& Parameters!AccountNumber.Value &"</AccountNumber><AccountType>"& Parameters!AccountType.Value &"</AccountType></AccountDetailDto>"
    You're help will be highly appreciated as I've been trying to solve this for a while now

    Hi Alisa,
    Perhaps I should explain my problem clearly...
    This is my query request that I send to the webservice:
    <Query>
    <Method Name="GetPerAccountAssetAllocation" Namespace="http://tempuri.org/">
    <Parameters>
    <Parameter Name="accountDetails" Type="XML" xmlns:d4p1="thevalue" xmlns:i="thevalue">
    <DefaultValue>
    <d4p1:AccountDetailDto>
    <d4p1:AccountNumber>12345</d4p1:AccountNumber>
    <d4p1:AccountType>JSE</d4p1:AccountType>
    </d4p1:AccountDetailDto>
    </DefaultValue>
    </Parameter>
    </Parameters>
    </Method>
    <SoapAction>http://tempuri.org/IPortfolioManagementService/GetPerAccountAssetAllocation</SoapAction>
    <ElementPath IgnoreNamespaces="true">*</ElementPath>
    </Query>
    It works well when I run it just like this, that is without specifying any parameters in the report data dialogue window or on the dataset parameters properties, it returns the values and columns correctly.
    So my problem is, I need to find out how(xml parameter syntax, steps e.t.c)
    I can do to allow users to specify the accountDetails parameter, its quite tricky for me coz its an xml type parameter, Im not sure if I should just specify the AccountNumber and
    ReportType parameters separately:
    I've tried the following without any success:
    1. Under the dataset properties:  I tried not to specify a default value for the accountDetails parameter on the xml query, then I added a parameter called "accountDetails" under the dataset parameters properties, then under parameter
    value I added the following xml value :
    <d4p1:AccountDetailDto>
    <d4p1:AccountNumber>Parameters!AccountNumber.Value</d4p1:AccountNumber>
    <d4p1:AccountType>Parameters!AccountType.Value</d4p1:AccountType>
    </d4p1:AccountDetailDto> 
    (I also added the AccountNumber and AccountType parameters under the report data dialogue window)
    This returns empty columns, is there something I'm missing, or am I doing this incorrectly?

  • Custom action with XML type input and output parameter.

    Hi,
    I want to develop custom action with xml type input and/or output parameter.
    Is there sample code for java side. How is the definition of input and/or output parameter and set/get methods?
    does it need special .jar file to develop custom action like this?
    Thanks.

    Cemil - yes, you can use XML data types.  Use the class
    com.sap.lhcommon.xml.XMLDataType
    for your parameter type.  Here is a snippet from a custom action we use to log XML (instead of just returning the #text node like the default logger does):
    public class XMLLogger extends ActionReflectionBase
        private String source;
        private String eventType;
        private String textMessage;
        private XMLDataType xmlMessage;
        public XMLLogger()
            log = new Logger("UserLog");
            source = DEFAULT_SOURCE;
            eventType = TYPE_INFO;
            textMessage = "";
            xmlMessage = new XMLDataType();
        public XMLDataType getXmlMessage()
            return xmlMessage;
        public void setXmlMessage(XMLDataType xmlMessage)
            this.xmlMessage = xmlMessage;
        public void Invoke(Transaction transaction, ILog ilog)
            StringBuffer sb = new StringBuffer();
            sb.append('[');
            sb.append(source);
            sb.append("] ");
            sb.append(textMessage);
            sb.append(XMLUtils.convertXmlToString(xmlMessage));
    XMLUtils is a helper class we wrote - it's just a bunch of standard Java XML boilerplate code.  The important part you need to know is XMLDataType.getDocument() will return an org.w3c.dom.Document.
    I hope that was enough information to help.
    -tim

  • ORA-19007 when coping a table with an xml type in it to a new schema in the

    ORA-19007 when coping a table with an xml type in it to a new schema in the same database.
    Hi all,
    When I copy a table with an xml type in it to a new schema in the same database I get an ora-19009.
    The setup is as follows I have a schema a with table TABLE_WITH_XMLTYPE where data is:
    CREATE
    TABLE TABLE_WITH_XMLTYPE
    FOLDER_ID NUMBER (10, 0) NOT NULL,
    SEARCH_PROPERTIES XMLTYPE ,
    CONSTRAINT TABLE_WITH_XMLTYPE PK PRIMARY KEY (FOLDERID) USING INDEX
    XMLTYPE COLUMN SEARCH_PROPERTIES XMLSCHEMA
    "http://xxxxxxx.net/FolderProperties.xsd" element "FolderProperties"
    VARRAY SEARCH_PROPERTIES."XMLDATA"."PROPERTIES"."PROPERTY" STORE AS TABLE
    PROPERTY_TABLE
    (PRIMARY KEY (NESTED_TABLE_ID, ARRAY_INDEX)) ORGANIZATION INDEX OVERFLOW
    Both schemas have the following xml schema registered as a local xml schema
    BEGIN
    DBMS_XMLSCHEMA.registerSchema(
    SCHEMAURL => 'http://xxxxxxx.net/FolderProperties.xsd',
    SCHEMADOC =>
    '<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:xdb="http://xmlns.oracle.com/xdb"
    xdb:storeVarrayAsTable="true">
    <xs:element name="FolderProperties"
    type="FolderPropertiesType"
    xdb:defaultTable="FOLDER_SEARCH_PROPERTIES" />
    <xs:complexType name="FolderPropertiesType" xdb:SQLType="FOLDERPROPERTIES_T">
    <xs:sequence>
    <xs:element name="FolderID" type="FolderIDType" minOccurs="1" xdb:SQLName="FOLDER_ID"/>
    <xs:element name="Properties" type="PropertiesType" xdb:SQLName="PROPERTIES"/>
    </xs:sequence>
    </xs:complexType>
    <xs:complexType name="PropertiesType" xdb:SQLType="PROPERTIES_T">
    <xs:sequence>
    <xs:element name="Property" type="PropertyType" maxOccurs="unbounded"
    xdb:SQLName="PROPERTY" xdb:SQLCollType="PROPERTY_V"/>
    </xs:sequence>
    </xs:complexType>
    <xs:complexType name="PropertyType" xdb:SQLType="PROPERTY_T">
    <xs:sequence>
    <xs:element name="DateValue" type="DateType" xdb:SQLName="DATE_VALUE"/>
    <xs:element name="NumValue" type="NumType" xdb:SQLName="NUM_VALUE"/>
    <xs:element name="StringValue" type="StringType" xdb:SQLName="STRING_VALUE"/>
    </xs:sequence>
    <xs:attribute name="Name" xdb:SQLName="NAME" xdb:SQLType="VARCHAR2">
    <xs:simpleType>
    <xs:restriction base="xs:string">
    <xs:minLength value="1"/>
    <xs:maxLength value="255"/>
    </xs:restriction>
    </xs:simpleType>
    </xs:attribute>
    </xs:complexType>
    <xs:simpleType name="FolderIDType">
    <xs:restriction base="xs:integer"/>
    </xs:simpleType>
    <xs:simpleType name="DateType">
    <xs:restriction base="xs:dateTime"/>
    </xs:simpleType>
    <xs:simpleType name="NumType">
    <xs:restriction base="xs:decimal"/>
    </xs:simpleType>
    <xs:simpleType name="StringType">
    <xs:restriction base="xs:string" />
    </xs:simpleType>
    </xs:schema>',
    LOCAL => TRUE,
    GENTYPES => TRUE,
    GENTABLES => FALSE);
    END;
    when I try to do the following insert:
    insert into schemaB.TABLE_WITH_XMLTYPE ( FOLDER_ID, SEARCH_PROPERTIES)
    select FOLDER_ID, SEARCH_PROPERTIES from schemaB.TABLE_WITH_XMLTYPE;
    I’ll get an ora-19007.
    Can some one point me in the right direction how to solve this error.
    Thanks Roelof.

    Who did you create the second table, in other words, how did you COPY the table as you said...
    If you created the second table via a CTAS (create table as select) then you will have created a table that is not the same as the original one. AFAIK I have once created an enhancement request for this after discovering that JDeveloper, for example, creates a "copy" via a CTAS which creates the wrong structure. Double check via package DBMS_METADATA.
    SQL> set long 1000000
    SQL> select DBMS_METADATA('TABLE','TABLE_WITH_XMLTYPE','SchemaA') from dual;
    SQL> select DBMS_METADATA('TABLE','TABLE_WITH_XMLTYPE','SchemaB') from dual;If you have got two different tables, than Mark's solution should help.
    M.
    Edited by: Marco Gralike on Feb 15, 2009 11:16 AM

  • Help  needed  in inserting  into column  of XML type

    i have requirement of inserting data into column of xml type
    eg
    cust product cost
    1 a 3
    1 b 7
    1 c 5
    now required result should
    <PROD-LIST>
    <a>3</a>
    <b>7</b>
    <c>5</c>
    </PROD-LIST>
    Please let me know how to achieve this , i was trying write function , it was working for one values ,but how to do if many values exist .

    Take a deep breath, then retype this putting in all the words and punctuation you missed out the first time until it makes sense.
    Your sample data, for example, could be better formatted using the [pre] and [/pre] tags to preserve formatting and put in a table format. Similarly with your output. Why are two of the numbers floating around freely in your xml but the 3rd isn't?

  • Inserting a row in a schema-based xml type column

    i have problems while inserting a row in a schema-based xml type column
    it reports an error(schema and elemnt do not match)
    although they are matching if anyone can try it
    and if it worked plz send me the example

    SQL> DESC XML_TAB;
    Name Null? Type
    XML XMLTYPE
    SQL> INSERT INTO XML_TAB
    2 VALUES
    3 (xmltype('<request>
    4 <filter>(extshortname=bhagat)</filter>
    5 <attributes>dn</attributes>
    6 <context/>
    7 <scope>subtree</scope>
    8 </request>'));
    1 row created.
    If your problem persists,post ur lines of code..
    Good luck!!!
    Bhagat

  • Binding ADF UI to a complex XML Type – Development Productivity, State Mgmt

    Binding ADF UI to a complex Web Service – Development Productivity, Managing State, Etc.
    For those scenarios when ADF UI has to be bound to a complex XML type, it seems that the direction taken by the ADF development team was to generate data-controls that map to complex XML types.
    The major problem with this approach is the fact that application server does not manage state. For example, If application has to submit a purchase order to a web service then application server has to manage the shopping card state until its ready to be submitted.
    In some previous forum threads it had been suggested that using generated data-controls is a “quick and dirty” solution for accessing web services and that a proper solution is to use generated Java Proxy Interface.
    That implies many manually constructed entity objects, associations and overridden doDML methods, which is far less productive compared to entity objects generated from a database schema.
    Suggestion and a Question for the ADF development team
    From the logical model standpoint, there is no difference in between the XML schema and DB schema. Therefore, it is possible to generate entity objects and associations for XML Types of XML schema the same way it’s done for tables of Database schema. The only difference is serialization of CRUD operations on entity objects.
    One way to handle this is:
    -     Generate Application Module for a complex XML type. This application module should have methods for marshaling to/from corresponding XML type.
    -     Generate entity object for each subtype within the complex XML type. In case of nested subtypes, generate association to a parent type.
    -     Generate data control with actions that are bound to web service operations and code that serializes request message from corresponding AM and de-serializes response message to corresponding AM.
    This way, ADF would offer the same productivity for the SOA development as one its currently offering for the ORM development.
    Until the time when something like this is available, what would be the best approach for binding ADF UI to web services?
    Feedback is greatly appreciated.
    Boro Petrovic
    Edited by: wds12518 on Jan 25, 2010 11:49 AM

    We have similar issues as our big portion of the UI is based on WS. We found that there is no easy way to map entity object structure to complex XML type (one EO can based on one flat type or domain can't be bound to UI directly). Oracle PMs, is there any better solution or future plans to address this issue?

  • Parsing the data from and xml type field

    Hi - I have registered a schema and inserted arecord into the table with the xml type column. Now I want to parse the data from the xmltype field into a relational table. I have been using the following select statement to accomplish this - and it does work if there is data in all the selected fields but when the filed is null then the whole select statement fails and brings back 'no rows returned'.If the value is null I want the select statment to return null. please give any ideas.
    SELECT version,frmd_transaction_date,extractValue(value(b), 'event_update/location')"location",
    extractValue(value(b), 'event_update/sending_system')"sending_system",
    extractValue(value(b), 'event_update/event_identifier')"event_identifier",
    extractValue(value(b), 'event_update/event_link')"event_link",
    extractValue(value(b), 'event_update/organization_code')"organization_code",
    nvl(extractValue(value(c), '/schedule/event_duration_minutes'),'000')"event_minutes"
    FROM fraamed_user.frmd_event_update , TABLE(xmlsequence(extract(xml_event_update, '/event_update')))b,
    TABLE(xmlsequence(extract(xml_event_update, '/event_update/schedule')))c

    ...then I guess you have to rewrite the query.
    Is schedule another xml sequence inside of event_update sequence ?
    If it is not you can try this :
    SELECT version,frmd_transaction_date,extractValue(value(b), '/event_update/location/text()')"location",
    extractValue(value(b), '/event_update/sending_system/text()')"sending_system",
    extractValue(value(b), '/event_update/event_identifier/text()')"event_identifier",
    extractValue(value(b), '/event_update/event_link/text()')"event_link",
    extractValue(value(b), '/event_update/organization_code/text()')"organization_code",
    extractValue(value(b), '/event_update/schedule/event_duration_minutes/text()')"event_minutes"
    FROM fraamed_user.frmd_event_update , TABLE(xmlsequence(extract(xml_event_update, '/event_update')))b
    ...if yes, did you try nvl function (I don't think this would be a solution of a problem):
    SELECT version,frmd_transaction_date,nvl(extractValue(value(b), '/event_update/location/text()')"location", 'NULL VALUE'),
    nvl(extractValue(value(b), '/event_update/sending_system/text()')"sending_system",'NULL VALUE'),
    nvl(extractValue(value(b), '/event_update/event_identifier/text()')"event_identifier",'NULL VALUE'),
    nvl(extractValue(value(b), '/event_update/event_link/text()')"event_link",'NULL VALUE'),
    nvl(extractValue(value(b), '/event_update/organization_code/text()')"organization_code",'NULL VALUE'),
    nvl(extractValue(value(c), '/schedule/event_duration_minutes/text()')"event_minutes",'NULL VALUE')
    FROM fraamed_user.frmd_event_update , TABLE(xmlsequence(extract(xml_event_update, '/event_update')))b,
    TABLE(xmlsequence(extract(xml_event_update, '/event_update/schedule')))c
    If none of this works post your xml schema.

  • XML-Type and reference to unavailable DTD causes validation problems

    Hi,
    I'm fairly new to Oracle's XML features. I've created a view that produces XML from a number of tables. The resulting XML is used to be stored on a web site for download by customers (this is a manual process about once a week via a CMS). It contains a reference to a DTD that is available on the web server, too. This XML must also be stored in the Oracle database. The problem is that the Oracle Server is not allowed to access any web site (Oracle server is in inhouse network with no access allowed to the world outside). So I can't store the XML in an XML-type column, as the Oracle server wants to validate the XML against the referenced DTD. There is an option not to validate the XML. But then I get the error when I try to access the XML afterwards. So up to now I use a CLOB column to store the XML, but then I lose all the benefits of an XML-type column. Is there any workaround?
    TIA,
    Stefan

    In 10.2.0.2.0 The following works
    SQL> drop table TEST_XML
      2  /
    Table dropped.
    SQL> create table TEST_XML (
      2     XML_SEQ number(10) not NULL,
      3     XML_DOC XMLType not NULL
      4  )
      5  /
    Table created.
    SQL> drop sequence TEST_XML_SEQ
      2  /
    Sequence dropped.
    SQL> create sequence TEST_XML_SEQ
      2  /
    Sequence created.
    SQL> create or replace view V_EMP_XML as select
      2         -- Processing Instruction
      3         '<?xml version="1.0" encoding="ISO-8859-1"?>' ||
      4         -- DTD reference
      5         '<!DOCTYPE employees SYSTEM "http://myserver/dtd/employees.dtd">' ||
      6         SYS.XMLTYPE.getClobVal(
      7            XMLElement("employees",
      8               (select XMLAgg(
      9                          XMLElement("emp",
    10                             XMLAttributes(
    11                                e.EMPNO as "empno",
    12                                e.DEPTNO as "deptno"
    13                             ),
    14                             XMLElement("ename", e.ENAME),
    15                             XMLElement("job", e.JOB),
    16                             XMLElement("salary", e.SAL),
    17                             XMLElement("hiredate", to_char(e.HIREDATE, 'YYYY-MM-DD'))
    18                          )
    19                       order by e.EMPNO
    20                       )
    21                from   SCOTT.EMP e
    22               )
    23            )
    24         ) as XML_DOC
    25  from   DUAL
    26  /
    View created.
    SQL>
    SQL> insert into TEST_XML
      2  (
      3    XML_SEQ,
      4    XML_DOC
      5  )
      6  select TEST_XML_SEQ.NEXTVAL,
      7         XMLType(v.XML_DOC, NULL, 1, 1)
      8  from   V_EMP_XML v
      9  /
    1 row created.
    SQL> select t.XML_DOC.getClobVal() as RESULT
      2  from   TEST_XML t
      3  where  t.XML_SEQ = 1
      4  /
    RESULT
    <?xml version="1.0" encoding="ISO-8859-1"?><!DOCTYPE employees SYSTEM "http://my
    SQL> select extract(t.XML_DOC, '//emp[@deptno=20]').getClobVal() as RESULT
      2  from   TEST_XML t
      3  where  t.XML_SEQ = 1
      4  /
    ERROR:
    ORA-31011: XML parsing failed
    ORA-19202: Error occurred in XML processing
    LPX-00202: could not open "http://myserver/dtd/employees.dtd" (error 101)
    Error at line 1
    no rows selected
    SQL> alter session set events ='31156 trace name context forever, level 2'
      2  /
    Session altered.
    SQL> select extract(t.XML_DOC, '//emp[@deptno=20]').getClobVal() as RESULT
      2  from   TEST_XML t
      3  where  t.XML_SEQ = 1
      4  /
    RESULT
    <emp empno="7369" deptno="20"><ename>SMITH</ename><job>CLERK</job><salary>800</s
    SQL>

  • Newbie question on indexing XML type

    I cannot get a query to use an index I created for an XML type. Here is my setup:
    create table XmlTest( id number,
    data_xml XMLType)
    XmlType data_xml STORE AS CLOB;
    I inserted 10,000 records like this ( each record has a unique id):
    insert into XmlTest(id, data_xml) values
    ( 1
    , XMLType('<company>
    <department>
    <id>10</id>
    <name>Accounting</name>
    </department>
    </company>'));
    I then created this index:
    CREATE INDEX xmltest1
    ON xmltest (extractValue(data_xml, '/company/department/id'));
    When I run this query, it takes a long time - 12 seconds.
    SELECT id from xmltest
    WHERE EXISTSNODE( data_xml, '/company/department[id="37500"]') = 1;
    it is doing a full table scan. What is wrong with my index?
    Thanks!

    I've yet to have the opportunity to work with indexes on XML data but I suspect it is because your index alone cannot satisfy the results of the query and the data you want is from every row in the table so a FTS is the best approach.
    To restate, you are asking for the id value from the table where the XML contains a certain node. This node exists in every entry in the index, so why use the index if you have to go get data from the table.
    Or it is because EXISTSNODE is checking for a different condition then your index was defined on. I suspect if you do something like /company/department/id[. = '10'] in your EXISTSNODE, it should use the index.
    All this is a guess and the best place for you to look is the {forum:id=34} forum and also [Marco&apos;s Blog|http://www.liberidu.com/blog/]

Maybe you are looking for

  • Audigy 2 ZS Platinum Pro - spdif and optical at the same t

    Hi, I own a Audigy 2 ZS Platinum Pro, DR release .84.40. I have an optical source and an coax spdif source that I would like to connect to the external module. I have found that as soon as I connect a spdif source the optical is cut off. I can't get

  • Acrobat 8 Slow Encoding from Word, Missing Text in Result!

    I am getting so frustrated with Acrobat 8.x.. not only do I have to put up with the 90-second hang after launching ANY PDF doc, but when I author docs out of Word and Quark, many times it takes ten minutes or more to export a 1-page doc and 40% of th

  • Substr function problem in oracle

    my requirement is that i am writing the stored procedure in which use *substr( source_string, start_position, [ length ] )* my 1 requirement i have i problem that the source_string is dynamically being passed as a parameter into the stored procedure

  • Help with get-aduser -filter command

    Hi! I'm having problems with getting user info from displayname function searchuzv { $uzvinfo=$InputBoxuzv.text; $uzvcheck = Get-ADUser -filter "DisplayName -like '*$uzvinfo*'" If i run Get-ADUser -filter "DisplayName -like '*$uzvinfo*'" line separat

  • Can't find the "Protecting the RESTful Services" in the 'Required Scopes' field

    When I following the ORDS 2.0.10 readme to configure Oracle Restful services, I can't find the "Protecting the RESTful Services" in the 'Required Scopes' field. The detail step is in "Registering the 3rd party application" of section "Accessing the R