Extraction sequence

Dear Gurus,
Could you help me is there a sequence to follow for extracting FI GL AR AP? Or they are all independent of each other?
regards
bryan

You need to init GL first.
Then init AR and AP. (no order is necessary).
On delta's, you need to execute the GL delta first, then AR and AP in any order after that.
There is an OSS note you can apply if you want to make all independent of each other (essentially independent of the GL). But, it may cause confusion with users if they see data from GL and AR/AP that doesn't reconcile together. It may be best not to apply this note and leave them linked.
Cheers!
/smw

Similar Messages

  • Golden Gate Sequence Value replication?

    Hi all,
    I have searched the web, and read the Golden Gate documentation but I've found mixed answers.
    I'm just trying to ascertain for certain whether it's possible to automatically replicate sequence values in a bi-directional configuration. Both databases will be identical and both will be 11gR2 with the latest version of GG.
    If it is not possible to automatically increment sequences in a bi-directional configuration, what are the best practices for maintaing them?
    One option is the alternate sequences on each database, one with even values (for example) and one with odd values, but this requires deployment of new sequences on both databases, something we were hoping would be taken care of by the replication. (yes the sequence creation can be taken care of but the value is not incremented on the target database).
    another way that we thought of off the top of our heads is to have an on insert trigger (we only use sequences to generate surrogate keys) which will select nextval from the target database via a db link, but this seems somewhat cumbersome.
    What is best practice?

    Use sequence parameter... here is from Golden gate document:
    SEQUENCE
    Valid for Extract
    Use the SEQUENCE parameter to extract sequence values from the transaction log forpropagation to a GoldenGate trail and delivery to another database. Currently, GoldenGate supports sequences for the Oracle database.
    NOTE DDL support for sequences (CREATE, ALTER, DROP, RENAME) is compatible with, but not required for, replicating sequence values. To replicate just sequence values, you do not need to install the GoldenGate DDL support environment. You can just use the SEQUENCE parameter.
    GoldenGate ensures that the values of a target sequence are:
    ● higher than the source values if the increment interval is positive
    ● lower than the source values if the increment interval is negative
    Depending on the increment direction, Replicat applies one of the following formulas as a test when it performs an insert:
    source_highwater_value + (source_cache_size * source_increment_size * source_RAC_nodes) <= target_highwater_value
    Or...
    source_highwater_value + (source_cache_size * source_increment_size * source_RAC_nodes) >= target_highwater_value
    If the formula evaluates to FALSE, the target sequence is updated to be higher than the source value (if sequences are incremented) or lower than the source value (if sequences are decremented). The target must always be ahead of, or equal to, the expression in the parentheses in the formula. For example, if the source highwater value is 40, and CACHE is 20, and the source INCREMENTBY value is 1, and there are two source RAC nodes, the target highwater value should be at least 80:
    40 + (20*1*2) <80
    If the target highwater value is less than 80, GoldenGate updates the sequence to increase the highwater value, so that the target remains ahead of the source. To get the current highwater value, perform this query:
    SELECT last_number FROM all_sequences WHERE sequence_owner=upper('SEQUENCEOWNER') AND sequence_name=upper('SEQUENCENAME');

  • SWF conversion in images sequency (JPGs, GIF, MNG...)

    Hello,
    I have some SWF files to convert in MNG animation or images sequencies.
    (my developped software does not support SWF files. Alas!).
    To do that, I am looking for a reliable tool allowing either:
    - to convert SWF in MNG,
    - or to extract sequencies of pictures (PNGs, JPGs...), in order to build a MNG file after this step (thanks another soft).
    The SWF durations are 4s-8s, at 12fps.
    They are composed by just a frame (which is containing some images which are moving in loop; no interactive content).
    I tried to export an animation file with Adobe Flash CS4 with a SWF file, or a FLA file : it has not been successful.
    I tried some tools which seems working by 'screenshots' of the SWF frame : I have some results, but not very good.
    I do not have the Flash project which has been used to create SWF, but I can ask to my SWF provider some additionnal files which could be useful for my need (he is not an expert).
    So, I do not have any solutions for that (Adobe tool? Another?).
    Thanks for you help.

    Here's what my .htaccess file looks like. Don't know if it makes a difference, but all the rewrite engine commands are within an IfModule tag.
    <IfModule mod_rewrite.c>
    RewriteEngine on
    # This condition would allow access from no referrer
    # Remove the hash if needed
    # RewriteCond %{HTTP_REFERER} !^$
    # Allow access from mydomain.com and www.mydomain.com
    RewriteCond %{HTTP_REFERER} !^http://(www.)?mydomain.com/.*$ [NC]
    # Allow access from mydomain.com and www.mydomain.com on port 12854
    RewriteCond %{HTTP_REFERER} !^http://(www.)?mydomain.com:12854/.*$ [NC]
    # file types to control
    RewriteRule \.(gif|jpe?g|png)$ - [F]
    </IfModule>

  • Missing linefeed in extract

    Hi,
    we have a problem to extract an encoded(base64) pdf-document from a xmltype. The pdf-document is embedded in a node in a xml document. When we extract the valueof that node the carrige return and line feeds is missing. The statement looks like this:
    select extract( iipax_datapart ,'/msg:Anropsmeddelande/msg:Nyttolast/stgans:Stamningsansokan/stgans:Dokument/stgans:Dokumentinnehall/text()','xmlns:msg="se/rif/si/meddelande/v1" xmlns:stgans="se/rif/am/stamningsansokan/v1"').getclobval()
    from ink_iipax
    where status = 'NEW';
    We also tried getblobval(NLS_CHARSET_ID('AL32UTF8')) to an blob.
    If we load the same file from disk and encode it in a PL/SQL test script to a clob/blob, the size differs with the the same amount as rows in the files. The test file is correct. So my conclusion is that the extract from xmltype must remove the CR/LF.
    The database is 11g/r2.
    Any idea? Kjell

    Hi,
    I don't see any problem using this (simple) example :
    SQL> select * from v$version
      2  ;
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
    PL/SQL Release 11.2.0.1.0 - Production
    CORE     11.2.0.1.0     Production
    TNS for 32-bit Windows: Version 11.2.0.1.0 - Production
    NLSRTL Version 11.2.0.1.0 - Production
    SQL>
    SQL> WITH sample_data AS (
      2   select xmltype('<ns1:root xmlns:ns1="test.ns1" xmlns:ns2="test.ns2">
      3  <ns2:doc>TWFuIGlzIGRpc3Rpbmd1aXNoZWQsIG5vdCBvbmx5IGJ5IGhpcyByZWFzb24sIGJ1dCBieSB0aGlz
      4  IHNpbmd1bGFyIHBhc3Npb24gZnJvbSBvdGhlciBhbmltYWxzLCB3aGljaCBpcyBhIGx1c3Qgb2Yg
      5  dGhlIG1pbmQsIHRoYXQgYnkgYSBwZXJzZXZlcmFuY2Ugb2YgZGVsaWdodCBpbiB0aGUgY29udGlu
      6  dWVkIGFuZCBpbmRlZmF0aWdhYmxlIGdlbmVyYXRpb24gb2Yga25vd2xlZGdlLCBleGNlZWRzIHRo
      7  ZSBzaG9ydCB2ZWhlbWVuY2Ugb2YgYW55IGNhcm5hbCBwbGVhc3VyZS4=
      8  </ns2:doc>
      9  </ns1:root>') doc
    10  from dual
    11  )
    12  SELECT extract( t.doc,
    13                  '/ns1:root/ns2:doc/text()',
    14                  'xmlns:ns1="test.ns1", xmlns:ns2="test.ns2"'
    15         ).getClobVal()
    16         as base64str
    17  FROM sample_data t
    18  ;
    BASE64STR
    TWFuIGlzIGRpc3Rpbmd1aXNoZWQsIG5vdCBvbmx5IGJ5IGhpcyByZWFzb24sIGJ1dCBieSB0aGlz
    IHNpbmd1bGFyIHBhc3Npb24gZnJvbSBvdGhlciBhbmltYWxzLCB3aGljaCBpcyBhIGx1c3Qgb2Yg
    dGhlIG1pbmQsIHRoYXQgYnkgYSBwZXJzZXZlcmFuY2Ugb2YgZGVsaWdodCBpbiB0aGUgY29udGlu
    dWVkIGFuZCBpbmRlZmF0aWdhYmxlIGdlbmVyYXRpb24gb2Yga25vd2xlZGdlLCBleGNlZWRzIHRo
    ZSBzaG9ydCB2ZWhlbWVuY2Ugb2YgYW55IGNhcm5hbCBwbGVhc3VyZS4=
    In 11g, now, the recommended method is to use XMLCast/XMLQuery for single node extraction (or XMLTable to extract sequence).
    For example :
    WITH sample_data AS (
    select xmltype('<ns1:root xmlns:ns1="test.ns1" xmlns:ns2="test.ns2">
    <ns2:doc>TWFuIGlzIGRpc3Rpbmd1aXNoZWQsIG5vdCBvbmx5IGJ5IGhpcyByZWFzb24sIGJ1dCBieSB0aGlz
    IHNpbmd1bGFyIHBhc3Npb24gZnJvbSBvdGhlciBhbmltYWxzLCB3aGljaCBpcyBhIGx1c3Qgb2Yg
    dGhlIG1pbmQsIHRoYXQgYnkgYSBwZXJzZXZlcmFuY2Ugb2YgZGVsaWdodCBpbiB0aGUgY29udGlu
    dWVkIGFuZCBpbmRlZmF0aWdhYmxlIGdlbmVyYXRpb24gb2Yga25vd2xlZGdlLCBleGNlZWRzIHRo
    ZSBzaG9ydCB2ZWhlbWVuY2Ugb2YgYW55IGNhcm5hbCBwbGVhc3VyZS4=
    </ns2:doc>
    </ns1:root>') doc
    from dual
    SELECT xmlcast(
             xmlquery('declare namespace ns1="test.ns1"; declare namespace ns2="test.ns2"; (::)
                       /ns1:root/ns2:doc'
                       passing t.doc
                       returning content
             ) as clob
           as base64str
    FROM sample_data t
    ;Could you try this method with your data?

  • BPEL Copy operation of substitutionGroup

    Hi,
    I try to copy an element of a substitutionGroup (abstract element) to an string element.
    First of all JDeveloper designer wizard cannot do it, so I tried to edit the xy.bpel file.
    Does anybody has an example how tot do this?
    Thanks Alfred

    The EventsListener.wsdl part1:
    <?xml version="1.0" encoding="UTF-8"?>
    <!-- ********************************************************************************************************************* -->
    <!-- WSDL for the Event Listener Endpoints. -->
    <!-- This file defines the contract between the Event Manager and the Webservices Endpoints that will consume the Events. -->
    <!-- Please check the portType section for more information about the operation that are supported by the Event Manager. -->
    <!-- ********************************************************************************************************************* -->
    <wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
         xmlns:tns="http://www.bea.com/aler/events/eventsListenerWsdl/"
         xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
         xmlns:xsd="http://www.w3.org/2001/XMLSchema"
         xmlns:aler="http://www.bea.com/aler/events"
         xmlns:ns="http://www.bea.com/infra/events"
         xmlns:ns1="http://schemas.xmlsoap.org/soap/encoding/"
         name="eventsListener"
    xmlns:plnk="http://schemas.xmlsoap.org/ws/2003/05/partner-link/"
         targetNamespace="http://www.bea.com/aler/events/eventsListenerWsdl/">
         <wsdl:types>
              <!-- The following is the XML Schema that captures the Event Data that is published by the Event Producer-->
              <xs:schema targetNamespace="http://www.bea.com/infra/events"
                   xmlns:commonEvents="http://www.bea.com/infra/events"
                   xmlns:xs="http://www.w3.org/2001/XMLSchema"
                   xmlns="http://www.w3.org/2001/XMLSchema"
                   elementFormDefault="qualified" attributeFormDefault="unqualified">
                   <xs:annotation>
                        <xs:documentation>
                             Defines the common events structure
                        </xs:documentation>
                   </xs:annotation>
                   <xs:element name="newEventRequest" type="commonEvents:Event" />
                   <xs:element name="newEventRequestResponse" type="commonEvents:Event" />
                   <xs:element name="newEventRequestString" type="xs:string" />
                   <xs:element name="newEventRequestResponseString" type="xs:string" />
                   <xs:element name="Event" type="commonEvents:Event" />
                   <xs:complexType name="Event">
                        <xs:sequence>
                             <xs:element name="eventData"
                                  type="commonEvents:EventInfo" minOccurs="1" maxOccurs="1" />
                             <xs:element name="eventSource"
                                  type="commonEvents:EventSource" minOccurs="1" maxOccurs="1" />
                             <xs:element ref="commonEvents:ExtendedData"
                                  minOccurs="0" maxOccurs="1" />
                        </xs:sequence>
                   </xs:complexType>
                   <xs:complexType name="EventInfo">
                        <xs:sequence>
                             <xs:element name="name" type="xs:string" />
                             <xs:element name="eventId" type="xs:string" />
                             <xs:element name="description" type="xs:string" />
                             <xs:element name="version" type="xs:string" />
                        </xs:sequence>
                   </xs:complexType>
                   <xs:complexType name="EventSource">
                        <xs:sequence>
                             <xs:element name="location" type="xs:string" />
                             <xs:element name="componentName" type="xs:string" />
                             <xs:element name="componentType" type="xs:string" />
                        </xs:sequence>
                   </xs:complexType>
                   <xs:element name="ExtendedData"
                        type="commonEvents:ExtendedData" abstract="true" />
                   <xs:complexType name="ExtendedData" abstract="true" />
              </xs:schema>
              <xs:schema xmlns="http://www.w3.org/2001/XMLSchema"
                   xmlns:alerEvents="http://www.bea.com/aler/events"
                   xmlns:commonEvents="http://www.bea.com/infra/events"
                   xmlns:xs="http://www.w3.org/2001/XMLSchema"
                   attributeFormDefault="unqualified" elementFormDefault="qualified"
                   targetNamespace="http://www.bea.com/aler/events">
                   <xs:annotation>
                        <xs:documentation>
                             Defines the ALER events elements
                        </xs:documentation>
                   </xs:annotation>
                   <xs:element name="ALERExtendedData"
                        substitutionGroup="commonEvents:ExtendedData"
                        type="alerEvents:ALERExtendedData" />
                   <xs:complexType name="ALERExtendedData">
                        <complexContent>
                             <extension base="commonEvents:ExtendedData">
                                  <sequence>
                                       <xs:element maxOccurs="1" minOccurs="1"
                                            name="asset" type="alerEvents:Asset" />
                                       <xs:element maxOccurs="1" minOccurs="0"
                                            name="registrarEmail" type="xs:string" />
                                       <xs:element maxOccurs="1" minOccurs="1"
                                            name="updatedBy" type="alerEvents:User" />
                                  </sequence>
                             </extension>
                        </complexContent>
                   </xs:complexType>
                   <xs:element name="AssetTabApproved"
                        substitutionGroup="commonEvents:ExtendedData"
                        type="alerEvents:AssetTabApproved" />
                   <xs:complexType name="AssetTabApproved">
                        <complexContent>
                             <extension base="alerEvents:ALERExtendedData">
                                  <sequence>
                                       <xs:element maxOccurs="1" minOccurs="0"
                                            name="tabName" type="xs:string" />
                                  </sequence>
                             </extension>
                        </complexContent>
                   </xs:complexType>
                   <xs:element name="AssetAllTabApproved"
                        substitutionGroup="commonEvents:ExtendedData"
                        type="alerEvents:AssetAllTabApproved" />
                   <xs:complexType name="AssetAllTabApproved">
                        <complexContent>
                             <extension base="alerEvents:ALERExtendedData">
                                  <sequence></sequence>
                             </extension>
                        </complexContent>
                   </xs:complexType>
                   <xs:element name="AssetAccepted"
                        substitutionGroup="commonEvents:ExtendedData"
                        type="alerEvents:AssetAccepted" />
                   <xs:complexType name="AssetAccepted">
                        <complexContent>
                             <extension base="alerEvents:ALERExtendedData">
                                  <sequence>
                                       <xs:element maxOccurs="1" minOccurs="0"
                                            name="comment" type="xs:string" />
                                       <xs:element maxOccurs="1" minOccurs="0"
                                            name="submittedBy" type="alerEvents:User" />
                                  </sequence>
                             </extension>
                        </complexContent>
                   </xs:complexType>
                   <xs:element name="AssetAssign"
                        substitutionGroup="commonEvents:ExtendedData"
                        type="alerEvents:AssetAssign" />
                   <xs:complexType name="AssetAssign">
                        <complexContent>
                             <extension base="alerEvents:ALERExtendedData">
                                  <sequence>
                                       <xs:element maxOccurs="unbounded"
                                            minOccurs="0" name="assignedTo" type="alerEvents:User" />
                                  </sequence>
                             </extension>
                        </complexContent>
                   </xs:complexType>
                   <xs:element name="AssetRegistered"
                        substitutionGroup="commonEvents:ExtendedData"
                        type="alerEvents:AssetRegistered" />
                   <xs:complexType name="AssetRegistered">
                        <complexContent>
                             <extension base="alerEvents:ALERExtendedData">
                                  <sequence>
                                       <xs:element maxOccurs="1" minOccurs="0"
                                            name="comment" type="xs:string" />
                                       <xs:element maxOccurs="1" minOccurs="1"
                                            name="submittedBy" type="alerEvents:User" />
                                  </sequence>
                             </extension>
                        </complexContent>
                   </xs:complexType>
                   <xs:element name="AssetSubmissionRejected"
                        substitutionGroup="commonEvents:ExtendedData"
                        type="alerEvents:AssetSubmissionRejected" />
                   <xs:complexType name="AssetSubmissionRejected">
                        <complexContent>
                             <extension base="alerEvents:ALERExtendedData">
                                  <sequence>
                                       <xs:element maxOccurs="1" minOccurs="0"
                                            name="comment" type="xs:string" />
                                       <xs:element maxOccurs="1" minOccurs="1"
                                            name="submittedBy" type="alerEvents:User" />
                                  </sequence>
                             </extension>
                        </complexContent>
                   </xs:complexType>
                   <xs:element name="AssetTabUnApprove"
                        substitutionGroup="commonEvents:ExtendedData"
                        type="alerEvents:AssetTabUnApprove" />
                   <xs:complexType name="AssetTabUnApprove">
                        <complexContent>
                             <extension base="alerEvents:ALERExtendedData">
                                  <sequence>
                                       <xs:element maxOccurs="1" minOccurs="0"
                                            name="tabName" type="xs:string" />
                                       <xs:element maxOccurs="1" minOccurs="0"
                                            name="comment" type="xs:string" />
                                       <xs:element maxOccurs="unbounded"
                                            minOccurs="0" name="assignedTo" type="alerEvents:User" />
                                  </sequence>
                             </extension>
                        </complexContent>
                   </xs:complexType>
                   <xs:element name="AssetUnaccepted"
                        substitutionGroup="commonEvents:ExtendedData"
                        type="alerEvents:AssetUnaccepted" />
                   <xs:complexType name="AssetUnaccepted">
                        <complexContent>
                             <extension base="alerEvents:ALERExtendedData">
                                  <sequence>
                                       <xs:element maxOccurs="1" minOccurs="0"
                                            name="comment" type="xs:string" />
                                       <xs:element maxOccurs="1" minOccurs="1"
                                            name="submittedBy" type="alerEvents:User" />
                                  </sequence>
                             </extension>
                        </complexContent>
                   </xs:complexType>
                   <xs:element name="AssetUnassign"
                        substitutionGroup="commonEvents:ExtendedData"
                        type="alerEvents:AssetUnassign" />
                   <xs:complexType name="AssetUnassign">
                        <complexContent>
                             <extension base="alerEvents:ALERExtendedData">
                                  <sequence>
                                       <xs:element maxOccurs="unbounded"
                                            minOccurs="0" name="unassignedTo" type="alerEvents:User" />
                                  </sequence>
                             </extension>
                        </complexContent>
                   </xs:complexType>
                   <xs:element name="AssetUnregistered"
                        substitutionGroup="commonEvents:ExtendedData"
                        type="alerEvents:AssetUnregistered" />
                   <xs:complexType name="AssetUnregistered">
                        <complexContent>
                             <extension base="commonEvents:ExtendedData">
                                  <sequence>
                                       <xs:element maxOccurs="1" minOccurs="1"
                                            name="asset" type="alerEvents:Asset" />
                                       <xs:element maxOccurs="1" minOccurs="0"
                                            name="registrarEmail" type="xs:string" />
                                       <xs:element maxOccurs="1" minOccurs="0"
                                            name="comment" type="xs:string" />
                                       <xs:element maxOccurs="1" minOccurs="1"
                                            name="updatedBy" type="alerEvents:User" />
                                  </sequence>
                             </extension>
                        </complexContent>
                   </xs:complexType>
                   <xs:element name="AssetUnsubmitted"
                        substitutionGroup="commonEvents:ExtendedData"
                        type="alerEvents:AssetUnsubmitted" />
                   <xs:complexType name="AssetUnsubmitted">
                        <complexContent>
                             <extension base="alerEvents:ALERExtendedData">
                                  <sequence>
                                       <xs:element maxOccurs="1" minOccurs="0"
                                            name="comment" type="xs:string" />
                                       <xs:element maxOccurs="1" minOccurs="1"
                                            name="submittedBy" type="alerEvents:User" />
                                  </sequence>
                             </extension>
                        </complexContent>
                   </xs:complexType>
                   <xs:element name="ComplianceTemplateApplied"
                        substitutionGroup="commonEvents:ExtendedData"
                        type="alerEvents:ComplianceTemplateApplied" />
                   <xs:complexType name="ComplianceTemplateApplied">
                        <complexContent>
                             <extension base="alerEvents:ALERExtendedData">
                                  <sequence>
                                       <xs:element maxOccurs="1" minOccurs="0"
                                            name="projectId" type="xs:long" />
                                       <xs:element maxOccurs="unbounded"
                                            minOccurs="0" name="projectLeaders" type="alerEvents:User" />
                                  </sequence>
                             </extension>
                        </complexContent>
                   </xs:complexType>
                   <xs:element name="NewVersionRegistered"
                        substitutionGroup="commonEvents:ExtendedData"
                        type="alerEvents:NewVersionRegistered" />
                   <xs:complexType name="NewVersionRegistered">
                        <complexContent>
                             <extension base="alerEvents:ALERExtendedData">
                                  <sequence>
                                       <xs:element maxOccurs="1" minOccurs="1"
                                            name="newAsset" type="alerEvents:Asset" />
                                       <xs:element maxOccurs="1" minOccurs="0"
                                            name="comment" type="xs:string" />
                                  </sequence>
                             </extension>
                        </complexContent>
                   </xs:complexType>
                   <xs:element name="AssetStatusChanged"
                        substitutionGroup="commonEvents:ExtendedData"
                        type="alerEvents:AssetStatusChanged" />
                   <xs:complexType name="AssetStatusChanged">
                        <complexContent>
                             <extension base="alerEvents:ALERExtendedData">
                                  <sequence>
                                       <xs:element maxOccurs="1" minOccurs="0"
                                            name="comment" type="xs:string" />
                                       <xs:element maxOccurs="1" minOccurs="1"
                                            name="submittedBy" type="alerEvents:User" />
                                       <xs:element maxOccurs="unbounded"
                                            minOccurs="1" name="parameters" type="alerEvents:MultiUseParam" />
                                  </sequence>
                             </extension>
                        </complexContent>
                   </xs:complexType>
                   <xs:element name="AssetSubmission"
                        substitutionGroup="commonEvents:ExtendedData"
                        type="alerEvents:AssetSubmission" />
                   <xs:complexType name="AssetSubmission">
                        <complexContent>
                             <extension base="commonEvents:ExtendedData">
                                  <sequence>
                                       <xs:element maxOccurs="1" minOccurs="1"
                                            name="asset" type="alerEvents:Asset" />
                                       <xs:element maxOccurs="1" minOccurs="0"
                                            name="registrarEmail" type="xs:string" />
                                       <xs:element maxOccurs="1" minOccurs="0"
                                            name="source" type="xs:string" />
                                       <xs:element maxOccurs="1" minOccurs="1"
                                            name="submittedBy" type="alerEvents:User" />
                                  </sequence>
                             </extension>
                        </complexContent>
                   </xs:complexType>
                   <xs:element name="ExtractionIntialNotify"
                        substitutionGroup="commonEvents:ExtendedData"
                        type="alerEvents:ExtractionIntialNotify" />
                   <xs:complexType name="ExtractionIntialNotify">
                        <complexContent>
                             <extension base="commonEvents:ExtendedData">
                                  <sequence>
                                       <xs:element maxOccurs="1" minOccurs="1"
                                            name="extraction" type="alerEvents:Extraction" />
                                  </sequence>
                             </extension>
                        </complexContent>
                   </xs:complexType>
                   <xs:element name="ExtractionReassign"
                        substitutionGroup="commonEvents:ExtendedData"
                        type="alerEvents:ExtractionReassign" />
                   <xs:complexType name="ExtractionReassign">
                        <complexContent>
                             <extension base="commonEvents:ExtendedData">
                                  <sequence>
                                       <xs:element maxOccurs="1" minOccurs="1"
                                            name="extraction" type="alerEvents:Extraction" />
                                       <xs:element maxOccurs="1" minOccurs="1"
                                            name="reassignedTo" type="alerEvents:User" />
                                       <xs:element maxOccurs="1" minOccurs="1"
                                            name="invokedBy" type="alerEvents:User" />
                                       <xs:element maxOccurs="1" minOccurs="1"
                                            name="comment" type="xs:string" />
                                  </sequence>
                             </extension>
                        </complexContent>
                   </xs:complexType>
                   <xs:element name="ExtractionStatusChanged"
                        substitutionGroup="commonEvents:ExtendedData"
                        type="alerEvents:ExtractionStatusChanged" />
                   <xs:complexType name="ExtractionStatusChanged">
                        <complexContent>
                             <extension base="commonEvents:ExtendedData">
                                  <sequence>
                                       <xs:element maxOccurs="1" minOccurs="1"
                                            name="extraction" type="alerEvents:Extraction" />
                                  </sequence>
                             </extension>
                        </complexContent>
                   </xs:complexType>
                   <xs:element name="ExtractionSubsequentNotify"
                        substitutionGroup="commonEvents:ExtendedData"
                        type="alerEvents:ExtractionSubsequentNotify" />
                   <xs:complexType name="ExtractionSubsequentNotify">
                        <complexContent>
                             <extension base="commonEvents:ExtendedData">
                                  <sequence>
                                       <xs:element maxOccurs="1" minOccurs="1"
                                            name="extraction" type="alerEvents:Extraction" />
                                  </sequence>
                             </extension>
                        </complexContent>
                   </xs:complexType>
                   <xs:element name="RelatedAssetRegister"
                        substitutionGroup="commonEvents:ExtendedData"
                        type="alerEvents:RelatedAssetRegister" />
                   <xs:complexType name="RelatedAssetRegister">
                        <complexContent>
                             <extension base="commonEvents:ExtendedData">
                                  <sequence>
                                       <xs:element maxOccurs="1" minOccurs="1"
                                            name="originalAsset" type="alerEvents:Asset" />
                                       <xs:element maxOccurs="1" minOccurs="1"
                                            name="relatedAsset" type="alerEvents:Asset" />
                                       <xs:element maxOccurs="1" minOccurs="1"
                                            name="relation" type="alerEvents:Relationship" />
                                  </sequence>
                             </extension>
                        </complexContent>
                   </xs:complexType>
                   <xs:element name="MetaDataChanged"
                        substitutionGroup="commonEvents:ExtendedData"
                        type="alerEvents:MetaDataChanged" />
                   <xs:complexType name="MetaDataChanged">
                        <complexContent>
                             <extension base="alerEvents:MultiUse">
                                  <sequence>
                                       <xs:element maxOccurs="1" minOccurs="0"
                                            name="submittedBy" type="alerEvents:User" />
                                       <xs:element maxOccurs="unbounded"
                                            minOccurs="0" name="subscribedBy" type="alerEvents:User" />
                                  </sequence>
                             </extension>
                        </complexContent>
                   </xs:complexType>
                   <xs:element name="RegistrationStatusChanged"
                        substitutionGroup="commonEvents:ExtendedData"
                        type="alerEvents:RegistrationStatusChanged" />
                   <xs:complexType name="RegistrationStatusChanged">
                        <complexContent>
                             <extension base="alerEvents:MultiUse"></extension>
                        </complexContent>
                   </xs:complexType>
                   <xs:element name="CategorizationChanged"
                        substitutionGroup="commonEvents:ExtendedData"
                        type="alerEvents:CategorizationStatusChanged" />
                   <xs:complexType name="CategorizationStatusChanged">
                        <complexContent>
                             <extension base="alerEvents:MultiUse"></extension>
                        </complexContent>
                   </xs:complexType>
                   <xs:element name="PolicyAssertionChanged"
                        substitutionGroup="commonEvents:ExtendedData"
                        type="alerEvents:PolicyAssertionChanged" />
                   <xs:complexType name="PolicyAssertionChanged">
                        <complexContent>
                             <extension base="alerEvents:MultiUse"></extension>
                        </complexContent>
                   </xs:complexType>
                   <xs:element name="MultiUse"
                        substitutionGroup="commonEvents:ExtendedData"
                        type="alerEvents:MultiUse" />
                   <xs:complexType name="MultiUse">
                        <complexContent>
                             <extension base="commonEvents:ExtendedData">
                                  <sequence>
                                       <xs:element maxOccurs="1" minOccurs="1"
                                            name="asset" type="alerEvents:Asset" />
                                       <xs:element maxOccurs="1" minOccurs="1"
                                            name="type" type="xs:string" />
                                       <xs:element maxOccurs="unbounded"
                                            minOccurs="1" name="parameters" type="alerEvents:MultiUseParam" />
                                  </sequence>
                             </extension>
                        </complexContent>
                   </xs:complexType>
                   <xs:complexType name="MultiUseParam">
                        <xs:annotation>
                             <xs:documentation>
                                  Defines the name value pairs for multi use event
                             </xs:documentation>
                        </xs:annotation>
                        <xs:sequence>
                             <xs:element name="name" type="xs:string" />
                             <xs:element maxOccurs="unbounded" minOccurs="1"
                                  name="value" type="xs:string" />
                        </xs:sequence>
                   </xs:complexType>
                   <xs:complexType name="Asset">
                        <xs:annotation>
                             <xs:documentation>
                                  Defines the asset information
                             </xs:documentation>
                        </xs:annotation>
                        <xs:sequence>
                             <xs:element name="id" type="xs:long" />
                             <xs:element name="name" type="xs:string" />
                             <xs:element name="version" type="xs:string" />
                             <xs:element name="description" type="xs:string" />
                             <xs:element name="typeID" type="xs:long" />
                             <xs:element name="activeStatus">
                                  <xs:simpleType>
                                       <xs:restriction base="xs:string">
                                            <xs:enumeration value="ACTIVE" />
                                            <xs:enumeration value="INACTIVE" />
                                            <xs:enumeration value="RETIRED" />
                                            <xs:enumeration value="DELETED" />
                                            <xs:enumeration value="INCOMPLETE" />
                                       </xs:restriction>
                                  </xs:simpleType>
                             </xs:element>
                             <xs:element maxOccurs="unbounded" minOccurs="0"
                                  name="producingProjectsId" type="xs:long" />
                             <xs:element maxOccurs="1" minOccurs="0"
                                  name="community" type="xs:string" />
                        </xs:sequence>
                   </xs:complexType>
                   <xs:complexType name="User">
                        <xs:annotation>
                             <xs:documentation>
                                  Defines the user information
                             </xs:documentation>
                        </xs:annotation>
                        <xs:sequence>
                             <xs:element name="id" type="xs:long" />
                             <xs:element name="name" type="xs:string" />
                             <xs:element name="firstName" type="xs:string" />
                             <xs:element name="lastName" type="xs:string" />
                             <xs:element name="emailAddress" type="xs:string" />
                        </xs:sequence>
                   </xs:complexType>
                   <xs:complexType name="Extraction">
                        <xs:annotation>
                             <xs:documentation>
                                  Defines the extraction information
                             </xs:documentation>
                        </xs:annotation>
                        <xs:sequence>
                             <xs:element name="id" type="xs:long" />
                             <xs:element name="asset" type="alerEvents:Asset" />
                             <xs:element name="user" type="alerEvents:User" />
                             <xs:element name="projectName" type="xs:string" />
                        </xs:sequence>
                   </xs:complexType>
                   <xs:complexType name="Relationship">
                        <xs:annotation>
                             <xs:documentation>
                                  Defines the relation between two assets
                             </xs:documentation>
                        </xs:annotation>
                        <xs:sequence>
                             <xs:element name="id" type="xs:long" />
                             <xs:element name="name" type="xs:string" />
                             <xs:element name="entityType" type="xs:string" />
                             <xs:element name="direction" type="xs:string" />
                        </xs:sequence>
                   </xs:complexType>
              </xs:schema>
              <xs:schema targetNamespace="http://www.bea.com/aler/events/wsdl/elements"
                   xmlns:commonEvents="http://www.bea.com/infra/events"
                   xmlns:xs="http://www.w3.org/2001/XMLSchema"
                   xmlns="http://www.w3.org/2001/XMLSchema"
                   elementFormDefault="qualified" attributeFormDefault="unqualified">
              </xs:schema>
              <xsd:schema
                   targetNamespace="http://www.bea.com/infra/events/workflow/status">
                   <xsd:simpleType name="InstanceStatusEnumeration">
                        <xsd:restriction base="xsd:string">
                             <xsd:enumeration value="RUNNING" />
                             <xsd:enumeration value="EXCEPTION" />
                             <xsd:enumeration value="SUSPENDED" />
                             <xsd:enumeration value="GRABBED" />
                             <xsd:enumeration value="COMPLETED" />
                             <xsd:enumeration value="ABORTED" />
                             <xsd:enumeration value="ACTIVITY_COMPLETED" />
                        </xsd:restriction>
                   </xsd:simpleType>
              </xsd:schema>
         </wsdl:types>
         <wsdl:message name="newEventRequestResponseRequest">
              <wsdl:part name="event" element="ns:newEventRequestResponse" />
         </wsdl:message>
         <wsdl:message name="newEventRequestResponseResponse">
              <wsdl:part name="status" type="xsd:string" />
         </wsdl:message>
         <wsdl:message name="newEventRequestResponseStringRequest">
              <wsdl:part name="event" element="ns:newEventRequestResponseString" />
         </wsdl:message>
         <wsdl:message name="newEventRequestResponseStringResponse">
              <wsdl:part name="status" type="xsd:string" />
         </wsdl:message>
         <wsdl:message name="newEventRequest">
              <wsdl:part name="event" element="ns:newEventRequest" />
         </wsdl:message>
         <wsdl:message name="newEventRequestString">
              <wsdl:part name="event" element="ns:newEventRequestString" />
         </wsdl:message>
         <wsdl:message name="newEventRequestSessionRequest">
              <wsdl:part name="sessionId" type="xsd:string" />
              <wsdl:part name="eventString" type="xsd:string" />
         </wsdl:message>
         <wsdl:message name="newEventRequestSessionResponse">
              <wsdl:part name="status" type="xsd:string" />
         </wsdl:message>
         <wsdl:message name="startSessionRequest">
              <wsdl:part name="user" type="xsd:string" />
              <wsdl:part name="password" type="xsd:string" />
         </wsdl:message>
         <wsdl:message name="startSessionResponse">
              <wsdl:part name="return" type="xsd:string" />
         </wsdl:message>
         <wsdl:message name="discardSessionRequest">
              <wsdl:part name="sessionId" type="xsd:string" />
         </wsdl:message>
         <wsdl:message name="discardSessionResponse" />
         <wsdl:message name="OperationException">
              <wsdl:part name="message" type="xsd:string" />
              <wsdl:part name="technicalInfo" type="xsd:string" />
         </wsdl:message>
         <wsdl:portType name="eventPortType">
              <!-- This operation takes the Event object that is defined in the XML Schemas section as an input and
              and returns the staus as the output. The status is defined as string type. Additionally, if the
              status string starts with Failure, then the Event Engine will throw an Exception and will try to
              redeliver the event until it suceeds. If not, it will log the response and will deliver the next Event unless
              there is a transport exception -->
              <wsdl:operation name="newEventRequestResponse">
                   <wsdl:input message="tns:newEventRequestResponseRequest" />
                   <wsdl:output
                        message="tns:newEventRequestResponseResponse">
                   </wsdl:output>
              </wsdl:operation>
              <!-- This operation takes the Event data in string form as an input and
              returns the staus as the output. The status is defined as string type. Additionally, if the
              status string starts with Failure, then the Event Engine will throw an Exception and will try to
              redeliver the event until it suceeds. If not, it will log the response and will deliver the next Event unless
              there is a transport exception -->
              <wsdl:operation name="newEventRequestResponseString">
                   <wsdl:input
                        message="tns:newEventRequestResponseStringRequest" />
                   <wsdl:output
                        message="tns:newEventRequestResponseStringResponse">
                   </wsdl:output>
              </wsdl:operation>
              <!-- This operation takes the Event object that is defined in the XML Schemas section as an input and
              is defined as oneway operation. The status is defined as string type. Additionally, if the
              status string starts with Failure, then the Event Engine will throw an Exception and will try to
              redeliver the event until it suceeds. If not, it will log the response and will deliver the next Event unless
              there is a transport exception -->
              <wsdl:operation name="newEventRequest">
                   <wsdl:input message="tns:newEventRequest" />
              </wsdl:operation>
              <!-- This operation takes the Event data in string form as an input and is defined as oneway operation.
              The status is defined as string type. Additionally, if the
              status string starts with Failure, then the Event Engine will throw an Exception and will try to
              redeliver the event until it suceeds. If not, it will log the response and will deliver the next Event unless
              there is a transport exception -->
              <wsdl:operation name="newEventRequestString">
                   <wsdl:input message="tns:newEventRequestString" />
              </wsdl:operation>
              <!-- THIS OPERATION SHOULD ONLY BE USED IF THE WORKFLOW ENGINE IS ALBPM. This operation internally invokes
              startSession operation to start session to authenticate with ALBPM. It will also call discardSession after the
              invocation -->
              <wsdl:operation name="newEvent"
                   parameterOrder="sessionId eventString">
                   <wsdl:input message="tns:newEventRequestSessionRequest" />
                   <wsdl:output message="tns:newEventRequestSessionResponse" />
                   <wsdl:fault name="OperationException"
                        message="tns:OperationException" />
              </wsdl:operation>
              <!-- THIS OPERATION SHOULD ONLY BE USED IF THE WORKFLOW ENGINE IS ALBPM. -->
              <wsdl:operation name="startSession"
                   parameterOrder="user password">
                   <wsdl:input message="tns:startSessionRequest" />
                   <wsdl:output message="tns:startSessionResponse" />
                   <wsdl:fault name="OperationException"
                        message="tns:OperationException" />
              </wsdl:operation>
              <!-- THIS OPERATION SHOULD ONLY BE USED IF THE WORKFLOW ENGINE IS ALBPM. -->
              <wsdl:operation name="discardSession"
                   parameterOrder="sessionId">
                   <wsdl:input message="tns:discardSessionRequest" />
                   <wsdl:output message="tns:discardSessionResponse" />
              </wsdl:operation>
         </wsdl:portType>

  • Extract parent and child data from an XML sequence?

    I'm very new to XML, so please excuse me if I use incorrect terminology here. I've been given a schema definition (.xsd), and several sample xml files from which I need to extract data and insert it into relational tables. I've made some progress in that I've been able to hack enough to modify and register the schema and get the XML into the database both through the registered schema and into a separate table with an XMLType column. I've also been able to use the isSchemaValid function to validate the XML against the schema definition, and I've been able to extract some of the simple data elements via the extractValue function. My problem is with extracting some of the nested data - that is, extracting parent node elements and child node elements together where there is more than one value in the child node. BTW. I'm on Oracle 10gR2.
    Following are the .xsd and and sample XML. Specifically, I need to select the NPI value from the PROVIDER node, and associate it with each of the CODE values from the SPECIALTIES node (which is part of the PROVIDER node).
    Here's the .xsd (sorry, it's very long). The only modifications I've made to the schema definition are to add the xdb namespace and the "xdb:defaultTable="HMOSCHEMA" snippet:
    <?xml version="1.0" encoding="UTF-8"?>
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:xdb="http://xmlns.oracle.com/xdb" version="1.0">
    <xsd:element name="HMO" xdb:defaultTable="HMOSCHEMA">
    <xsd:complexType>
    <xsd:sequence>
    <xsd:element ref="HMO_GENERAL_INFORMATION" />
    <xsd:element ref="PROVIDERS" />
    <xsd:element ref="FACILITIES" minOccurs="0"
    maxOccurs="1" />
    </xsd:sequence>
    <xsd:attribute name="DATE" type="xsd:string" />
    </xsd:complexType>
    </xsd:element>
    <xsd:element name="HMO_GENERAL_INFORMATION">
    <xsd:complexType>
    <xsd:sequence>
    <xsd:element ref="MCO_ID_LIST" minOccurs="1" maxOccurs="1" />
    <xsd:element ref="HMO_WEBSITE_ADDRESS" minOccurs="1"
    maxOccurs="1" />
    <xsd:element ref="HMO_SPECIAL_SERVICES" minOccurs="0"
    maxOccurs="1" />
    <xsd:element ref="HMO_DAILY_CONTACT_EMAIL_ADDRESS"
    minOccurs="1" maxOccurs="1" />
    <xsd:element ref="HMO_MONTHLY_CONTACT_EMAIL_ADDRESS"
    minOccurs="1" maxOccurs="1" />
    </xsd:sequence>
    </xsd:complexType>
    </xsd:element>
    <xsd:element name="PROVIDERS">
    <xsd:complexType>
    <xsd:sequence>
    <xsd:element maxOccurs="unbounded" ref="PROVIDER" />
    </xsd:sequence>
    <xsd:attribute name="RECORDS" type="xsd:string" />
    </xsd:complexType>
    </xsd:element>
    <xsd:element name="PROVIDER">
    <xsd:complexType>
    <xsd:sequence minOccurs="1" maxOccurs="unbounded">
    <xsd:element ref="NPI" minOccurs="1" maxOccurs="1" />
    <xsd:element ref="FIRST_NAME" minOccurs="1"
    maxOccurs="1" />
    <xsd:element ref="LAST_NAME" minOccurs="1"
    maxOccurs="1" />
    <xsd:element ref="MIDDLE_INITIAL" minOccurs="0"
    maxOccurs="1" />
    <xsd:element ref="GENDER" minOccurs="1" maxOccurs="1" />
    <xsd:element ref="LINE_1_ADDRESS" minOccurs="1"
    maxOccurs="1" />
    <xsd:element ref="LINE_2_ADDRESS" minOccurs="0"
    maxOccurs="1" />
    <xsd:element ref="CITY" minOccurs="1" maxOccurs="1" />
    <xsd:element ref="STATE" minOccurs="1" maxOccurs="1" />
    <xsd:element ref="ZIP" minOccurs="1" maxOccurs="1" />
    <xsd:element ref="COUNTY" minOccurs="0" maxOccurs="1" />
    <xsd:element ref="PHONE_NUMBER" minOccurs="1"
    maxOccurs="1" />
    <xsd:element ref="CLINIC_NAME" minOccurs="0"
    maxOccurs="1" />
    <xsd:element ref="CLINIC_TYPE" minOccurs="0"
    maxOccurs="1" />
    <xsd:element ref="CLINIC_NPI" minOccurs="0"
    maxOccurs="1" />
    <xsd:element ref="PROVIDER_OFFICE_HOURS_TENTHS"
    minOccurs="0" maxOccurs="1" />
    <xsd:element ref="MAXIMUM_PATIENTS" minOccurs="0"
    maxOccurs="1" />
    <xsd:element ref="ACCEPT_NEW_PATIENT" minOccurs="0"
    maxOccurs="1" />
    <xsd:element ref="PRIMARY_CARE_INDICATOR" minOccurs="0"
    maxOccurs="1" />
    <xsd:element ref="FOREIGN_LANGUAGES" minOccurs="0"
    maxOccurs="1" />
    <xsd:element ref="SPECIALTIES" minOccurs="1"
    maxOccurs="1" />
    </xsd:sequence>
    </xsd:complexType>
    </xsd:element>
    <xsd:element name="SPECIALTIES">
    <xsd:complexType>
    <xsd:sequence>
    <xsd:element maxOccurs="unbounded" name="CODE"
    minOccurs="1">
    <xsd:simpleType>
    <xsd:restriction base="xsd:string">
    <xsd:pattern value="[0-9]{3}" />
    <xsd:whiteSpace value="collapse" />
    </xsd:restriction>
    </xsd:simpleType>
    </xsd:element>
    </xsd:sequence>
    </xsd:complexType>
    </xsd:element>
    <xsd:element name="FACILITIES">
    <xsd:complexType>
    <xsd:sequence>
    <xsd:element maxOccurs="unbounded" ref="FACILITY_NUM"
    minOccurs="0" />
    </xsd:sequence>
    <xsd:attribute name="RECORDS" type="xsd:string" />
    </xsd:complexType>
    </xsd:element>
    <xsd:element name="FOREIGN_LANGUAGES">
    <xsd:complexType>
    <xsd:sequence>
    <xsd:element maxOccurs="unbounded" name="CODE"
    minOccurs="0">
    <xsd:simpleType>
    <xsd:restriction base="xsd:string">
    <xsd:pattern value="[A-Z]{3}" />
    <xsd:pattern value="[a-z]{3}" />
    <xsd:pattern value="" />
    <xsd:whiteSpace value="collapse" />
    </xsd:restriction>
    </xsd:simpleType>
    </xsd:element>
    </xsd:sequence>
    </xsd:complexType>
    </xsd:element>
    <xsd:element name="HMO_SPECIAL_SERVICES">
    <xsd:complexType>
    <xsd:sequence>
    <xsd:element maxOccurs="unbounded" name="CODE"
    minOccurs="0">
    <xsd:simpleType>
    <xsd:restriction base="xsd:string">
    <xsd:pattern value="[0-9]{2}" />
    <xsd:pattern value="" />
    <xsd:whiteSpace value="collapse" />
    </xsd:restriction>
    </xsd:simpleType>
    </xsd:element>
    </xsd:sequence>
    </xsd:complexType>
    </xsd:element>
    <xsd:element name="MCO_ID_LIST">
    <xsd:complexType>
    <xsd:sequence>
    <xsd:element name="MCO_ID" minOccurs="1" maxOccurs="unbounded">
    <xsd:simpleType>
    <xsd:restriction base="xsd:string">
    <xsd:pattern value="[0-9]{1}" />
    <xsd:pattern value="[0-9]{2}" />
    <xsd:pattern value="[0-9]{3}" />
    <xsd:pattern value="[0-9]{4}" />
    <xsd:pattern value="[0-9]{5}" />
    <xsd:pattern value="[0-9]{6}" />
    <xsd:pattern value="[0-9]{7}" />
    <xsd:pattern value="[0-9]{8}" />
    <xsd:whiteSpace value="collapse" />
    </xsd:restriction>
    </xsd:simpleType>
    </xsd:element>
    </xsd:sequence>
    </xsd:complexType>
    </xsd:element>
    <xsd:element name="HMO_WEBSITE_ADDRESS">
    <xsd:simpleType>
    <xsd:restriction base="xsd:string">
    <xsd:minLength value="1" />
    <xsd:maxLength value="100" />
    <xsd:whiteSpace value="collapse" />
    </xsd:restriction>
    </xsd:simpleType>
    </xsd:element>
    <xsd:element name="HMO_DAILY_CONTACT_EMAIL_ADDRESS">
    <xsd:simpleType>
    <xsd:restriction base="xsd:string">
    <xsd:minLength value="1" />
    <xsd:maxLength value="50" />
    <xsd:whiteSpace value="collapse" />
    </xsd:restriction>
    </xsd:simpleType>
    </xsd:element>
    <xsd:element name="HMO_MONTHLY_CONTACT_EMAIL_ADDRESS">
    <xsd:simpleType>
    <xsd:restriction base="xsd:string">
    <xsd:minLength value="1" />
    <xsd:maxLength value="50" />
    <xsd:whiteSpace value="collapse" />
    </xsd:restriction>
    </xsd:simpleType>
    </xsd:element>
    <xsd:element name="NPI">
    <xsd:simpleType>
    <xsd:restriction base="xsd:string">
    <xsd:pattern value="[0-9]{1}" />
    <xsd:pattern value="[0-9]{2}" />
    <xsd:pattern value="[0-9]{3}" />
    <xsd:pattern value="[0-9]{4}" />
    <xsd:pattern value="[0-9]{5}" />
    <xsd:pattern value="[0-9]{6}" />
    <xsd:pattern value="[0-9]{7}" />
    <xsd:pattern value="[0-9]{8}" />
    <xsd:pattern value="[0-9]{9}" />
    <xsd:pattern value="[0-9]{10}" />
    <xsd:whiteSpace value="collapse" />
    </xsd:restriction>
    </xsd:simpleType>
    </xsd:element>
    <xsd:element name="FIRST_NAME">
    <xsd:simpleType>
    <xsd:restriction base="xsd:string">
    <xsd:minLength value="1" />
    <xsd:whiteSpace value="collapse" />
    </xsd:restriction>
    </xsd:simpleType>
    </xsd:element>
    <xsd:element name="LAST_NAME">
    <xsd:simpleType>
    <xsd:restriction base="xsd:string">
    <xsd:minLength value="1" />
    <xsd:whiteSpace value="collapse" />
    </xsd:restriction>
    </xsd:simpleType>
    </xsd:element>
    <xsd:element name="MIDDLE_INITIAL">
    <xsd:simpleType>
    <xsd:restriction base="xsd:string">
    <xsd:minLength value="0" />
    <xsd:maxLength value="1" />
    <xsd:whiteSpace value="collapse" />
    </xsd:restriction>
    </xsd:simpleType>
    </xsd:element>
    <xsd:element name="GENDER">
    <xsd:simpleType>
    <xsd:restriction base="xsd:string">
    <xsd:minLength value="0" />
    <xsd:maxLength value="1" />
    <xsd:whiteSpace value="collapse" />
    </xsd:restriction>
    </xsd:simpleType>
    </xsd:element>
    <xsd:element name="LINE_1_ADDRESS">
    <xsd:simpleType>
    <xsd:restriction base="xsd:string">
    <xsd:minLength value="1" />
    <xsd:whiteSpace value="collapse" />
    </xsd:restriction>
    </xsd:simpleType>
    </xsd:element>
    <xsd:element name="LINE_2_ADDRESS">
    <xsd:simpleType>
    <xsd:restriction base="xsd:string">
    <xsd:minLength value="0" />
    <xsd:whiteSpace value="collapse" />
    </xsd:restriction>
    </xsd:simpleType>
    </xsd:element>
    <xsd:element name="CITY">
    <xsd:simpleType>
    <xsd:restriction base="xsd:string">
    <xsd:minLength value="1" />
    <xsd:whiteSpace value="collapse" />
    </xsd:restriction>
    </xsd:simpleType>
    </xsd:element>
    <xsd:element name="STATE">
    <xsd:simpleType>
    <xsd:restriction base="xsd:string">
    <xsd:pattern value="[a-zA-Z][a-zA-Z]" />
    <xsd:whiteSpace value="collapse" />
    </xsd:restriction>
    </xsd:simpleType>
    </xsd:element>
    <xsd:element name="ZIP">
    <xsd:simpleType>
    <xsd:restriction base="xsd:string">
    <xsd:pattern value="[0-9]{5}" />
    <xsd:pattern value="[0-9]{9}" />
    <xsd:whiteSpace value="collapse" />
    </xsd:restriction>
    </xsd:simpleType>
    </xsd:element>
    <xsd:element name="COUNTY">
    <xsd:simpleType>
    <xsd:restriction base="xsd:string">
    <xsd:pattern value="[0-9]{1}" />
    <xsd:pattern value="[0-9]{2}" />
    <xsd:pattern value="[0-9]{3}" />
    <xsd:pattern value="" />
    <xsd:whiteSpace value="collapse" />
    </xsd:restriction>
    </xsd:simpleType>
    </xsd:element>
    <xsd:element name="PHONE_NUMBER">
    <xsd:simpleType>
    <xsd:restriction base="xsd:string">
    <xsd:pattern value="[0-9]{10}" />
    <xsd:whiteSpace value="collapse" />
    </xsd:restriction>
    </xsd:simpleType>
    </xsd:element>
    <xsd:element name="CLINIC_NAME">
    <xsd:simpleType>
    <xsd:restriction base="xsd:string">
    <xsd:minLength value="0" />
    <xsd:pattern value="" />
    <xsd:whiteSpace value="collapse" />
    </xsd:restriction>
    </xsd:simpleType>
    </xsd:element>
    <xsd:element name="CLINIC_TYPE">
    <xsd:simpleType>
    <xsd:restriction base="xsd:string">
    <xsd:minLength value="0" />
    <xsd:pattern value="" />
    <xsd:whiteSpace value="collapse" />
    </xsd:restriction>
    </xsd:simpleType>
    </xsd:element>
    <xsd:element name="CLINIC_NPI">
    <xsd:simpleType>
    <xsd:restriction base="xsd:string">
    <xsd:pattern value="[0-9]{1}" />
    <xsd:pattern value="[0-9]{2}" />
    <xsd:pattern value="[0-9]{3}" />
    <xsd:pattern value="[0-9]{4}" />
    <xsd:pattern value="[0-9]{5}" />
    <xsd:pattern value="[0-9]{6}" />
    <xsd:pattern value="[0-9]{7}" />
    <xsd:pattern value="[0-9]{8}" />
    <xsd:pattern value="[0-9]{9}" />
    <xsd:pattern value="[0-9]{10}" />
    <xsd:pattern value="" />
    <xsd:whiteSpace value="collapse"/>
    </xsd:restriction>
    </xsd:simpleType>
    </xsd:element>
    <xsd:element name="PROVIDER_OFFICE_HOURS_TENTHS">
    <xsd:simpleType>
    <xsd:restriction base="xsd:string">
    <xsd:pattern value="[0-9]{1}" />
    <xsd:pattern value="[0-9]{2}" />
    <xsd:pattern value="" />
    <xsd:whiteSpace value="collapse" />
    </xsd:restriction>
    </xsd:simpleType>
    </xsd:element>
    <xsd:element name="MAXIMUM_PATIENTS">
    <xsd:simpleType>
    <xsd:restriction base="xsd:string">
    <xsd:pattern value="[0-9]{1}" />
    <xsd:pattern value="[0-9]{2}" />
    <xsd:pattern value="[0-9]{3}" />
    <xsd:pattern value="[0-9]{4}" />
    <xsd:pattern value="" />
    <xsd:whiteSpace value="collapse" />
    </xsd:restriction>
    </xsd:simpleType>
    </xsd:element>
    <xsd:element name="ACCEPT_NEW_PATIENT">
    <xsd:simpleType>
    <xsd:restriction base="xsd:string">
    <xsd:pattern value="[A-Z]{1}" />
    <xsd:whiteSpace value="collapse" />
    </xsd:restriction>
    </xsd:simpleType>
    </xsd:element>
    <xsd:element name="PRIMARY_CARE_INDICATOR">
    <xsd:simpleType>
    <xsd:restriction base="xsd:string">
    <xsd:pattern value="[A-Z]{1}" />
    <xsd:whiteSpace value="collapse" />
    </xsd:restriction>
    </xsd:simpleType>
    </xsd:element>
    <xsd:element name="FACILITY_NUM">
    <xsd:simpleType>
    <xsd:restriction base="xsd:string">
    <xsd:pattern value="[0-9]{1}" />
    <xsd:pattern value="[0-9]{2}" />
    <xsd:pattern value="[0-9]{3}" />
    <xsd:pattern value="[0-9]{4}" />
    <xsd:pattern value="[0-9]{5}" />
    <xsd:pattern value="[0-9]{6}" />
    <xsd:pattern value="[0-9]{7}" />
    <xsd:pattern value="[0-9]{8}" />
    <xsd:pattern value="[0-9]{9}" />
    <xsd:pattern value="[0-9]{10}" />
    <xsd:pattern value="" />
    <xsd:whiteSpace value="collapse" />
    </xsd:restriction>
    </xsd:simpleType>
    </xsd:element>
    </xsd:schema>
    Here's a sample of the XML (significantly shortened, and names and IDs changed to protect the innocent). BTW, the XML validates cleanly against the schema definition:
    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <HMO DATE="03/26/2010">
    <HMO_GENERAL_INFORMATION>
    <MCO_ID_LIST>
    <MCO_ID>11111111</MCO_ID>
    </MCO_ID_LIST>
    <HMO_WEBSITE_ADDRESS>HTTP://WWW.SOMEHMONAME.COM</HMO_WEBSITE_ADDRESS>
    <HMO_SPECIAL_SERVICES>
    <CODE>00</CODE>
    </HMO_SPECIAL_SERVICES>
    <HMO_DAILY_CONTACT_EMAIL_ADDRESS>somename@someurl</HMO_DAILY_CONTACT_EMAIL_ADDRESS>
    <HMO_MONTHLY_CONTACT_EMAIL_ADDRESS>somename@someurl</HMO_MONTHLY_CONTACT_EMAIL_ADDRESS>
    </HMO_GENERAL_INFORMATION>
    <PROVIDERS RECORDS="1011">
    <PROVIDER>
    <NPI>1111111111</NPI>
    <FIRST_NAME>JOHN</FIRST_NAME>
    <LAST_NAME>DOE</LAST_NAME>
    <MIDDLE_INITIAL>A</MIDDLE_INITIAL>
    <GENDER>M</GENDER>
    <LINE_1_ADDRESS>1111 Some Rd</LINE_1_ADDRESS>
    <LINE_2_ADDRESS> </LINE_2_ADDRESS>
    <CITY>NOWHERE</CITY>
    <STATE>YN</STATE>
    <ZIP>12345</ZIP>
    <COUNTY>13</COUNTY>
    <PHONE_NUMBER>1111111111</PHONE_NUMBER>
    <CLINIC_NAME>SOME CLINIC - CORPORATE OFFICE</CLINIC_NAME>
    <CLINIC_NPI/>
    <ACCEPT_NEW_PATIENT>Y</ACCEPT_NEW_PATIENT>
    <PRIMARY_CARE_INDICATOR>N</PRIMARY_CARE_INDICATOR>
    <FOREIGN_LANGUAGES>
    <CODE> </CODE>
    </FOREIGN_LANGUAGES>
    <SPECIALTIES>
    <CODE>170</CODE>
    </SPECIALTIES>
    </PROVIDER>
    <PROVIDER>
    <NPI>2222222222</NPI>
    <FIRST_NAME>JANE</FIRST_NAME>
    <LAST_NAME>DOE</LAST_NAME>
    <MIDDLE_INITIAL>J</MIDDLE_INITIAL>
    <GENDER>F</GENDER>
    <LINE_1_ADDRESS>2222 SOMEOTHER ST</LINE_1_ADDRESS>
    <LINE_2_ADDRESS> </LINE_2_ADDRESS>
    <CITY>MYTOWN</CITY>
    <STATE>YN</STATE>
    <ZIP>12345</ZIP>
    <COUNTY>13</COUNTY>
    <PHONE_NUMBER>2222222222</PHONE_NUMBER>
    <CLINIC_NAME>SOME CLINIC - MYTOWN</CLINIC_NAME>
    <CLINIC_NPI/>
    <ACCEPT_NEW_PATIENT>Y</ACCEPT_NEW_PATIENT>
    <PRIMARY_CARE_INDICATOR>N</PRIMARY_CARE_INDICATOR>
    <FOREIGN_LANGUAGES>
    <CODE> </CODE>
    </FOREIGN_LANGUAGES>
    <SPECIALTIES>
    <CODE>322</CODE>
    <CODE>329</CODE>
    </SPECIALTIES>
    </PROVIDER>
    </PROVIDERS>
    <FACILITIES RECORDS="2">
    <FACILITY_NUM>1000000001</FACILITY_NUM>
    <FACILITY_NUM>2000000002</FACILITY_NUM>
    </FACILITIES>
    </HMO>
    As you can see, the SPECIALTIES node can contain more than one CODE value, si I can't use extractValue to retrieve them. Again, I need to extract the NPI value from the PROVIIDER node, and associate it with each of the CODE values from the SPECIALTIES node. So, what I would need to extract from this sample XML would be:
    NPI CODE
    1111111111 170
    2222222222 322
    2222222222 329
    This seems like it should be a pretty routine requirement, but I've tried everything I can think of (that is, everything I've learned to this point), and have not yet found a way............
    Ideally, the solution to extracting this data would utilize SQL (not PL/SQL, or Java, or XSL, etc) with XML extraction functions (e.g. extract, extractValue, XMLSequence, XMLTable, etc).
    Can anyone provide me with an example of how that iterative specialy code data could be extracted? Do I need to modify the .xsd to facilitate this extraction (so that registration of the schema results in other objects in the database)?
    Any suggestions or examples would be greatly appreciated.
    Thanks in advance, Dan
    P.S. - I hope the XML displays OK when I post this question!

    Hi,
    Thanks for your detailed sample, it's very helpful.
    This seems like it should be a pretty routine requirementIndeed, that's a classic (once you've got the method).
    So, here's how you can do it :
    SELECT x1.npi, x2.code
    FROM t,
         XMLTable(
          '/HMO/PROVIDERS/PROVIDER'
          passing t.doc
          columns
            npi number path 'NPI',
            specialties xmltype path 'SPECIALTIES'
         ) x1,
         XMLTable(
          'SPECIALTIES/CODE'
          passing x1.specialties
          columns
            code number path '.'
         ) x2
    ;Assuming the XML is stored in column T.DOC.
    As you see, for each NPI, the trick is to pass the entire SPECIALTIES node (kind of a join) to another nested XMLTable so that each CODE could be extracted as well.
    There's another method using only one XMLTable and a little more complex XQuery. I'll try to post it soon.
    HTH.
    Edit : 2nd method
    SELECT x.*
    FROM t,
         XMLTable(
          'for $i in /HMO/PROVIDERS/PROVIDER/SPECIALTIES/CODE
           return element e
            attribute npi { $i/../../NPI },
            $i/text()
          passing t.doc
          columns
            npi  number path '@npi',
            code number path '.'
         ) x
    ;Edited by: odie_63 on 27 mai 2010 18:43

  • System Extract - Incrementing a sequence number in detail record layout

    I have a system extract for a bank that requires a file header, batch header, detail, batch trailer and file trailer record. The detail record is at the run result level as I am looking to choose all records for a particular deduction (savings bonds) and I also have to put employee ssn and full name. This is working fine. I also have to put a sequence number, ie. detail record layout is record type, length 2, string, record sequence number, 5, ?????, employee SSN, length 9, field, employee full name, length 9, field. I need to increment the record sequence number by one for each detail record in the file. Ie. detail record 1 has record sequence number of 00001, detail record 2 has record sequence number of 00002.
    What type of data element would I set up? For this particular field, I don't need to go against a database field, I only need to keep track of the previous record's sequence number so that I can keep incrementing by 1 until all detail records have been written. The batch trailer has a record count of the number of detail lines and that works fine because I've set that up as a type 'total' with a 'count' of the detail records. I also have in the batch trailer a sum of the pay values from each of the detail records and that works fine as subtrailers allow total data elements where detail records do not.

    You can use any of the below mentioned 2 options in the ctl (Control) file:
    1. SEQUENCE(1,1)
    2. "xxcust_autoinv_seq.nextval"
    where xxcust_autoinv_seq is a database sequence.
    Thanks,
    Angelica.

  • ORA-19279 error extracting one-to-many sequence

    I have an xml table built from a registered schema that I'm trying to extract data from using a view. The lowest level is a polygon with multiple vertices -- vertices number, latitude, and longitude. The xml file lists data as
    POLYGON
    SEQ_NUM
    LAT
    LON
    SEQ_NUM
    LAT
    LON
    SEQ_NUM
    LAT
    LON
    /POLYGON
    The method I use to extract the data returns an ORA-19279 error: "XQuery dymanic type mismatch: expected singleton sequence - got multi-item sequence." The error is pointing to the polygon data; however the polygon sequence tag in the xsd file has the attribute of maxOccurs="unbounded".
    Below is the xsd file, a samlpe xml file and the Select statement I use.
    ABC.xsd file:
    &lt;?xml version="1.0"?&gt;
    &lt;xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
    elementFormDefault="qualified" attributeFormDefault="unqualified"&gt;
    &lt;xs:element name="A_B_C"&gt;
    &lt;xs:complexType&gt;
    &lt;xs:sequence&gt;
    &lt;xs:element name="A"&gt;
    &lt;xs:complexType&gt;
    &lt;xs:sequence&gt;
    &lt;xs:element name="B"&gt;
    &lt;xs:simpleType&gt;
    &lt;xs:restriction base="xs:string"&gt;
    &lt;xs:enumeration value="1A"/&gt;
    &lt;xs:enumeration value="1B"/&gt;
    &lt;xs:enumeration value="2A"/&gt;
    &lt;xs:enumeration value="2B"/&gt;
    &lt;xs:enumeration value="2C"/&gt;
    &lt;/xs:restriction&gt;
    &lt;/xs:simpleType&gt;
    &lt;/xs:element&gt;
    &lt;/xs:sequence&gt;
    &lt;/xs:complexType&gt;
    &lt;/xs:element&gt;
    &lt;xs:choice&gt;
    &lt;xs:element name="D" maxOccurs="unbounded"&gt;
    &lt;xs:complexType&gt;
    &lt;xs:sequence&gt;
    &lt;xs:element name="D_ID" type="xs:string"&gt;
    &lt;/xs:element&gt;
    &lt;xs:element name="D_UQ_ID" type="xs:string"&gt;
    &lt;/xs:element&gt;
    &lt;xs:element name="D_TIME"&gt;
    &lt;xs:simpleType&gt;
    &lt;xs:restriction base="xs:string"/&gt;
    &lt;/xs:simpleType&gt;
    &lt;/xs:element&gt;
    &lt;xs:choice&gt;
    &lt;xs:element name="F"&gt;
    &lt;xs:complexType&gt;
    &lt;xs:sequence&gt;
    &lt;xs:element name="F_TYPE" type="xs:string"&gt;
    &lt;/xs:element&gt;
    &lt;xs:element name="F_SUBTYPE" type="xs:string"&gt;
    &lt;/xs:element&gt;
    &lt;xs:element name="G" minOccurs="0"&gt;
    &lt;xs:complexType&gt;
    &lt;xs:choice&gt;
    &lt;xs:element name="H"&gt;
    &lt;xs:complexType&gt;
    &lt;xs:sequence&gt;
    &lt;xs:element name="H_TYPE" type="xs:string" minOccurs="0"&gt;
    &lt;/xs:element&gt;
    &lt;xs:element name="H_MODE" type="xs:string" minOccurs="0"&gt;
    &lt;/xs:element&gt;
    &lt;xs:element name="H_SHAPE" minOccurs="0"&gt;
    &lt;xs:complexType&gt;
    &lt;xs:choice&gt;
    &lt;xs:element name="POLYGON"&gt;
    &lt;xs:complexType&gt;
    {color:#ff0000}*&lt;xs:sequence maxOccurs="unbounded"&gt;*{color}
    &lt;xs:element name="SEQ_NUM" type="xs:unsignedInt"&gt;
    &lt;xs:annotation&gt;
    &lt;xs:documentation&gt;sequence number in the polygon&lt;/xs:documentation&gt;
    &lt;/xs:annotation&gt;
    &lt;/xs:element&gt;
    &lt;xs:element name="LAT" type="xs:float"/&gt;
    &lt;xs:element name="LON" type="xs:float"/&gt;
    &lt;/xs:sequence&gt;
    &lt;/xs:complexType&gt;
    &lt;/xs:element&gt;
    &lt;xs:element name="CIRCLE"&gt;
    &lt;xs:complexType&gt;
    &lt;xs:sequence&gt;
    &lt;xs:element name="LAT" type="xs:float"/&gt;
    &lt;xs:element name="LON" type="xs:float"/&gt;
    &lt;xs:element name="RAD" type="xs:float"/&gt;
    &lt;/xs:sequence&gt;
    &lt;/xs:complexType&gt;
    &lt;/xs:element&gt;
    &lt;xs:element name="ELLIPSE"&gt;
    &lt;xs:complexType&gt;
    &lt;xs:sequence&gt;
    &lt;xs:element name="ORIENT"&gt;
    &lt;xs:simpleType&gt;
    &lt;xs:restriction base="xs:float"&gt;
    &lt;xs:minInclusive value="0"/&gt;
    &lt;xs:maxInclusive value="360"/&gt;
    &lt;/xs:restriction&gt;
    &lt;/xs:simpleType&gt;
    &lt;/xs:element&gt;
    &lt;xs:element name="MAJ_AX" type="xs:float"&gt;
    &lt;/xs:element&gt;
    &lt;xs:element name="MIN_AX" type="xs:float"&gt;
    &lt;/xs:element&gt;
    &lt;/xs:sequence&gt;
    &lt;/xs:complexType&gt;
    &lt;/xs:element&gt;
    &lt;/xs:choice&gt;
    &lt;/xs:complexType&gt;
    &lt;/xs:element&gt;
    &lt;/xs:sequence&gt;
    &lt;/xs:complexType&gt;
    &lt;/xs:element&gt;
    &lt;/xs:choice&gt;
    &lt;/xs:complexType&gt;
    &lt;/xs:element&gt;
    &lt;/xs:sequence&gt;
    &lt;/xs:complexType&gt;
    &lt;/xs:element&gt;
    &lt;xs:element name="E"&gt;
    &lt;xs:complexType/&gt;
    &lt;/xs:element&gt;
    &lt;/xs:choice&gt;
    &lt;/xs:sequence&gt;
    &lt;/xs:complexType&gt;
    &lt;/xs:element&gt;
    &lt;xs:element name="C"&gt;
    &lt;/xs:element&gt;
    &lt;/xs:choice&gt;
    &lt;/xs:sequence&gt;
    &lt;/xs:complexType&gt;
    &lt;/xs:element&gt;
    &lt;/xs:schema&gt;
    abc.xml file:
    &lt;?xml version="1.0" encoding="utf-8"?&gt;
    &lt;A_B_C&gt;
    &lt;A&gt;
    &lt;B&gt;1B&lt;/B&gt;
    &lt;/A&gt;
    &lt;D&gt;
    &lt;D_ID&gt;D_0001&lt;/D_ID&gt;
    &lt;D_UQ_ID&gt;UQ_D_0001&lt;/D_UQ_ID&gt;
    &lt;D_TIME&gt;2007 FEB 11:11:11.11&lt;/D_TIME&gt;
    &lt;F&gt;
    &lt;F_TYPE&gt;F_TYPE_TEST&lt;/F_TYPE&gt;
    &lt;F_SUBTYPE&gt;SUB_TEST&lt;/F_SUBTYPE&gt;
    &lt;G&gt;
    &lt;H&gt;
    &lt;H_TYPE&gt;Ipod&lt;/H_TYPE&gt;
    &lt;H_MODE&gt;SCANNING&lt;/H_MODE&gt;
    &lt;H_SHAPE&gt;
    &lt;POLYGON&gt;
    &lt;SEQ_NUM&gt;1&lt;/SEQ_NUM&gt;
    &lt;LAT&gt;10.1&lt;/LAT&gt;
    &lt;LON&gt;11.1&lt;/LON&gt;
    &lt;SEQ_NUM&gt;2&lt;/SEQ_NUM&gt;
    &lt;LAT&gt;20.2&lt;/LAT&gt;
    &lt;LON&gt;22.2&lt;/LON&gt;
    &lt;SEQ_NUM&gt;3&lt;/SEQ_NUM&gt;
    &lt;LAT&gt;30.3&lt;/LAT&gt;
    &lt;LON&gt;33.3&lt;/LON&gt;
    &lt;SEQ_NUM&gt;4&lt;/SEQ_NUM&gt;
    &lt;LAT&gt;40.4&lt;/LAT&gt;
    &lt;LON&gt;44.4&lt;/LON&gt;
    &lt;/POLYGON&gt;
    &lt;CIRCLE&gt;
    &lt;LAT&gt;12.3&lt;/LAT&gt;
    &lt;LON&gt;45.6&lt;/LON&gt;
    &lt;RAD&gt;78.9&lt;/RAD&gt;
    &lt;/CIRCLE&gt;
    &lt;ELLIPSE&gt;
    &lt;ORIENT&gt;99.90&lt;/ORIENT&gt;
    &lt;MAJ_AX&gt;111.10&lt;/MAJ_AX&gt;
    &lt;MIN_AX&gt;222.20&lt;/MIN_AX&gt;
    &lt;/ELLIPSE&gt;
    &lt;/H_SHAPE&gt;
    &lt;/H&gt;
    &lt;/G&gt;
    &lt;/F&gt;
    &lt;E&gt;&lt;/E&gt;
    &lt;/D&gt;
    &lt;D&gt;
    &lt;D_ID&gt;D_0002&lt;/D_ID&gt;
    &lt;D_UQ_ID&gt;UQ_D_0002&lt;/D_UQ_ID&gt;
    &lt;D_TIME&gt;2007 FEB 22:22:22.22&lt;/D_TIME&gt;
    &lt;F&gt;
    &lt;F_TYPE&gt;F_TYPE_TEST&lt;/F_TYPE&gt;
    &lt;F_SUBTYPE&gt;SUB_TEST&lt;/F_SUBTYPE&gt;
    &lt;G&gt;
    &lt;H&gt;
    &lt;H_TYPE&gt;Ipod&lt;/H_TYPE&gt;
    &lt;H_MODE&gt;SCANNING&lt;/H_MODE&gt;
    &lt;H_SHAPE&gt;
    &lt;POLYGON&gt;
    &lt;SEQ_NUM&gt;1&lt;/SEQ_NUM&gt;
    &lt;LAT&gt;10.1&lt;/LAT&gt;
    &lt;LON&gt;11.1&lt;/LON&gt;
    &lt;SEQ_NUM&gt;2&lt;/SEQ_NUM&gt;
    &lt;LAT&gt;20.2&lt;/LAT&gt;
    &lt;LON&gt;22.2&lt;/LON&gt;
    &lt;SEQ_NUM&gt;3&lt;/SEQ_NUM&gt;
    &lt;LAT&gt;30.3&lt;/LAT&gt;
    &lt;LON&gt;33.3&lt;/LON&gt;
    &lt;SEQ_NUM&gt;4&lt;/SEQ_NUM&gt;
    &lt;LAT&gt;40.4&lt;/LAT&gt;
    &lt;LON&gt;44.4&lt;/LON&gt;
    &lt;/POLYGON&gt;
    &lt;CIRCLE&gt;
    &lt;LAT&gt;12.3&lt;/LAT&gt;
    &lt;LON&gt;45.6&lt;/LON&gt;
    &lt;RAD&gt;78.9&lt;/RAD&gt;
    &lt;/CIRCLE&gt;
    &lt;ELLIPSE&gt;
    &lt;ORIENT&gt;99.90&lt;/ORIENT&gt;
    &lt;MAJ_AX&gt;111.10&lt;/MAJ_AX&gt;
    &lt;MIN_AX&gt;222.20&lt;/MIN_AX&gt;
    &lt;/ELLIPSE&gt;
    &lt;/H_SHAPE&gt;
    &lt;/H&gt;
    &lt;/G&gt;
    &lt;/F&gt;
    &lt;E&gt;&lt;/E&gt;
    &lt;/D&gt;
    &lt;D&gt;
    &lt;D_ID&gt;D_0003&lt;/D_ID&gt;
    &lt;D_UQ_ID&gt;UQ_D_0003&lt;/D_UQ_ID&gt;
    &lt;D_TIME&gt;2007 FEB 33:33:33.33&lt;/D_TIME&gt;
    &lt;F&gt;
    &lt;F_TYPE&gt;F_TYPE_TEST&lt;/F_TYPE&gt;
    &lt;F_SUBTYPE&gt;SUB_TEST&lt;/F_SUBTYPE&gt;
    &lt;G&gt;
    &lt;H&gt;
    &lt;H_TYPE&gt;Ipod&lt;/H_TYPE&gt;
    &lt;H_MODE&gt;SCANNING&lt;/H_MODE&gt;
    &lt;/H&gt;
    &lt;/G&gt;
    &lt;/F&gt;
    &lt;E&gt;&lt;/E&gt;
    &lt;/D&gt;
    &lt;D&gt;
    &lt;D_ID&gt;D_0004&lt;/D_ID&gt;
    &lt;D_UQ_ID&gt;UQ_D_0004&lt;/D_UQ_ID&gt;
    &lt;D_TIME&gt;2007 FEB 44:44:44.44&lt;/D_TIME&gt;
    &lt;F&gt;
    &lt;F_TYPE&gt;F_TYPE_TEST&lt;/F_TYPE&gt;
    &lt;F_SUBTYPE&gt;SUB_TEST&lt;/F_SUBTYPE&gt;
    &lt;G&gt;
    &lt;H&gt;
    &lt;H_TYPE&gt;Ipod&lt;/H_TYPE&gt;
    &lt;H_MODE&gt;SCANNING&lt;/H_MODE&gt;
    &lt;H_SHAPE&gt;
    &lt;POLYGON&gt;
    &lt;SEQ_NUM&gt;1&lt;/SEQ_NUM&gt;
    &lt;LAT&gt;10.1&lt;/LAT&gt;
    &lt;LON&gt;11.1&lt;/LON&gt;
    &lt;SEQ_NUM&gt;2&lt;/SEQ_NUM&gt;
    &lt;LAT&gt;20.2&lt;/LAT&gt;
    &lt;LON&gt;22.2&lt;/LON&gt;
    &lt;SEQ_NUM&gt;3&lt;/SEQ_NUM&gt;
    &lt;LAT&gt;30.3&lt;/LAT&gt;
    &lt;LON&gt;33.3&lt;/LON&gt;
    &lt;SEQ_NUM&gt;4&lt;/SEQ_NUM&gt;
    &lt;LAT&gt;40.4&lt;/LAT&gt;
    &lt;LON&gt;44.4&lt;/LON&gt;
    &lt;/POLYGON&gt;
    &lt;CIRCLE&gt;
    &lt;LAT&gt;12.3&lt;/LAT&gt;
    &lt;LON&gt;45.6&lt;/LON&gt;
    &lt;RAD&gt;78.9&lt;/RAD&gt;
    &lt;/CIRCLE&gt;
    &lt;ELLIPSE&gt;
    &lt;ORIENT&gt;99.90&lt;/ORIENT&gt;
    &lt;MAJ_AX&gt;111.10&lt;/MAJ_AX&gt;
    &lt;MIN_AX&gt;222.20&lt;/MIN_AX&gt;
    &lt;/ELLIPSE&gt;
    &lt;/H_SHAPE&gt;
    &lt;/H&gt;
    &lt;/G&gt;
    &lt;/F&gt;
    &lt;E&gt;&lt;/E&gt;
    &lt;/D&gt;
    &lt;D&gt;
    &lt;D_ID&gt;D_0005&lt;/D_ID&gt;
    &lt;D_UQ_ID&gt;UQ_D_0005&lt;/D_UQ_ID&gt;
    &lt;D_TIME&gt;2007 FEB 55:55:55.55&lt;/D_TIME&gt;
    &lt;F&gt;
    &lt;F_TYPE&gt;F_TYPE_TEST&lt;/F_TYPE&gt;
    &lt;F_SUBTYPE&gt;SUB_TEST&lt;/F_SUBTYPE&gt;
    &lt;/F&gt;
    &lt;E&gt;&lt;/E&gt;
    &lt;/D&gt;
    &lt;D&gt;
    &lt;D_ID&gt;D_0006&lt;/D_ID&gt;
    &lt;D_UQ_ID&gt;UQ_D_0006&lt;/D_UQ_ID&gt;
    &lt;D_TIME&gt;2007 FEB 66:66:66.66&lt;/D_TIME&gt;
    &lt;F&gt;
    &lt;F_TYPE&gt;F_TYPE_TEST&lt;/F_TYPE&gt;
    &lt;F_SUBTYPE&gt;SUB_TEST&lt;/F_SUBTYPE&gt;
    &lt;G&gt;
    &lt;H&gt;
    &lt;H_TYPE&gt;Ipod&lt;/H_TYPE&gt;
    &lt;H_MODE&gt;SCANNING&lt;/H_MODE&gt;
    &lt;H_SHAPE&gt;
    &lt;POLYGON&gt;
    &lt;SEQ_NUM&gt;1&lt;/SEQ_NUM&gt;
    &lt;LAT&gt;10.1&lt;/LAT&gt;
    &lt;LON&gt;11.1&lt;/LON&gt;
    &lt;SEQ_NUM&gt;2&lt;/SEQ_NUM&gt;
    &lt;LAT&gt;20.2&lt;/LAT&gt;
    &lt;LON&gt;22.2&lt;/LON&gt;
    &lt;SEQ_NUM&gt;3&lt;/SEQ_NUM&gt;
    &lt;LAT&gt;30.3&lt;/LAT&gt;
    &lt;LON&gt;33.3&lt;/LON&gt;
    &lt;SEQ_NUM&gt;4&lt;/SEQ_NUM&gt;
    &lt;LAT&gt;40.4&lt;/LAT&gt;
    &lt;LON&gt;44.4&lt;/LON&gt;
    &lt;/POLYGON&gt;
    &lt;CIRCLE&gt;
    &lt;LAT&gt;12.3&lt;/LAT&gt;
    &lt;LON&gt;45.6&lt;/LON&gt;
    &lt;RAD&gt;78.9&lt;/RAD&gt;
    &lt;/CIRCLE&gt;
    &lt;ELLIPSE&gt;
    &lt;ORIENT&gt;99.90&lt;/ORIENT&gt;
    &lt;MAJ_AX&gt;111.10&lt;/MAJ_AX&gt;
    &lt;MIN_AX&gt;222.20&lt;/MIN_AX&gt;
    &lt;/ELLIPSE&gt;
    &lt;/H_SHAPE&gt;
    &lt;/H&gt;
    &lt;/G&gt;
    &lt;/F&gt;
    &lt;E&gt;&lt;/E&gt;
    &lt;/D&gt;
    &lt;D&gt;
    &lt;D_ID&gt;D_0007&lt;/D_ID&gt;
    &lt;D_UQ_ID&gt;UQ_D_0007&lt;/D_UQ_ID&gt;
    &lt;D_TIME&gt;2007 FEB 77:77:77.77&lt;/D_TIME&gt;
    &lt;F&gt;
    &lt;F_TYPE&gt;F_TYPE_TEST&lt;/F_TYPE&gt;
    &lt;F_SUBTYPE&gt;SUB_TEST&lt;/F_SUBTYPE&gt;
    &lt;G&gt;
    &lt;H&gt;
    &lt;H_TYPE&gt;Ipod&lt;/H_TYPE&gt;
    &lt;H_MODE&gt;SCANNING&lt;/H_MODE&gt;
    &lt;/H&gt;
    &lt;/G&gt;
    &lt;/F&gt;
    &lt;E&gt;&lt;/E&gt;
    &lt;/D&gt;
    &lt;D&gt;
    &lt;D_ID&gt;D_0008&lt;/D_ID&gt;
    &lt;D_UQ_ID&gt;UQ_D_0008&lt;/D_UQ_ID&gt;
    &lt;D_TIME&gt;2007 FEB 88:88:88.88&lt;/D_TIME&gt;
    &lt;F&gt;
    &lt;F_TYPE&gt;F_TYPE_TEST&lt;/F_TYPE&gt;
    &lt;F_SUBTYPE&gt;SUB_TEST&lt;/F_SUBTYPE&gt;
    &lt;G&gt;
    &lt;H&gt;
    &lt;H_TYPE&gt;Ipod&lt;/H_TYPE&gt;
    &lt;H_MODE&gt;SCANNING&lt;/H_MODE&gt;
    &lt;H_SHAPE&gt;
    &lt;POLYGON&gt;
    &lt;SEQ_NUM&gt;1&lt;/SEQ_NUM&gt;
    &lt;LAT&gt;10.1&lt;/LAT&gt;
    &lt;LON&gt;11.1&lt;/LON&gt;
    &lt;SEQ_NUM&gt;2&lt;/SEQ_NUM&gt;
    &lt;LAT&gt;20.2&lt;/LAT&gt;
    &lt;LON&gt;22.2&lt;/LON&gt;
    &lt;SEQ_NUM&gt;3&lt;/SEQ_NUM&gt;
    &lt;LAT&gt;30.3&lt;/LAT&gt;
    &lt;LON&gt;33.3&lt;/LON&gt;
    &lt;SEQ_NUM&gt;4&lt;/SEQ_NUM&gt;
    &lt;LAT&gt;40.4&lt;/LAT&gt;
    &lt;LON&gt;44.4&lt;/LON&gt;
    &lt;/POLYGON&gt;
    &lt;CIRCLE&gt;
    &lt;LAT&gt;12.3&lt;/LAT&gt;
    &lt;LON&gt;45.6&lt;/LON&gt;
    &lt;RAD&gt;78.9&lt;/RAD&gt;
    &lt;/CIRCLE&gt;
    &lt;ELLIPSE&gt;
    &lt;ORIENT&gt;88.80&lt;/ORIENT&gt;
    &lt;MAJ_AX&gt;111.10&lt;/MAJ_AX&gt;
    &lt;MIN_AX&gt;222.20&lt;/MIN_AX&gt;
    &lt;/ELLIPSE&gt;
    &lt;/H_SHAPE&gt;
    &lt;/H&gt;
    &lt;/G&gt;
    &lt;/F&gt;
    &lt;E&gt;&lt;/E&gt;
    &lt;/D&gt;
    &lt;C&gt;TPS Report 4&lt;/C&gt;
    &lt;/A_B_C&gt;
    SELECT statement:
    SELECT a_level.a_class
    , d_level.D_UQ_ID
    , d_level.D_TIME
    , h_level.SEQ_NUM
    , h_level.LAT
    , h_level.LON
    FROM ABC_XML,
    XMLTABLE('/A_B_C'
    PASSING ABC_XML.ABC_SPEC
    COLUMNS
    A_CLASS VARCHAR2(4000 BYTE) PATH '/A_B_C/A/B'
    , D XMLTYPE PATH 'D'
    ) a_level,
    XMLTABLE ('/D'
    PASSING a_level.D
    COLUMNS
    D_UQ_ID varchar2(4000) PATH 'D_UQ_ID'
    , D_TIME varchar2(4000) PATH 'D_TIME'
    , POLYGON XMLTYPE PATH 'F/G/H/H_SHAPE/POLYGON'
    ) d_level
    XMLTABLE('/POLYGON'
    passing d_level.POLYGON
    COLUMNS
    SEQ_NUM NUMBER PATH 'SEQ_NUM'
    , LAT NUMBER PATH 'LAT)'
    , LON NUMBER PATH 'LON'
    ) h_level;
    As you see I need to return data from three levels of data (a, d and h). I can remark out the bottom level (h_level) and the statement runs returning 8 rows from the xml file above (which is correct). The h_level XMLTABLE reference returns the ORA-19279 error. The full statement should return 20 rows of data.

    Yes. I looked at that string.
    Never mind on this one. You helped solve the problem in another string
    XMLTable 'For $i in ... return ROW' clause help needed

  • TSQL Search and Extract Different Activity Sequences in a given set of data

    Hello,
    I have the following tables
    1) EVENT_NAMES (EVENT_NAME_ID, EVENT_NAME)
    1 PM
    2 PM WASH
    3 Backlog
    2) EVENT_NAME_SEQUENCE(SeqParentKey, Event_Name_ID,Seqorder)
    Data looks like below
    1  2   1
    1  1   2
    1  3   3
    2  1   1
    2  3    2
    Event_NAME_Sequence contains the Sequence which I need to find in the RAW data table. Currently there are 2 sequence which I need to find (identified by SeqParentKey). I need to find Seq(PM WASH, PM and BACKLOG) and Seq(PM,Backlog) in RAW DATA TABLE for
    a particular Equipment
    RAW DATA TABLE looks like below
    3) EVENT_NAMECHANGE( EQMT, EVENT_NAME, STARTTIME, ENDTIME)
    Sample data is as shown below
    MACH_101    PM WASH    2014-01-01 10:00:00.000    2014-01-01 11:00:00.000
    MACH_101    PM              2014-01-01 11:00:00.000    2014-01-01 15:00:00.000
    MACH_101    Backlog      2014-01-01 15:00:00.000    2014-01-01 16:00:00.000
    MACH_103     PM WASH    2014-01-01 10:00:00.000    2014-01-01 11:00:00.000
    MACH_103     PM              2014-01-01 11:00:00.000    2014-01-01 15:00:00.000
    MACH_106    PM               2014-01-01 15:00:00.000    2014-01-01 16:00:00.000
    MACH_106    Backlog      2014-01-01 16:00:00.000    2014-01-01 18:00:00.000
    MACH_101    PM               2014-01-02 15:00:00.000    2014-01-02 16:00:00.000
    MACH_101    Backlog      2014-01-02 16:00:00.000    2014-01-02 18:00:00.000
    MACH_900     PM               2014-01-02 15:00:00.000    2014-01-02 16:00:00.000
    MACH_900     REPAIR      2014-01-02 16:00:00.000   2014-01-02 18:00:00.000
    The records in BOLD is the output I would need
    Below are the scripts for table and data
    CREATE TABLE EVENT_NAMES
    EVENT_NAME_ID int,
    EVENT_NAME varchar(100)
    INSERT INTO EVENT_NAMES values(1,'PM')
    INSERT INTO EVENT_NAMES values(2,'PM WASH')
    INSERT INTO EVENT_NAMES values(3,'Backlog')
    CREATE TABLE EVENT_NAME_SEQUENCE
    SeqParentKey int,
    EVENT_NAME_ID int,
    SeqOrder int
    INSERT INTO EVENT_NAME_SEQUENCE values(1,2,1)
    INSERT INTO EVENT_NAME_SEQUENCE values(1,1,2)
    INSERT INTO EVENT_NAME_SEQUENCE values(1,3,3)
    INSERT INTO EVENT_NAME_SEQUENCE values(2,1,1)
    INSERT INTO EVENT_NAME_SEQUENCE values(2,3,2)
    CREATE TABLE EVENT_NAMECHANGE
    EQMT varchar(100),
    EVENT_NAME varchar(100),
    STARTTIME DATETIME,
    ENDTIME DATETIME
    INSERT INTO EVENT_NAMECHANGE VALUES('MACH_101','PM WASH','2014-01-01 10:00:00.000','2014-01-01 11:00:00.000')
    INSERT INTO EVENT_NAMECHANGE VALUES('MACH_101','PM','2014-01-01 11:00:00.000','2014-01-01 15:00:00.000')
    INSERT INTO EVENT_NAMECHANGE VALUES('MACH_101','Backlog','2014-01-01 15:00:00.000','2014-01-01 16:00:00.000')
    INSERT INTO EVENT_NAMECHANGE VALUES('MACH_103','PM WASH','2014-01-01 10:00:00.000','2014-01-01 11:00:00.000')
    INSERT INTO EVENT_NAMECHANGE VALUES('MACH_103','PM','2014-01-01 11:00:00.000','2014-01-01 15:00:00.000')
    INSERT INTO EVENT_NAMECHANGE VALUES('MACH_106','PM','2014-01-01 15:00:00.000','2014-01-01 16:00:00.000')
    INSERT INTO EVENT_NAMECHANGE VALUES('MACH_106','Backlog','2014-01-01 16:00:00.000','2014-01-01 18:00:00.000')
    INSERT INTO EVENT_NAMECHANGE VALUES('MACH_101','PM','2014-01-02 15:00:00.000','2014-01-02 16:00:00.000')
    INSERT INTO EVENT_NAMECHANGE VALUES('MACH_101','Backlog','2014-01-02 16:00:00.000','2014-01-02 18:00:00.000')
    INSERT INTO EVENT_NAMECHANGE VALUES('MACH_900','PM','2014-01-02 15:00:00.000','2014-01-02 16:00:00.000')
    INSERT INTO EVENT_NAMECHANGE VALUES('MACH_900','Repair','2014-01-02 16:00:00.000','2014-01-02 18:00:00.000')
    Any help on creating a Generic logic would help as in future there would be Event sequences added to EVENT_NAME_SEQUENCE table

    So that was an interesting problem!
    I decided to go for a solution where build concatenated lists to compare these. As started to play with it, I realised that there is risk for a scaling problem, so I introduced some optimisations. And it seems that they helped me to find the final solution.
    There are two CTEs. The first CTE builds a fixed-width list of the event-name ids for each sequence. I also extract the length and the first value of each sequence.
    In the next CTE I find the start of all sequences in the EVENT_NAMECHANGE table. For each row where the the event is the first of a sequence I read as many rows as there are in the sequence and form a fixed-width list of event-name ids. If this list matches
    the sequence list, this row is returned from the CTE, together with the count of the sequence.
    In the final query, I repeat the CROSS APPLY in the second CTE, but this time without FOR XML to get the actual rows. I need DISTINCT here, since one sequence may include another.
    It is of course impossible to test performance without knowledge of the actual table. But is my assumption that EVENT_NAMES and EVENT_NAME_SEQUENCE are fairly small table, whereas EVENT_NAMECHANGE is big, maybe 100 millions of rows. Obviously the table has
    to be scanned once, but I think performance should be proportional to the number of rows in the table times the length of the longest sequence.
    Here is my complete test script.
    CREATE TABLE EVENT_NAMES
    EVENT_NAME_ID int NOT NULL P,
    EVENT_NAME varchar(100)
    INSERT INTO EVENT_NAMES values(1,'PM')
    INSERT INTO EVENT_NAMES values(2,'PM WASH')
    INSERT INTO EVENT_NAMES values(3,'Backlog')
    CREATE TABLE EVENT_NAME_SEQUENCE
    SeqParentKey int,
    EVENT_NAME_ID int,
    SeqOrder int
    INSERT INTO EVENT_NAME_SEQUENCE values(1,2,1)
    INSERT INTO EVENT_NAME_SEQUENCE values(1,1,2)
    INSERT INTO EVENT_NAME_SEQUENCE values(1,3,3)
    INSERT INTO EVENT_NAME_SEQUENCE values(2,1,1)
    INSERT INTO EVENT_NAME_SEQUENCE values(2,3,2)
    CREATE TABLE EVENT_NAMECHANGE
    EQMT varchar(100),
    EVENT_NAME varchar(100),
    STARTTIME DATETIME,
     ENDTIME DATETIME
    INSERT INTO EVENT_NAMECHANGE VALUES('MACH_101','PM WASH','2014-01-01 10:00:00.000','2014-01-01 11:00:00.000')
    INSERT INTO EVENT_NAMECHANGE VALUES('MACH_101','PM','2014-01-01 11:00:00.000','2014-01-01 15:00:00.000')
    INSERT INTO EVENT_NAMECHANGE VALUES('MACH_101','Backlog','2014-01-01 15:00:00.000','2014-01-01 16:00:00.000')
    INSERT INTO EVENT_NAMECHANGE VALUES('MACH_103','PM WASH','2014-01-01 10:00:00.000','2014-01-01 11:00:00.000')
    INSERT INTO EVENT_NAMECHANGE VALUES('MACH_103','PM','2014-01-01 11:00:00.000','2014-01-01 15:00:00.000')
    INSERT INTO EVENT_NAMECHANGE VALUES('MACH_106','PM','2014-01-01 15:00:00.000','2014-01-01 16:00:00.000')
    INSERT INTO EVENT_NAMECHANGE VALUES('MACH_106','Backlog','2014-01-01 16:00:00.000','2014-01-01 18:00:00.000')
    INSERT INTO EVENT_NAMECHANGE VALUES('MACH_101','PM','2014-01-02 15:00:00.000','2014-01-02 16:00:00.000')
    INSERT INTO EVENT_NAMECHANGE VALUES('MACH_101','Backlog','2014-01-02 16:00:00.000','2014-01-02 18:00:00.000')
    INSERT INTO EVENT_NAMECHANGE VALUES('MACH_900','PM','2014-01-02 15:00:00.000','2014-01-02 16:00:00.000')
    INSERT INTO EVENT_NAMECHANGE VALUES('MACH_900','Repair','2014-01-02 16:00:00.000','2014-01-02 18:00:00.000')
    go
    WITH matchlists AS (
       SELECT seq.SeqParentKey, seq.cnt, seq.first, xml.matchlist
       FROM   (SELECT SeqParentKey, COUNT(*) AS cnt,
                      MIN(CASE SeqOrder WHEN 1 THEN EVENT_NAME_ID END) AS first
               FROM   EVENT_NAME_SEQUENCE
               GROUP  BY SeqParentKey) AS seq
       CROSS  APPLY (SELECT str(ens.EVENT_NAME_ID) AS [text()]
                     FROM   EVENT_NAME_SEQUENCE ens
                     WHERE  ens.SeqParentKey = seq.SeqParentKey
                     ORDER  BY ens.SeqOrder
                     FOR XML PATH('')) AS xml(matchlist)
    ), matchstarts AS (
       SELECT start.*, ml.cnt
       FROM   EVENT_NAMECHANGE AS start
       JOIN   EVENT_NAMES en1 ON start.EVENT_NAME = en1.EVENT_NAME
       JOIN   matchlists ml ON en1.EVENT_NAME_ID = ml.first
       CROSS  APPLY (SELECT TOP (ml.cnt) str(en.EVENT_NAME_ID) AS [text()]
                     FROM   EVENT_NAMECHANGE next
                     JOIN   EVENT_NAMES en ON next.EVENT_NAME = en.EVENT_NAME
                     WHERE  next.EQMT = start.EQMT
                       AND  next.STARTTIME >= start.STARTTIME
                     ORDER  BY next.STARTTIME
                     FOR XML PATH('')) AS xml(eventlist)
       WHERE  charindex(ml.matchlist, xml.eventlist) = 1
    SELECT DISTINCT next.*
    FROM   matchstarts ms
    CROSS  APPLY (SELECT TOP (ms.cnt) next.*
                  FROM   EVENT_NAMECHANGE next
                  WHERE  ms.EQMT = next.EQMT
                    AND  next.STARTTIME >= ms.STARTTIME
                  ORDER  BY next.STARTTIME) AS next
    ORDER  BY next.EQMT, next.STARTTIME
    go
    DROP TABLE EVENT_NAMECHANGE, EVENT_NAME_SEQUENCE, EVENT_NAMES
    Erland Sommarskog, SQL Server MVP, [email protected]

  • Extract logic/tables/sequence?

    Hello,
    I'm curious about the sequence in which different kinds of extraction take place leading to data loading into the BW system (either master- or trans. data).
    Is this a correct assumtion:
    1. Masterdata: during execution of the info package, the function module (alternatively, a view is used as source and no function module is needed) of the called data source goes into the source tables (ex. MARA), returns the data via the rules of the extract structure (incl. appends/user exits).
    2. Trans. data init:during execution of the info package, the function module (alternatively, a view is used as source and no function module is needed) of the called data source goes into the source tables (GLPCA), returns the data via the rules of the extract structure (incl. appends/user exits). After the load, a delta table is generated. Within f.e. SD, you have to generate and fill a setup table in order to be able to load th init.
    3. Trans data delta: new postings are added to the delta table (in PCA this happens automatically while in f.e. SD, you have to schedule this procedure) from which the new postings are fetched (via function module or view) on execution of the info package in BW.
    Is this the way it works in general? Are there any good documents on this topic? Please mail to [email protected]
    Regards,
    F C
    Message was edited by:
            F C

    1. For master data like material, the exractors behave all most the same way.
    2. For transaction data, it is diferent for LO comapred to non-LO extractors. for LO transaction data, there are some extra steps you need to do like fillng the set up tables, choosing a delta method, V1,V2, V3.
    3. For delta, like I said in 2 above, it is slighly different for LO extractors.
    There is lots of info on this subject in SDN. Search with key word LO or cockpit will be very useful.
    Ravi Thothadri

  • I created in iMovie, and extracted audio from one of the clips to use in the title sequence.  All is well, export to iDVD and it plays OK, but when I burn the DVD the audio for the titles does not play. Any suggestions?

    I created in iMovie, and extracted audio from one of the clips to use in the title sequence.  All is well, export to iDVD and it plays OK, but when I burn the DVD the audio for the titles does not play. Any suggestions?

    I am on a MacBook Pro with OS 10.6.7 running iMovie '11 and iDVD 7.1.1.  Thanks for any input.

  • Extract repeating sequence from tdms

    Hi experts,
    I have weeks of time series data in TDMS files that are analog logs of a repeating sequence. I need to extract each of the repeating sequences and overlay the waveforms to determine variances between sequences (sample data attached including 5 blocks attached)
    The start of each block is defined by the pulse on channel "Bubble Detect Trigger". What I need do is time slice each TDMS between the trigger pulses and overlay all the slices on a chart to see how the other channels line up.
    Is there a way of doing this in Signal express or DIADEM?
    Help much appreciated.
    Solved!
    Go to Solution.
    Attachments:
    TDMS_subset.zip ‏200 KB

    Hey Kurt, thanks for your interest.
    I'm looking to do a simple overlay. In the attached example tdms there is a group called Timeseries Data, which was captured using SignalExpress and DAQcard. I need to find the edges of the Trigger channel, chop the TimeSeries data up and overlay the repeating sequence. I have done this manually to show the end result in the group called Overlays. By doing this Raw3 can easily be seen to be different from the other sequences.
    The analysis is done offline and I need to automate as I have a couple Tb data to process. SignalExpress has some functionality to do edge finding and subset data so I thought that might work, and Diadem is supposed to be great for handling large amounts of data and has scripting so I thought that might work. I just dont know enough about either tool to get the results I need....
    Thanks again for your help.
    Mark.
    Attachments:
    Example Analog_Captures.zip ‏707 KB

  • Extracting return operation from a parallel sequence in a routing.

    Hi all
    I need to extract data on some existing parallel sequences in routings from R3. One of the fields i need is the return operation for each parallel sequence.
    I was hoping the data would be in PLFL which contains most of the sequence information I need. But alas it doesn't have the return operation.
    Checking with F1 and the tech button shows me that the field i want is PLFLD-VORNR2. But PLFLD is a structure that I can't get to.
    Does anyone know how to extract this info from the system?
    Regards
    Simon Pedersen

    Hi Simon,
    The field that you're looking for is PLFL-BKNT2 (for the return operation). Pay attention that in this field there's a number that is representing the operation node number, not the number that you see in the routing screen.
    Regards,
    Mario

  • XML escape sequences for brackets and xmltype.extract

    G'day gang, I'm hoping somebody would be kind enough to help me with the following query please.
    I have a web service that is returning the following XML stream into an XMLType in the database:
    <OutOfStockAdviceResponse xmlns="http://abc.org/abcWebServices">
      <OutOfStockAdviceResult>
      & lt;Response& lt;ResponseCode& gt;0& lt;/ResponseCode& gt;
      & lt;ResponseMessage& gt;Successful& lt;/ResponseMessage& gt;
      & lt;/Response& gt;
      </OutOfStockAdviceResult>
    </OutOfStockAdviceeResponse>You'll note the & lt; and & gt; characters (note to display these strings in OTN I've had to add a space between the & and the lt; or gt;. The spaces don't actually occur in the real XML data coming back).
    What's odd about this XML stream coming back is it is mixing the use of the XML angle brackets with the escape character equivalents (eg. & lt; and & gt;) half way through the XML stream. Is this valid for an XML stream to do this? Any idea what would cause this? Is it possible the source is creating 2 separate XML streams using different character sets and then concatenating them to get this result?
    The reason I'm asking is I'm attempting via PL/SQL to extract the ResponseCode and ResponseMessage tags with the following code:
      v_response_code := XMLType.extract(v_response,
          '/OutOfStockAdviceResponse/OutOfStockAdviceResult/Response/ResponseCode/text()',
          'xmlns="http://abc.org/abcWebServices"').getnumberval;
      v_response_msg  := XMLType.extract(v_response,
          '/OutOfStockAdviceResponse/OutOfStockAdviceResult/Response/ResponseMessage/text()',
          'xmlns="http://abc.org/abcWebServices"').getstringval;Both calls are failing with:
    ORA-30625: method dispatch on NULL SELF argument is disallowedCan anybody point me in the right direction for solving this issue? Is there a way to get the xmltype.extract function to recognize the different character encoding schemes (if they do indeed actually exist)?
    Any help appreciated.
    CM.
    PS. Apologize for the weak subject line.

    Chris
    Since that Serviceis actually returning the escaped representation of '<' and '>' inside OutOfStocAdviceResult, the XML Parser considers that whole block of text to be simply a text node child the parent element, not valid XML. Hence the result of your XPath expressions is null and you get the ORA-30625 when you try to invoke the getNumberVal() and getStringVal() methods, which is the PL/SQL equivilant of a Java Null Pointer Exception.
    You can solve it as follows...
    set define off
    set serveroutput on
    declare
      v_response xmltype;
      v_response_code number(4);
      v_response_msg varchar2(64);
      v_xmltext varchar2(256);
      v_OutOfStockResponse xmltype := xmltype(
    '<OutOfStockAdviceResponse xmlns="http://abc.org/abcWebServices"> 
      <OutOfStockAdviceResult>
        & lt;Response& gt;& lt;ResponseCode& gt;0& lt;/ResponseCode& gt;& lt;ResponseMessage& gt;Successful& lt;/ResponseMessage& gt;& lt;/Response& gt; 
      </OutOfStockAdviceResult>
    </OutOfStockAdviceResponse>');
    begin
      select extractValue(v_OutOfStockResponse,'/OutOfStockAdviceResponse/OutOfStockAdviceResult','xmlns="http://abc.org/abcWebServices"')
        into v_xmltext
        from dual;
       dbms_output.put_line('Text = ' || v_xmlText);
       v_response := xmltype(v_xmltext);
       v_response_code := v_response.extract('/Response/ResponseCode/text()').getnumberval();
       v_response_msg  := v_response.extract('/Response/ResponseMessage/text()').getstringval();
       dbms_output.put_line('Code = ' || v_response_code);
       dbms_output.put_line('Msg = ' || v_response_msg);
    end;Note that like you I had to insert space characters between in the 'lt' and 'gt' escape sequences...
    When this is run you get the following
    SQL> set define off
    SQL> set serveroutput on
    SQL> --
    SQL> declare
      2    v_response xmltype;
      3    v_response_code number(4);
      4    v_response_msg varchar2(64);
      5    v_xmltext varchar2(256);
      6    v_OutOfStockResponse xmltype := xmltype(
      7  '<OutOfStockAdviceResponse xmlns="http://abc.org/abcWebServices">
      8    <OutOfStockAdviceResult>
      9      & lt;Response& gt;& lt;ResponseCode& gt;0& lt;/ResponseCode& gt;& lt;ResponseMessage& gt;Successful& lt;/ResponseMessage& gt;& lt;/Response& gt;
    10    </OutOfStockAdviceResult>
    11  </OutOfStockAdviceResponse>');
    12  begin
    13    select extractValue(v_OutOfStockResponse,'/OutOfStockAdviceResponse/OutOfStockAdviceResult','xmlns="http://abc.org/abcWebServices"')
    14      into v_xmltext
    15      from dual;
    16     dbms_output.put_line('Text = ' || v_xmlText);
    17     v_response := xmltype(v_xmltext);
    18     v_response_code := v_response.extract('/Response/ResponseCode/text()').getnumberval();
    19     v_response_msg  := v_response.extract('/Response/ResponseMessage/text()').getstringval();
    20     dbms_output.put_line('Code = ' || v_response_code);
    21     dbms_output.put_line('Msg = ' || v_response_msg);
    22  end;
    23  /
    Text =
    <Response><ResponseCode>0</ResponseCode><ResponseMessage>Successful</ResponseMes
    sage></Response>
    Code = 0
    Msg = Successful
    PL/SQL procedure successfully completed.
    SQL>Basically we extract the encoded text using extractValue() which will de-escape the escapted characters and then create a new XMLType which we can operate on

  • Position Activity Sequence Resulting in data extracting error

    hi gurus
    can any body tell me what is this position activity sequence error resulting in data extracting error, plz help. this is very high priority for me.
    regards
    dev

    I rebuild the report using a tabular form and populated the primary key with a PL/SQL expression and now it appears to be working. P1_ISSUE_NO is the primary key on the issue table and I could not figure how to get it in the issue_no field of the tabular report when a new line was entered I ended up putting the following code in for the default for
    issue_no on the report:
    Begin
    return :P1_ISSUE_NO;
    end
    It works great.

Maybe you are looking for

  • How to correct SpryAssets/SpryMenuBar paths in template for sub-directories?

    I recently converted my real estate web site to CSS using Dreamweaver CS4. I use a primary template for most of my pages, which have both a horizontal and a vertical spry menu bar. When I create a page with the template and save it in a sub-directory

  • Basic "why" quest. re: importing songs from CDs

    When I put my CD in the eMac to import songs, the songs from the CD show up on the iTunes screen out of sequence. The song that is first on the original CD/album is now number 7, song 3 from the CD is now number 10, etc. Why is this? How do I put the

  • Oracle 9i Lite and CPU problems

    Are there any known problems with 9i Lite clients on Celeron or other CPU models ? I know there were JVM related problems with one of the Oracle Universal Installers (been there) but this problem occurs when running msql to access the polite db. eg.

  • Illegal constant pool type??

    Hi there, Anyone knows what's going on here????? any help appreciated! [java] java.lang.ClassFormatError: com/bellsouth/estore/cbs/sbvs/relatedaccount/ejb/RelatedAccountServiceBean (Illegal constant pool type] [java] at java.lang.ClassLoader.defineCl

  • SMS to push Java 1.6.0 update 2

    Please help. what are the SMS commands to push Java 1.6.0 update 2 to multiple PCs? Thanks.