Problems using 'IN' clause

I'm making a procedure, and it has a cursor. This cursor receive some parameters and one of them is a list of numbers, the list can't be a VARCHAR2 with ',' or ';' as separator, because it doesn't work, if I use a defined type like 'vet IS TABLE OF NUMBER INDEX BY BINARY_INTEGER' it doesn't work either. The cursor is necessary because it return many output. Here is my code:
PROCEDURE pr_busca_equipamento (
id_pos IN NUMBER,
tipo_posicao IN VARCHAR2,
empresa IN NUMBER,
nro_serie IN VARCHAR2,
id_item IN NUMBER,
status IN NUMBER,
id_equipamento OUT vetornum, -- table of number...
desc_equip OUT vetorchar, -- table of varchar2..
caminho_completo OUT vetorchar,
nro_serie_out OUT vetorchar,
status_out OUT vetornum,
quantidade OUT NUMBER,
erro_cod OUT VARCHAR2,
erro_msg OUT VARCHAR2
IS
CURSOR c_busca_equip(
id_p NUMBER,
tipo_p VARCHAR2,
emp NUMBER,
nroser VARCHAR2, -- or vetorchar
id_i NUMBER,
stat NUMBER)
IS
SELECT eq.id_equipamento,
nroserie,
id_status,
id_item
FROM EQUIPAMENTOS EQ,
EQUIPAMENTOS_POSICAO EP
WHERE (eq.id_equipamento = ep.id_equipamento AND ep.id_posicao = id_p)
AND (id_i IS NULL OR id_item = id_i)
AND (stat IS NULL OR id_status = stat)
AND (nroser IS NULL OR nroserie IN (nroser)) -- my problem is nroser
AND (emp IS NULL OR id_empresa_responsavel = emp);
...

Marcelo,
You can make this work using a VARCHAR2 list separated with commas if you write a 'dynamic' cursor.
For example:
PROCEDURE process_emp (p_deptno IN VARCHAR2)
IS
TYPE my_cur_type IS REF CURSOR; -- could be declared as a strong refcursor (e.g. RETURN emp%ROWTYPE)
my_cur my_cur_type;
emp_rec emp%ROWTYPE; --or declare the appropriate record structure
BEGIN
OPEN my_cur FOR 'select * from emp where deptno in ('||p_deptno||')';
LOOP
FETCH my_cur INTO emp_rec;
EXIT WHEN my_cur%NOTFOUND;
-- process the row returned from the cursor e.g.
htp.p(emp_rec.ename||' earns '||to_char(emp_rec.sal,'fm$999,999'));
END LOOP;
CLOSE my_cur;
END;
Hope this helps.
Cheers,
Bryan.

Similar Messages

  • Problem using Model Clause

    Hi,
    I am executing following query and get the output as shown below.
    Select distinct(Entry_time), Paymentmode_code
    , shift_date
    , vehicleclass_code,
    Cnt
    from v_wog_summary
    model
    UNIQUE SINGLE REFERENCE
         partition by (Entry_Time)
         dimension by (paymentmode_code )
         measures (vehicleclass_code,shift_date, 0 as Cnt)
         RULES upsert
    Cnt[for paymentmode_code in (Select distinct(paymentmode_code) from v_wog_summary)] = 1
    order by shift_date,entry_time,paymentmode_code
    Actual Output:
    ENTRY_TIME     PAYMENTMODE_CODE     SHIFT_DATE     VEHICLECLASS_CODE     CNT
    0:00          2               2-Jan-11          2               1
    0:00          3               2-Jan-11          3               1
    0:00          5               2-Jan-11          5               1
    1:00          1               2-Jan-11          1               1
    1:00          2               2-Jan-11          2               1
    1:00          3               2-Jan-11          3               1
    2:00          1               2-Jan-11          1               1
    2:00          2               2-Jan-11          2               1
    2:00          3               2-Jan-11          3               1
    2:00          4               2-Jan-11          4               1
    I require the following output of the above query:
    the query should display null in vechileclass_code if it is not present.
    Also the query should display all the paymentmode_code (in my case there are total 14 paymentmode_code)
    Required Output :
    ENTRY_TIME     PAYMENTMODE_CODE     SHIFT_DATE     VEHICLECLASS_CODE     CNT
    0:00          1               2-Jan-11          null          1
    0:00          2               2-Jan-11          2          1
    0:00          3               2-Jan-11          3          1
    0:00          4               2-Jan-11          null          1
    0:00          5               2-Jan-11          1          1
    0:00          6               2-Jan-11          null          1
    0:00          7               2-Jan-11          null          1
    0:00          8               2-Jan-11          null          1
    0:00          9               2-Jan-11          null          1
    0:00          10               2-Jan-11          null          1
    0:00          11               2-Jan-11          null          1
    0:00          12               2-Jan-11          null          1
    0:00          13               2-Jan-11          null          1
    0:00          14               2-Jan-11          null          1
    1:00          1               2-Jan-11          1          1
    1:00          2               2-Jan-11          2          1
    1:00          3               2-Jan-11          3          1
    1:00          4               2-Jan-11          null          1
    1:00          5               2-Jan-11          null          1
    1:00          6               2-Jan-11          null          1
    1:00          7               2-Jan-11          null          1
    1:00          8               2-Jan-11          null          1
    1:00          9               2-Jan-11          null          1
    1:00          10               2-Jan-11          null          1
    1:00          11               2-Jan-11          null          1
    1:00          12               2-Jan-11          null          1
    1:00          13               2-Jan-11          null          1
    1:00          14               2-Jan-11          null          1
    2:00          1               2-Jan-11          1          1
    2:00          2               2-Jan-11          2          1
    2:00          3               2-Jan-11          3          1
    2:00          4               2-Jan-11          5          1
    2:00          5               2-Jan-11          null          1
    2:00          6               2-Jan-11          null          1
    2:00          7               2-Jan-11          null          1
    2:00          8               2-Jan-11          null          1
    2:00          9               2-Jan-11          null          1
    2:00          10               2-Jan-11          null          1
    2:00          11               2-Jan-11          null          1
    2:00          12               2-Jan-11          null          1
    2:00          13               2-Jan-11          null          1
    2:00          14               2-Jan-11          null          1

    I am not pretty sure what you want, but i think it is some kind of row generator. For thsi you can use the for loop
    with v_wog_summary as (
    select
       to_date('02012011','DDMMYYYY') shift_date
    , to_char(level-1)||':00' Entry_time
    , level*2 paymentmode_code
    , level*3 vehicleclass_code
    from dual
    connect by
    level <= 3
    select
    shift_date
    ,Entry_time
    ,p paymentmode_code
    ,v vehicleclass_code
    from v_wog_summary
    model
    partition by (shift_date, entry_time)
    dimension by (paymentmode_code p)
    measures(vehicleclass_code v)
    rules(
    v[for p from 1 to 14 increment 1]=v[cv()]
    order by shift_date, entry_time, p
    SHIFT_DATE     ENTRY_TIME     PAYMENTMODE_CODE     VEHICLECLASS_CODE
    01/02/2011     0:00     1     -
    01/02/2011     0:00     2     3
    01/02/2011     0:00     3     -
    01/02/2011     0:00     4     -
    01/02/2011     0:00     5     -
    01/02/2011     0:00     6     -
    01/02/2011     0:00     7     -
    01/02/2011     0:00     8     -
    01/02/2011     0:00     9     -
    01/02/2011     0:00     10     -
    01/02/2011     0:00     11     -
    01/02/2011     0:00     12     -
    01/02/2011     0:00     13     -
    01/02/2011     0:00     14     -
    01/02/2011     1:00     1     -
    01/02/2011     1:00     2     -
    01/02/2011     1:00     3     -
    01/02/2011     1:00     4     6
    01/02/2011     1:00     5     -
    01/02/2011     1:00     6     -
    01/02/2011     1:00     7     -
    01/02/2011     1:00     8     -
    01/02/2011     1:00     9     -
    01/02/2011     1:00     10     -
    01/02/2011     1:00     11     -
    01/02/2011     1:00     12     -
    01/02/2011     1:00     13     -
    01/02/2011     1:00     14     -
    01/02/2011     2:00     1     -
    01/02/2011     2:00     2     -
    01/02/2011     2:00     3     -
    01/02/2011     2:00     4     -
    01/02/2011     2:00     5     -
    01/02/2011     2:00     6     9
    01/02/2011     2:00     7     -
    01/02/2011     2:00     8     -
    01/02/2011     2:00     9     -
    01/02/2011     2:00     10     -
    01/02/2011     2:00     11     -
    01/02/2011     2:00     12     -
    01/02/2011     2:00     13     -
    01/02/2011     2:00     14     -

  • How to use WHERE Clause in BPEL

    Hi ,
    i am trying to use where clause in DB adapter but its not working.
    my query is "select empname from employee where empid = &a"
    can any body tell me what is the reason its npt working?
    and how can i retrive data form DB?

    Hi,
    You are thinking perfectly fine. The solution what I suggested was
    select ename from emp where empno=?
    And the solution provided by you was
    SELECT first_name, last_name FROM per_all_people_f WHERE person_id = #p_person_id
    There is no problem with the above mentioned select statements.
    I just want to say that if you see closely, internal logic changes #parameter name to ?. So both the logics are right.
    Cheers,
    Abhi...

  • Problem using existsnode from view

    I am having a problem using existsnode from a view. I am currently using 10.2.0.3
    example
    CREATE OR REPLACE VIEW XML_PERSON_ASSOCIATION
    (PERSON)
    AS
    select
    xmlelement("Person",
        xmlforest(
            extractvalue(value(p),'/Person/PersonID') "PersonID",
            extractvalue(value(p),'/Person/Prefix') "Prefix",
            extractvalue(value(p),'/Person/FirstName') "FirstName",
            extractvalue(value(p),'/Person/MiddleName') "MiddleName",
            extractvalue(value(p),'/Person/LastName') "LastName",
            extractvalue(value(p),'/Person/Suffix') "Suffix",
            extractvalue(value(p),'/Person/PreferredName') "PreferredName",
            extractvalue(value(p),'/Person/Gender') "Gender",
            extractvalue(value(p),'/Person/PrimaryLanguage') "PrimaryLanguage",
            extractvalue(value(p),'/Person/RecordStatus') "RecordStatus",
            extractvalue(value(p),'/Person/ImportedDate') "ImportedDate",
            (select
                xmlagg(
                    xmlelement("Association",
                        xmlforest(
                            extractvalue(value(oa),'/OrganizationPersonAssoc/Name') "Name",
                            extractvalue(value(ot),'/OrganizationType/OrganizationID') "OrganizationID",
                            extractvalue(value(ot),'/OrganizationType/Type') "OrganizationType",
                            extractvalue(value(a),'/Association/Role') "Role",                        
                            extractvalue(value(a),'/Association/RecordStatus') "RecordStatus",
                            extractvalue(value(oa),'/OrganizationPersonAssoc/ImportedDate') "ImportedDate"                                                
                        xmlelement("PersonTypes",
                            extract(value(per),'/Person/PersonTypes/PersonType')
                        xmlelement("Addresses",
                            extract(value(a),'/Association/Addresses/Address')
                        xmlelement("ContactMechanisms",
                            extract(value(a),'/Association/ContactMechanisms/ContactMechanism')
            from org_person_assoc oa,
            table(xmlsequence(extract(value(oa),'/OrganizationPersonAssoc/OrganizationTypes/OrganizationType'))) ot,
            table(xmlsequence(extract(value(ot),'/OrganizationType/Associations/Association'))) a,
            table(xmlsequence(extract(value(a),'/Association/Persons/Person'))) per
            where extractvalue(value(per),'/Person/PersonID') = extractvalue(value(p),'/Person/PersonID')        
            ) "Associations"
    ) person
    from person p
    /When I run the following statment
    select person
    from xml_person_association o
    where existsnode(person,'/Person/Associations/Association[OrganizationID=30097]')=1;
    I get no records returned. Now if I used the extract function and use the same path that's in the existsnode clause I get a record returned.
    select extract(person,'/Person/Associations/Association')
    from xml_person_association o
    where existsnode(person,'/Person/Associations/Association[OrganizationID=30097]')=1;
    <Association>
    <Name>TEST DATA</Name>
    <OrganizationID>30097</OrganizationID>
    </Association>
    If I run the same style of existsnode statment against a table directly instead of a view I am not required to use an extract caluse that has the same path that is used in the existsnode clause.
    Thanks for the help.
    Message was edited by:
    mdrake

    Testing in 11g I get
    SQL>
    SQL>
    SQL> set echo on
    SQL> spool testcase.log
    SQL> --
    SQL> connect sys/ as sysdba
    Enter password:
    Connected.
    SQL> set define on
    SQL> set timing on
    SQL> --
    SQL> define USERNAME = XDBTEST
    SQL> --
    SQL> def PASSWORD = XDBTEST
    SQL> --
    SQL> def USER_TABLESPACE = USERS
    SQL> --
    SQL> def TEMP_TABLESPACE = TEMP
    SQL> --
    SQL> drop user &USERNAME cascade
      2  /
    old   1: drop user &USERNAME cascade
    new   1: drop user XDBTEST cascade
    User dropped.
    Elapsed: 00:00:09.42
    SQL> grant connect, resource to &USERNAME identified by &PASSWORD
      2  /
    old   1: grant connect, resource to &USERNAME identified by &PASSWORD
    new   1: grant connect, resource to XDBTEST identified by XDBTEST
    Grant succeeded.
    Elapsed: 00:00:00.03
    SQL> grant create any directory, drop any directory to &USERNAME
      2  /
    old   1: grant create any directory, drop any directory to &USERNAME
    new   1: grant create any directory, drop any directory to XDBTEST
    Grant succeeded.
    Elapsed: 00:00:00.00
    SQL> grant alter session, create view to &USERNAME
      2  /
    old   1: grant alter session, create view to &USERNAME
    new   1: grant alter session, create view to XDBTEST
    Grant succeeded.
    Elapsed: 00:00:00.00
    SQL> alter user &USERNAME default tablespace &USER_TABLESPACE temporary tablespace &TEMP_TABLESPACE
      2  /
    old   1: alter user &USERNAME default tablespace &USER_TABLESPACE temporary tablespace &TEMP_TABLESPACE
    new   1: alter user XDBTEST default tablespace USERS temporary tablespace TEMP
    User altered.
    Elapsed: 00:00:00.00
    SQL> connect &USERNAME/&PASSWORD
    Connected.
    SQL> --
    SQL> alter session set events ='19027 trace name context forever, level 0x800'
      2  /
    Session altered.
    Elapsed: 00:00:00.00
    SQL> var xmlText1 clob
    SQL> var xmlText2 clob
    SQL> var xmlSchema clob
    SQL> var schemaURL varchar2(256)
    SQL> --
    SQL> begin
      2    :schemaURL := 'mcs.xsd';
      3    :xmlSchema :=
      4  '<!-- edited with XMLSpy v2007 sp2 (http://www.altova.com) by Shaun (PPD Inc) --> <s:schema xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:xdb=
    "http://xmlns.oracle.com/xdb" elementFormDefault="qualified" xdb:storeVarrayAsTable="true">
      5     <s:element name="Organization" type="Organization" xdb:defaultTable="ORG"/>
      6     <s:element name="Person" type="Person" xdb:defaultTable="PERSON"/>
      7     <s:element name="OrganizationPersonAssoc" type="Organization" xdb:defaultTable="ORG_PERSON_ASSOC"/>
      8     <s:complexType name="Organization" xdb:SQLType="Organization">
      9             <s:sequence minOccurs="0">
    10                     <s:element name="Name" type="s:string" nillable="true"/>
    11                     <s:element name="LongName" type="s:string" nillable="true"/>
    12                     <s:element name="Description" type="s:string" nillable="true"/>
    13                     <s:element name="FWANumber" type="s:string" nillable="true"/>
    14                     <s:element name="GUID" type="s:string" nillable="true"/>
    15                     <s:element name="CreatedDate" type="s:dateTime" xdb:SQLType="TIMESTAMP(6) WITH TIME ZONE"/>
    16                     <s:element name="LastModifiedDate" type="s:dateTime" xdb:SQLType="TIMESTAMP(6) WITH TIME ZONE"/>
    17                     <s:element name="RecordStatus" type="s:string" nillable="true"/>
    18                     <s:element name="RecordStatusDate" type="s:dateTime" xdb:SQLType="TIMESTAMP(6) WITH TIME ZONE"/>
    19                     <s:element name="OrganizationTypes" type="ArrayOfOrganizationType" minOccurs="0"/>
    20                     <s:element name="OrganizationSynonyms" type="ArrayOfOrganizationSynonym"/>
    21                     <s:element name="ImportedDate" type="s:date"/>
    22             </s:sequence>
    23     </s:complexType>
    24     <s:complexType name="ArrayOfOrganizationType" xdb:SQLType="ArrayOfOrganizationType">
    25             <s:sequence minOccurs="0">
    26                     <s:element name="OrganizationType" type="OrganizationType" minOccurs="0" maxOccurs="unbounded"/>
    27             </s:sequence>
    28     </s:complexType>
    29     <s:complexType name="OrganizationType" xdb:SQLType="OrganizationType">
    30             <s:sequence minOccurs="0">
    31                     <s:element name="OrganizationID" type="s:string"/>
    32                     <s:element name="Type" type="s:string" nillable="true"/>
    33                     <s:element name="QCDoneStatus" type="s:string" nillable="true"/>
    34                     <s:element name="QCDoneStatusDate" type="s:dateTime" xdb:SQLType="TIMESTAMP(6) WITH TIME ZONE"/>
    35                     <s:element name="SiteEstablishmentStatus" type="s:string" nillable="true"/>
    36                     <s:element name="SiteEstablishmentStatusDate" type="s:dateTime" xdb:SQLType="TIMESTAMP(6) WITH TIME ZONE"/>
    37                     <s:element name="IPFNumber" type="s:int"/>
    38                     <s:element name="DUNSNumber" type="s:int"/>
    39                     <s:element name="GUID" type="s:string" nillable="true"/>
    40                     <s:element name="CreatedDate" type="s:dateTime" xdb:SQLType="TIMESTAMP(6) WITH TIME ZONE"/>
    41                     <s:element name="LastModifiedDate" type="s:dateTime" xdb:SQLType="TIMESTAMP(6) WITH TIME ZONE"/>
    42                     <s:element name="RecordStatus" type="s:string" nillable="true"/>
    43                     <s:element name="RecordStatusDate" type="s:dateTime" xdb:SQLType="TIMESTAMP(6) WITH TIME ZONE"/>
    44                     <s:element name="LegacyCodes" type="ArrayOfLegacyCode" minOccurs="0"/>
    45                     <s:element name="Addresses" type="ArrayOfAddress" minOccurs="0"/>
    46                     <s:element name="ContactMechanisms" type="ArrayOfContactMechanism" minOccurs="0"/>
    47                     <s:element name="Associations" type="ArrayOfAssociation" minOccurs="0"/>
    48             </s:sequence>
    49     </s:complexType>
    50     <s:complexType name="ArrayOfLegacyCode" xdb:SQLType="ArrayOfLegacyCode">
    51             <s:sequence minOccurs="0">
    52                     <s:element name="LegacyCode" type="LegacyCode" minOccurs="0" maxOccurs="unbounded"/>
    53             </s:sequence>
    54     </s:complexType>
    55     <s:complexType name="LegacyCode" xdb:SQLType="LegacyCode">
    56             <s:sequence minOccurs="0">
    57                     <s:element name="Code" type="s:string" nillable="true"/>
    58                     <s:element name="NetworkID" type="s:string"/>
    59                     <s:element name="GUID" type="s:string" nillable="true"/>
    60                     <s:element name="CreatedDate" type="s:dateTime" xdb:SQLType="TIMESTAMP(6) WITH TIME ZONE"/>
    61                     <s:element name="LastModifiedDate" type="s:dateTime" xdb:SQLType="TIMESTAMP(6) WITH TIME ZONE"/>
    62                     <s:element name="RecordStatus" type="s:string" nillable="true"/>
    63                     <s:element name="RecordStatusDate" type="s:dateTime" xdb:SQLType="TIMESTAMP(6) WITH TIME ZONE"/>
    64             </s:sequence>
    65     </s:complexType>
    66     <s:complexType name="ArrayOfAddress" xdb:SQLType="ArrayOfAddress">
    67             <s:sequence minOccurs="0">
    68                     <s:element name="Address" type="Address" minOccurs="0" maxOccurs="unbounded"/>
    69             </s:sequence>
    70     </s:complexType>
    71     <s:complexType name="Address" xdb:SQLType="Address">
    72             <s:sequence minOccurs="0">
    73                     <s:element name="StreetName1" type="s:string" nillable="true"/>
    74                     <s:element name="StreetName2" type="s:string" nillable="true"/>
    75                     <s:element name="StreetName3" type="s:string" nillable="true"/>
    76                     <s:element name="StreetName4" type="s:string" nillable="true"/>
    77                     <s:element name="CityName" type="s:string" nillable="true"/>
    78                     <s:element name="CityGUID" type="s:string" nillable="true"/>
    79                     <s:element name="CityCreatedDate" type="s:dateTime" xdb:SQLType="TIMESTAMP(6) WITH TIME ZONE"/>
    80                     <s:element name="CityLastModifiedDate" type="s:dateTime" xdb:SQLType="TIMESTAMP(6) WITH TIME ZONE"/>
    81                     <s:element name="CityRecordStatus" type="s:string" nillable="true"/>
    82                     <s:element name="CityRecordStatusDate" type="s:dateTime" xdb:SQLType="TIMESTAMP(6) WITH TIME ZONE"/>
    83                     <s:element name="StateName" type="s:string" nillable="true"/>
    84                     <s:element name="StateGUID" type="s:string" nillable="true"/>
    85                     <s:element name="StateCreatedDate" type="s:dateTime" xdb:SQLType="TIMESTAMP(6) WITH TIME ZONE"/>
    86                     <s:element name="StateLastModifiedDate" type="s:dateTime" xdb:SQLType="TIMESTAMP(6) WITH TIME ZONE"/>
    87                     <s:element name="StateRecordStatus" type="s:string" nillable="true"/>
    88                     <s:element name="StateRecordStatusDate" type="s:dateTime" xdb:SQLType="TIMESTAMP(6) WITH TIME ZONE"/>
    89                     <s:element name="CountryName" type="s:string" nillable="true"/>
    90                     <s:element name="CountryCode" type="s:string" nillable="true"/>
    91                     <s:element name="CountryGUID" type="s:string" nillable="true"/>
    92                     <s:element name="CountryCreatedDate" type="s:dateTime" xdb:SQLType="TIMESTAMP(6) WITH TIME ZONE"/>
    93                     <s:element name="CountryLastModifiedDate" type="s:dateTime" xdb:SQLType="TIMESTAMP(6) WITH TIME ZONE"/>
    94                     <s:element name="CountryRecordStatus" type="s:string" nillable="true"/>
    95                     <s:element name="CountryRecordStatusDate" type="s:dateTime" xdb:SQLType="TIMESTAMP(6) WITH TIME ZONE"/>
    96                     <s:element name="ZipPostalCode" type="s:string" nillable="true"/>
    97                     <s:element name="GUID" type="s:string" nillable="true"/>
    98                     <s:element name="CreatedDate" type="s:dateTime" xdb:SQLType="TIMESTAMP(6) WITH TIME ZONE"/>
    99                     <s:element name="LastModifiedDate" type="s:dateTime" xdb:SQLType="TIMESTAMP(6) WITH TIME ZONE"/>
    100                     <s:element name="RecordStatus" type="s:string" nillable="true"/>
    101                     <s:element name="RecordStatusDate" type="s:dateTime" xdb:SQLType="TIMESTAMP(6) WITH TIME ZONE"/>
    102                     <s:element name="Type" type="s:string" nillable="true"/>
    103                     <s:element name="TypeOtherSpecify" type="s:string" nillable="true"/>
    104                     <s:element name="InternalOffice" type="s:string" nillable="true"/>
    105                     <s:element name="MailStopCode" type="s:string" nillable="true"/>
    106                     <s:element name="PreferredFlag" type="s:string" nillable="true"/>
    107                     <s:element name="ActiveFromDate" type="s:dateTime" xdb:SQLType="TIMESTAMP(6) WITH TIME ZONE"/>
    108                     <s:element name="QCDoneStatus" type="s:string" nillable="true"/>
    109                     <s:element name="QCDoneStatusDate" type="s:dateTime" xdb:SQLType="TIMESTAMP(6) WITH TIME ZONE"/>
    110             </s:sequence>
    111     </s:complexType>
    112     <s:complexType name="ArrayOfContactMechanism" xdb:SQLType="ArrayOfContactMechanism">
    113             <s:sequence minOccurs="0">
    114                     <s:element name="ContactMechanism" type="ContactMechanism" minOccurs="0" maxOccurs="unbounded"/>
    115             </s:sequence>
    116     </s:complexType>
    117     <s:complexType name="ContactMechanism" xdb:SQLType="ContactMechanism">
    118             <s:sequence minOccurs="0">
    119                     <s:element name="ContactType" type="s:string" nillable="true"/>
    120                     <s:element name="ContactTypeOtherSpecify" type="s:string" nillable="true"/>
    121                     <s:element name="ContactValue" type="s:string" nillable="true"/>
    122                     <s:element name="ContactAreaCode" type="s:string" nillable="true"/>
    123                     <s:element name="ContactCountryCallingCode" type="s:int"/>
    124                     <s:element name="ContactTollFreeFlag" type="s:string" nillable="true"/>
    125                     <s:element name="ContactGUID" type="s:string" nillable="true"/>
    126                     <s:element name="ContactCreatedDate" type="s:dateTime" xdb:SQLType="TIMESTAMP(6) WITH TIME ZONE"/>
    127                     <s:element name="ContactLastModifiedDate" type="s:dateTime" xdb:SQLType="TIMESTAMP(6) WITH TIME ZONE"/>
    128                     <s:element name="ContactRecordStatus" type="s:string" nillable="true"/>
    129                     <s:element name="ContactRecordStatusDate" type="s:dateTime" xdb:SQLType="TIMESTAMP(6) WITH TIME ZONE"/>
    130                     <s:element name="Role" type="s:string" nillable="true"/>
    131                     <s:element name="PhoneExtension" type="s:string" nillable="true"/>
    132                     <s:element name="QCDoneStatus" type="s:string" nillable="true"/>
    133                     <s:element name="QCDoneStatusDate" type="s:dateTime" xdb:SQLType="TIMESTAMP(6) WITH TIME ZONE"/>
    134                     <s:element name="ActiveFromDate" type="s:dateTime" xdb:SQLType="TIMESTAMP(6) WITH TIME ZONE"/>
    135                     <s:element name="GUID" type="s:string" nillable="true"/>
    136                     <s:element name="CreatedDate" type="s:dateTime" xdb:SQLType="TIMESTAMP(6) WITH TIME ZONE"/>
    137                     <s:element name="ModifiedDate" type="s:dateTime" xdb:SQLType="TIMESTAMP(6) WITH TIME ZONE"/>
    138                     <s:element name="PreferredFlag" type="s:string" nillable="true"/>
    139                     <s:element name="RecordStatus" type="s:string" nillable="true"/>
    140                     <s:element name="RecordStatusDate" type="s:dateTime" xdb:SQLType="TIMESTAMP(6) WITH TIME ZONE"/>
    141             </s:sequence>
    142     </s:complexType>
    143     <s:complexType name="ArrayOfAssociation" xdb:SQLType="ArrayOfAssociation">
    144             <s:sequence minOccurs="0">
    145                     <s:element name="Association" type="Association" minOccurs="0" maxOccurs="unbounded"/>
    146             </s:sequence>
    147     </s:complexType>
    148     <s:complexType name="Association" xdb:SQLType="Association">
    149             <s:sequence minOccurs="0">
    150                     <s:element name="Role" type="s:string" nillable="true"/>
    151                     <s:element name="GUID" type="s:string" nillable="true"/>
    152                     <s:element name="QCDoneStatus" type="s:string" nillable="true"/>
    153                     <s:element name="QCDoneStatusDate" type="s:dateTime" xdb:SQLType="TIMESTAMP(6) WITH TIME ZONE"/>
    154                     <s:element name="CreatedDate" type="s:dateTime" xdb:SQLType="TIMESTAMP(6) WITH TIME ZONE"/>
    155                     <s:element name="LastModifiedDate" type="s:dateTime" xdb:SQLType="TIMESTAMP(6) WITH TIME ZONE"/>
    156                     <s:element name="RecordStatus" type="s:string" nillable="true"/>
    157                     <s:element name="RecordStatusDate" type="s:dateTime" xdb:SQLType="TIMESTAMP(6) WITH TIME ZONE"/>
    158                     <s:element name="Addresses" type="ArrayOfAddress" minOccurs="0"/>
    159                     <s:element name="ContactMechanisms" type="ArrayOfContactMechanism" minOccurs="0"/>
    160                     <s:element name="Persons" type="ArrayOfPerson" minOccurs="0"/>
    161             </s:sequence>
    162     </s:complexType>
    163     <s:complexType name="ArrayOfPerson" xdb:SQLType="ArrayOfPerson">
    164             <s:sequence minOccurs="0">
    165                     <s:element name="Person" type="Person" minOccurs="0" maxOccurs="unbounded"/>
    166             </s:sequence>
    167     </s:complexType>
    168     <s:complexType name="Person" xdb:SQLType="Person">
    169             <s:sequence minOccurs="0">
    170                     <s:element name="PersonID" type="s:int"/>
    171                     <s:element name="Prefix" type="s:string" nillable="true"/>
    172                     <s:element name="FirstName" type="s:string" nillable="true"/>
    173                     <s:element name="MiddleName" type="s:string" nillable="true"/>
    174                     <s:element name="LastName" type="s:string" nillable="true"/>
    175                     <s:element name="Suffix" type="s:string" nillable="true"/>
    176                     <s:element name="PreferredName" type="s:string" nillable="true"/>
    177                     <s:element name="Gender" type="s:string" nillable="true"/>
    178                     <s:element name="PrimaryLanguage" type="s:string" nillable="true"/>
    179                     <s:element name="GUID" type="s:string" nillable="true"/>
    180                     <s:element name="RecordStatus" type="s:string" nillable="true"/>
    181                     <s:element name="RecordStatusDate" type="s:dateTime" xdb:SQLType="TIMESTAMP(6) WITH TIME ZONE"/>
    182                     <s:element name="CreatedDate" type="s:dateTime" xdb:SQLType="TIMESTAMP(6) WITH TIME ZONE"/>
    183                     <s:element name="LastModifiedDate" type="s:dateTime" xdb:SQLType="TIMESTAMP(6) WITH TIME ZONE"/>
    184                     <s:element name="QCDoneStatus" type="s:string" nillable="true"/>
    185                     <s:element name="QCDoneStatusDate" type="s:dateTime" xdb:SQLType="TIMESTAMP(6) WITH TIME ZONE"/>
    186                     <s:element name="PersonDegrees" type="ArrayOfPersonDegree" minOccurs="0"/>
    187                     <s:element name="PersonSpecialties" type="ArrayOfPersonSpecialty" minOccurs="0"/>
    188                     <s:element name="PersonTypes" type="ArrayOfPersonType" minOccurs="0"/>
    189                     <s:element name="Addresses" type="ArrayOfAddress" minOccurs="0"/>
    190                     <s:element name="ContactMechanisms" type="ArrayOfContactMechanism" minOccurs="0"/>
    191                     <s:element name="ImportedDate" type="s:date"/>
    192             </s:sequence>
    193     </s:complexType>
    194     <s:complexType name="ArrayOfPersonDegree" xdb:SQLType="ArrayOfPersonDegree">
    195             <s:sequence minOccurs="0">
    196                     <s:element name="PersonDegree" type="PersonDegree" minOccurs="0" maxOccurs="unbounded"/>
    197             </s:sequence>
    198     </s:complexType>
    199     <s:complexType name="PersonDegree" xdb:SQLType="PersonDegree">
    200             <s:sequence minOccurs="0">
    201                     <s:element name="Code" type="s:string" nillable="true"/>
    202                     <s:element name="Major" type="s:string" nillable="true"/>
    203                     <s:element name="ListingOrder" type="s:int"/>
    204                     <s:element name="GUID" type="s:string" nillable="true"/>
    205                     <s:element name="RecordStatus" type="s:string" nillable="true"/>
    206                     <s:element name="RecordStatusDate" type="s:dateTime" xdb:SQLType="TIMESTAMP(6) WITH TIME ZONE"/>
    207                     <s:element name="CreatedDate" type="s:dateTime" xdb:SQLType="TIMESTAMP(6) WITH TIME ZONE"/>
    208                     <s:element name="LastModifiedDate" type="s:dateTime" xdb:SQLType="TIMESTAMP(6) WITH TIME ZONE"/>
    209             </s:sequence>
    210     </s:complexType>
    211     <s:complexType name="ArrayOfPersonSpecialty" xdb:SQLType="ArrayOfPersonSpecialty">
    212             <s:sequence minOccurs="0">
    213                     <s:element name="PersonSpecialty" type="PersonSpecialty" minOccurs="0" maxOccurs="unbounded"/>
    214             </s:sequence>
    215     </s:complexType>
    216     <s:complexType name="PersonSpecialty" xdb:SQLType="PersonSpecialty">
    217             <s:sequence minOccurs="0">
    218                     <s:element name="Name" type="s:string" nillable="true"/>
    219                     <s:element name="GUID" type="s:string" nillable="true"/>
    220                     <s:element name="RecordStatus" type="s:string" nillable="true"/>
    221                     <s:element name="RecordStatusDate" type="s:dateTime" xdb:SQLType="TIMESTAMP(6) WITH TIME ZONE"/>
    222                     <s:element name="CreatedDate" type="s:dateTime" xdb:SQLType="TIMESTAMP(6) WITH TIME ZONE"/>
    223                     <s:element name="LastModifiedDate" type="s:dateTime" xdb:SQLType="TIMESTAMP(6) WITH TIME ZONE"/>
    224             </s:sequence>
    225     </s:complexType>
    226     <s:complexType name="ArrayOfPersonType" xdb:SQLType="ArrayOfPersonType">
    227             <s:sequence minOccurs="0">
    228                     <s:element name="PersonType" type="PersonType" minOccurs="0" maxOccurs="unbounded"/>
    229             </s:sequence>
    230     </s:complexType>
    231     <s:complexType name="PersonType" xdb:SQLType="PersonType">
    232             <s:sequence minOccurs="0">
    233                     <s:element name="Type" type="s:string" nillable="true"/>
    234                     <s:element name="GUID" type="s:string" nillable="true"/>
    235                     <s:element name="RecordStatus" type="s:string" nillable="true"/>
    236                     <s:element name="RecordStatusDate" type="s:dateTime" xdb:SQLType="TIMESTAMP(6) WITH TIME ZONE"/>
    237                     <s:element name="CreatedDate" type="s:dateTime" xdb:SQLType="TIMESTAMP(6) WITH TIME ZONE"/>
    238                     <s:element name="LastModifiedDate" type="s:dateTime" xdb:SQLType="TIMESTAMP(6) WITH TIME ZONE"/>
    239                     <s:element name="QCDoneStatus" type="s:string" nillable="true"/>
    240                     <s:element name="QCDoneStatusDate" type="s:dateTime" xdb:SQLType="TIMESTAMP(6) WITH TIME ZONE"/>
    241             </s:sequence>
    242     </s:complexType>
    243     <s:complexType name="ArrayOfOrganizationSynonym" xdb:SQLType="ArrayOfOrganizationSynonym">
    244             <s:sequence minOccurs="0">
    245                     <s:element name="OrganizationSynonym" type="OrganizationSynonym" minOccurs="0" maxOccurs="unbounded"/>
    246             </s:sequence>
    247     </s:complexType>
    248     <s:complexType name="OrganizationSynonym" xdb:SQLType="OrganizationSynonym">
    249             <s:sequence minOccurs="0">
    250                     <s:element name="Name" type="s:string" nillable="true"/>
    251                     <s:element name="GUID" type="s:string" nillable="true"/>
    252                     <s:element name="CreatedDate" type="s:dateTime" xdb:SQLType="TIMESTAMP(6) WITH TIME ZONE"/>
    253                     <s:element name="LastModifiedDate" type="s:dateTime" xdb:SQLType="TIMESTAMP(6) WITH TIME ZONE"/>
    254                     <s:element name="RecordStatus" type="s:string" nillable="true"/>
    255                     <s:element name="RecordStatusDate" type="s:dateTime" xdb:SQLType="TIMESTAMP(6) WITH TIME ZONE"/>
    256             </s:sequence>
    257     </s:complexType>
    258  </s:schema>';
    259    :xmltext1 :=
    260  '<?xml version="1.0" encoding="WINDOWS-1252"?> <Person xsi:noNamespaceSchemaLocation="mcs.xsd" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns
    :xsi="http://www.w3.org/2001/XMLSchema-instance">
    261    <PersonID>100448</PersonID>
    262    <Prefix/>
    263    <FirstName>John</FirstName>
    264    <MiddleName/>
    265    <LastName>Doe</LastName>
    266    <Suffix/>
    267    <PreferredName/>
    268    <Gender/>
    269    <PrimaryLanguage xsi:nil="true"/>
    270    <GUID>ffff-ffff-ffff</GUID>
    271    <RecordStatus>Active</RecordStatus>
    272    <RecordStatusDate>2007-04-29T00:11:50.750000-04:00</RecordStatusDate>
    273    <CreatedDate>2006-06-13T00:57:21.090000-04:00</CreatedDate>
    274    <LastModifiedDate>2007-04-29T00:11:50.770000-04:00</LastModifiedDate>
    275    <QCDoneStatus>Yes</QCDoneStatus>
    276    <QCDoneStatusDate>2006-06-13T00:57:22.977000-04:00</QCDoneStatusDate>
    277    <PersonDegrees>
    278      <PersonDegree>
    279        <Code>B.S.</Code>
    280        <Major xsi:nil="true"/>
    281        <ListingOrder>1</ListingOrder>
    282        <GUID>d01bbcfd-9d48-47bf-818d-9957b907a664</GUID>
    283        <RecordStatus>Active</RecordStatus>
    284        <RecordStatusDate>2006-10-05T10:48:04.430000-04:00</RecordStatusDate>
    285        <CreatedDate>2006-10-05T10:48:06.520000-04:00</CreatedDate>
    286        <LastModifiedDate>2006-10-05T10:48:06.520000-04:00</LastModifiedDate>
    287      </PersonDegree>
    288    </PersonDegrees>
    289    <PersonSpecialties/>
    290    <PersonTypes>
    291      <PersonType>
    292        <Type>Resource Personnel</Type>
    293        <GUID>3049ddcd-3590-4fd9-a534-e2cea5b82c09</GUID>
    294        <RecordStatus>Active</RecordStatus>
    295        <RecordStatusDate>2006-06-13T00:57:22.977000-04:00</RecordStatusDate>
    296        <CreatedDate>2006-06-13T00:57:21.090000-04:00</CreatedDate>
    297        <LastModifiedDate>2007-04-29T00:11:50.817000-04:00</LastModifiedDate>
    298        <QCDoneStatus>Yes</QCDoneStatus>
    299        <QCDoneStatusDate>2006-06-13T00:57:22.977000-04:00</QCDoneStatusDate>
    300      </PersonType>
    301    </PersonTypes>
    302    <Addresses/>
    303    <ContactMechanisms/>
    304    <ImportedDate>2007-04-30</ImportedDate>
    305  </Person>';
    306    :xmltext2 :=
    307  '<?xml version="1.0" encoding="WINDOWS-1252"?> <OrganizationPersonAssoc xsi:noNamespaceSchemaLocation="mcs.xsd" xmlns:xsd="http://www.w3.org/2001
    /XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    308    <Name>Org Name Office</Name>
    309    <LongName>Long Name</LongName>
    310    <Description xsi:nil="true"/>
    311    <FWANumber xsi:nil="true"/>
    312    <GUID>dddd-dddd</GUID>
    313    <CreatedDate>2006-05-18T18:59:01.500000-04:00</CreatedDate>
    314    <LastModifiedDate>2006-05-18T18:59:01.500000-04:00</LastModifiedDate>
    315    <RecordStatus>Active</RecordStatus>
    316    <RecordStatusDate>2006-05-18T18:59:01.500000-04:00</RecordStatusDate>
    317    <OrganizationTypes>
    318      <OrganizationType>
    319        <OrganizationID>30097</OrganizationID>
    320        <Type>Agency</Type>
    321        <QCDoneStatus>Yes</QCDoneStatus>
    322        <QCDoneStatusDate>2006-05-18T18:59:01.513000-04:00</QCDoneStatusDate>
    323        <SiteEstablishmentStatus xsi:nil="true"/>
    324        <SiteEstablishmentStatusDate>0001-01-01T00:00:00.000000-05:00</SiteEstablishmentStatusDate>
    325        <IPFNumber>0</IPFNumber>
    326        <DUNSNumber>0</DUNSNumber>
    327        <GUID>cfe9e9e0-68a3-45c9-81c0-74848523133b</GUID>
    328        <CreatedDate>2006-05-18T18:59:01.513000-04:00</CreatedDate>
    329        <LastModifiedDate>2006-05-18T18:59:01.513000-04:00</LastModifiedDate>
    330        <RecordStatus>Active</RecordStatus>
    331        <RecordStatusDate>2006-05-18T18:59:01.513000-04:00</RecordStatusDate>
    332        <Associations>
    333          <Association>
    334            <Role>Employee</Role>
    335            <GUID>9a9a9a-ababab</GUID>
    336            <QCDoneStatus>Yes</QCDoneStatus>
    337            <QCDoneStatusDate>2006-06-13T01:29:09.030000-04:00</QCDoneStatusDate>
    338            <CreatedDate>2006-06-13T01:29:09.030000-04:00</CreatedDate>
    339            <LastModifiedDate>2006-07-25T15:27:23.783000-04:00</LastModifiedDate>
    340            <RecordStatus>Active</RecordStatus>
    341            <RecordStatusDate>2006-06-13T01:29:09.030000-04:00</RecordStatusDate>
    342            <Addresses>
    343              <Address>
    344                <StreetName1>123 Front St.</StreetName1>
    345                <StreetName2 xsi:nil="true"/>
    346                <StreetName3 xsi:nil="true"/>
    347                <StreetName4 xsi:nil="true"/>
    348                <CityName>City</CityName>
    349                <CityGUID>234234</CityGUID>
    350                <CityCreatedDate>2006-05-08T20:06:45.143000-04:00</CityCreatedDate>
    351                <CityLastModifiedDate>2006-05-08T20:06:45.143000-04:00</CityLastModifiedDate>
    352                <CityRecordStatus>Active</CityRecordStatus>
    353                <CityRecordStatusDate>2006-05-08T20:06:45.143000-04:00</CityRecordStatusDate>
    354                <StateName>New York</StateName>
    355                <StateGUID>9fd469e1-4d4a-4f38-9def-50038e5ecca2</StateGUID>
    356                <StateCreatedDate>2006-04-22T16:09:35.830000-04:00</StateCreatedDate>
    357                <StateLastModifiedDate>2006-04-22T16:09:35.830000-04:00</StateLastModifiedDate>
    358                <StateRecordStatus>Active</StateRecordStatus>
    359                <StateRecordStatusDate>2006-04-22T16:09:35.830000-04:00</StateRecordStatusDate>
    360                <CountryName>United States</CountryName>
    361                <CountryCode>USA</CountryCode>
    362                <CountryGUID>532d35dd-3a49-408a-a416-20c41e9c7997</CountryGUID>
    363                <CountryCreatedDate>2006-04-22T15:30:47.000000-04:00</CountryCreatedDate>
    364                <CountryLastModifiedDate>2006-04-22T15:30:47.000000-04:00</CountryLastModifiedDate>
    365                <CountryRecordStatus>Active</CountryRecordStatus>
    366                <CountryRecordStatusDate>2006-04-22T15:30:47.000000-04:00</CountryRecordStatusDate>
    367                <ZipPostalCode>12345</ZipPostalCode>
    368                <GUID>b2414fa9-7375-4d26-8d76-89a6915d6751</GUID>
    369                <CreatedDate>2006-06-13T01:29:09.030000-04:00</CreatedDate>
    370                <LastModifiedDate>2006-07-29T23:45:17.670000-04:00</LastModifiedDate>
    371                <RecordStatus>Active</RecordStatus>
    372                <RecordStatusDate>2006-06-13T01:29:09.030000-04:00</RecordStatusDate>
    373                <Type>Office</Type>
    374                <TypeOtherSpecify/>
    375                <InternalOffice></InternalOffice>
    376                <MailStopCode/>
    377                <PreferredFlag>Yes</PreferredFlag>
    378                <ActiveFromDate>2006-06-13T01:29:09.000000-04:00</ActiveFromDate>
    379                <QCDoneStatus>Yes</QCDoneStatus>
    380                <QCDoneStatusDate>2006-06-13T01:29:09.030000-04:00</QCDoneStatusDate>
    381              </Address>
    382            </Addresses>
    383            <ContactMechanisms>
    384              <ContactMechanism>
    385                <ContactType>Phone</ContactType>
    386                <ContactTypeOtherSpecify xsi:nil="true"/>
    387                <ContactValue>555-5555</ContactValue>
    388                <ContactAreaCode>555</ContactAreaCode>
    389                <ContactCountryCallingCode>1</ContactCountryCallingCode>
    390                <ContactTollFreeFlag xsi:nil="true"/>
    391                <ContactGUID>123</ContactGUID>
    392                <ContactCreatedDate>2006-06-13T01:29:09.047000-04:00</ContactCreatedDate>
    393                <ContactLastModifiedDate>2007-02-23T16:36:10.260000-05:00</ContactLastModifiedDate>
    394                <ContactRecordStatus>Active</ContactRecordStatus>
    395                <ContactRecordStatusDate>2006-06-13T01:29:09.047000-04:00</ContactRecordStatusDate>
    396                <Role>Business</Role>
    397                <PhoneExtension/>
    398                <QCDoneStatus>Yes</QCDoneStatus>
    399                <QCDoneStatusDate>2006-06-13T01:29:09.047000-04:00</QCDoneStatusDate>
    400                <ActiveFromDate>2006-06-13T01:29:09.000000-04:00</ActiveFromDate>
    401                <GUID>321</GUID>
    402                <CreatedDate>2006-06-13T01:29:09.047000-04:00</CreatedDate>
    403                <ModifiedDate>2006-07-29T23:53:03.323000-04:00</ModifiedDate>
    404                <PreferredFlag>Yes</PreferredFlag>
    405                <RecordStatus>Inactive</RecordStatus>
    406                <RecordStatusDate>2006-07-29T23:53:03.393000-04:00</RecordStatusDate>
    407              </ContactMechanism>
    408              <ContactMechanism>
    409                <ContactType>Email</ContactType>
    410                <ContactTypeOtherSpecify xsi:nil="true"/>
    411                <ContactValue>[email protected]</ContactValue>
    412                <ContactAreaCode xsi:nil="true"/>
    413                <ContactCountryCallingCode>0</ContactCountryCallingCode>
    414                <ContactTollFreeFlag xsi:nil="true"/>
    415                <ContactGUID>ddd</ContactGUID>
    416                <ContactCreatedDate>2006-06-13T01:29:09.047000-04:00</ContactCreatedDate>
    417                <ContactLastModifiedDate>2006-06-13T01:29:09.047000-04:00</ContactLastModifiedDate>
    418                <ContactRecordStatus>Active</ContactRecordStatus>
    419                <ContactRecordStatusDate>2006-06-13T01:29:09.047000-04:00</ContactRecordStatusDate>
    420                <Role>Business</Role>
    421                <PhoneExtension xsi:nil="true"/>
    422                <QCDoneStatus>Yes</QCDoneStatus>
    423                <QCDoneStatusDate>2006-06-13T01:29:09.063000-04:00</QCDoneStatusDate>
    424                <ActiveFromDate>2006-06-13T01:29:09.063000-04:00</ActiveFromDate>
    425                <GUID>111</GUID>
    426                <CreatedDate>2006-06-13T01:29:09.063000-04:00</CreatedDate>
    427                <ModifiedDate>2006-06-13T01:29:09.063000-04:00</ModifiedDate>
    428                <PreferredFlag>Yes</PreferredFlag>
    429                <RecordStatus>Active</RecordStatus>
    430                <RecordStatusDate>2006-06-13T01:29:09.063000-04:00</RecordStatusDate>
    431              </ContactMechanism>
    432            </ContactMechanisms>
    433            <Persons>
    434              <Person>
    435                <PersonID>100448</PersonID>
    436                <Prefix/>
    437                <FirstName>John</FirstName>
    438                <MiddleName/>
    439                <LastName>Doe</LastName>
    440                <Suffix/>
    441                <PreferredName/>
    442                <Gender/>
    443                <PrimaryLanguage xsi:nil="true"/>
    444                <GUID>123</GUID>
    445                <RecordStatus>Active</RecordStatus>
    446                <RecordStatusDate>2007-04-29T00:11:50.750000-04:00</RecordStatusDate>
    447                <CreatedDate>2006-06-13T00:57:21.090000-04:00</CreatedDate>
    448                <LastModifiedDate>2007-04-29T00:11:50.770000-04:00</LastModifiedDate>
    449                <QCDoneStatus>Yes</QCDoneStatus>
    450                <QCDoneStatusDate>2006-06-13T00:57:22.977000-04:00</QCDoneStatusDate>
    451                <PersonTypes>
    452                  <PersonType>
    453                    <Type>Resource Personnel</Type>
    454                    <GUID>3049ddcd-3590-4fd9-a534-e2cea5b82c09</GUID>
    455                    <RecordStatus>Active</RecordStatus>
    456                    <RecordStatusDate>2006-06-13T00:57:22.977000-04:00</RecordStatusDate>
    457                    <CreatedDate>2006-06-13T00:57:21.090000-04:00</CreatedDate>
    458                    <LastModifiedDate>2007-04-29T00:11:50.817000-04:00</LastModifiedDate>
    459                    <QCDoneStatus>Yes</QCDoneStatus>
    460                    <QCDoneStatusDate>2006-06-13T00:57:22.977000-04:00</QCDoneStatusDate>
    461                  </PersonType>
    462                </PersonTypes>
    463              </Person>
    464            </Persons>
    465          </Association>
    466        </Associations>
    467      </OrganizationType>
    468    </OrganizationTypes>
    469    <ImportedDate>2007-04-30</ImportedDate>
    470  </OrganizationPersonAssoc>
    471  ';
    472  end;
    473  /
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:00.00
    SQL> begin
      2    dbms_xmlschema.registerSchema
      3    (
      4        schemaURL => :schemaURL
      5       ,schemaDoc => :xmlSchema
      6       ,local     => TRUE
      7       ,genBean   => false
      8       ,genTypes  => TRUE
      9       ,genTables => TRUE
    10       ,enableHierarchy => DBMS_XMLSCHEMA.ENABLE_HIERARCHY_NONE
    11    );
    12  end;
    13  /
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:03.67
    SQL> insert into Person values ( xmltype (:xmltext1))
      2  /
    1 row created.
    Elapsed: 00:00:00.07
    SQL> insert into org_person_assoc values ( xmltype (:xmltext2))
      2  /
    1 row created.
    Elapsed: 00:00:00.03
    SQL> commit
      2  /
    Commit complete.
    Elapsed: 00:00:00.00
    SQL> CREATE OR REPLACE VIEW XML_PERSON_ASSOCIATION
      2  (PERSON)
      3  AS
      4  select
      5  xmlelement("Person",
      6      xmlforest(
      7          extractvalue(value(p),'/Person/PersonID') "PersonID",
      8          extractvalue(value(p),'/Person/Prefix') "Prefix",
      9          extractvalue(value(p),'/Person/FirstName') "FirstName",
    10          extractvalue(value(p),'/Person/MiddleName') "MiddleName",
    11          extractvalue(value(p),'/Person/LastName') "LastName",
    12          extractvalue(value(p),'/Person/Suffix') "Suffix",
    13          extractvalue(value(p),'/Person/PreferredName') "PreferredName",
    14          extractvalue(value(p),'/Person/Gender') "Gender",
    15          extractvalue(value(p),'/Person/PrimaryLanguage') "PrimaryLanguage",
    16          extractvalue(value(p),'/Person/RecordStatus') "RecordStatus",
    17          extractvalue(value(p),'/Person/ImportedDate') "ImportedDate",
    18          (select
    19              xmlagg(
    20                  xmlelement("Association",
    21                      xmlforest(
    22                          extractvalue(value(oa),'/OrganizationPersonAssoc/Name') "Name",
    23                          extractvalue(value(ot),'/OrganizationType/OrganizationID') "OrganizationID",
    24                          extractvalue(value(ot),'/OrganizationType/Type') "OrganizationType",
    25                          extractvalue(value(a),'/Association/Role') "Role",
    26                          extractvalue(value(a),'/Association/RecordStatus') "RecordStatus",
    27                          extractvalue(value(oa),'/OrganizationPersonAssoc/ImportedDate') "ImportedDate"
    28                      ),
    29                      xmlelement("PersonTypes",
    30                          extract(value(per),'/Person/PersonTypes/PersonType')
    31                      ),
    32                      xmlelement("Addresses",
    33                          extract(value(a),'/Association/Addresses/Address')
    34                      ),
    35                      xmlelement("ContactMechanisms",
    36                          extract(value(a),'/Association/ContactMechanisms/ContactMechanism')
    37                      )
    38                  )
    39              )
    40          from org_person_assoc oa,
    41          table(xmlsequence(extract(value(oa),'/OrganizationPersonAssoc/OrganizationTypes/OrganizationType'))) ot,
    42          table(xmlsequence(extract(value(ot),'/OrganizationType/Associations/Association'))) a,
    43          table(xmlsequence(extract(value(a),'/Association/Persons/Person'))) per
    44          where extractvalue(value(per),'/Person/PersonID') = extractvalue(value(p),'/Person/PersonID')
    45          ) "Associations"
    46      )
    47  ) person
    48  from person p
    49  /
    View created.
    Elapsed: 00:00:00.06
    SQL> set autotrace on explain
    SQL> --
    SQL> set long 10000 pages 0 lines 150
    SQL> --
    SQL> select person
      2    from xml_person_association o
      3   where existsnode(person,'/Person/Associations/Association[OrganizationID=30097]')=1
      4  /
    <Person><PersonID>100448</PersonID><FirstName>John</FirstName><LastName>Doe</LastName><RecordStatus>Active</RecordStatus><ImportedDate>2007-04-30</Imp
    ortedDate><Associations><Association><Name>Org Name Office</Name><OrganizationID>30097</OrganizationID><OrganizationType>Agency</OrganizationType><Rol
    e>Employee</Role><RecordStatus>Active</RecordStatus><ImportedDate>2007-04-30</ImportedDate><PersonTypes><PersonType>
      <Type>Resource Personnel</Type>
      <GUID>3049ddcd-3590-4fd9-a534-e2cea5b82c09</GUID>
      <RecordStatus>Active</RecordStatus>
      <RecordStatusDate>2006-06-13T00:57:22.977000-04:00</RecordStatusDate>
      <CreatedDate>2006-06-13T00:57:21.090000-04:00</CreatedDate>
      <LastModifiedDate>2007-04-29T00:11:50.817000-04:00</LastModifiedDate>
      <QCDoneStatus>Yes</QCDoneStatus>
      <QCDoneStatusDate>2006-06-13T00:57:22.977000-04:00</QCDoneStatusDate>
    </PersonType>
    </PersonTypes><Addresses><Address>
      <StreetName1>123 Front St.</StreetName1>
      <StreetName2 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
      <StreetName3 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
      <StreetName4 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
      <CityName>City</CityName>
      <CityGUID>234234</CityGUID>
      <CityCreatedDate>2006-05-08T20:06:45.143000-04:00</CityCreatedDate>
      <CityLastModifiedDate>2006-05-08T20:06:45.143000-04:00</CityLastModifiedDate>
      <CityRecordStatus>Active</CityRecordStatus>
      <CityRecordStatusDate>2006-05-08T20:06:45.143000-04:00</CityRecordStatusDate>
      <StateName>New York</StateName>
      <StateGUID>9fd469e1-4d4a-4f38-9def-50038e5ecca2</StateGUID>
      <StateCreatedDate>2006-04-22T16:09:35.830000-04:00</StateCreatedDate>
      <StateLastModifiedDate>2006-04-22T16:09:35.830000-04:00</StateLastModifiedDate>
      <StateRecordStatus>Active</StateRecordStatus>
      <StateRecordStatusDate>2006-04-22T16:09:35.830000-04:00</StateRecordStatusDate>
      <CountryName>United States</CountryName>
      <CountryCode>USA</CountryCode>
      <CountryGUID>532d35dd-3a49-408a-a416-20c41e9c7997</CountryGUID>
      <CountryCreatedDate>2006-04-22T15:30:47.000000-04:00</CountryCreatedDate>
      <CountryLastModifiedDate>2006-04-22T15:30:47.000000-04:00</CountryLastModifiedDate>
      <CountryRecordStatus>Active</CountryRecordStatus>
      <CountryRecordStatusDate>2006-04-22T15:30:47.000000-04:00</CountryRecordStatusDate>
      <ZipPostalCode>12345</ZipPostalCode>
      <GUID>b2414fa9-7375-4d26-8d76-89a6915d6751</GUID>
      <CreatedDate>2006-06-13T01:29:09.030000-04:00</CreatedDate>
      <LastModifiedDate>2006-07-29T23:45:17.670000-04:00</LastModifiedDate>
      <RecordStatus>Active</RecordStatus>
      <RecordStatusDate>2006-06-13T01:29:09.030000-04:00</RecordStatusDate>
      <Type>Office</Type>
      <TypeOtherSpecify/>
      <InternalOffice/>
      <MailStopCode/>
      <PreferredFlag>Yes</PreferredFlag>
      <ActiveFromDate>2006-06-13T01:29:09.000000-04:00</ActiveFromDate>
      <QCDoneStatus>Yes</QCDoneStatus>
      <QCDoneStatusDate>2006-06-13T01:29:09.030000-04:00</QCDoneStatusDate>
    </Address>
    </Addresses><ContactMechanisms><ContactMechanism>
      <ContactType>Phone</ContactType>
      <ContactTypeOtherSpecify xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
      <ContactValue>555-5555</ContactValue>
      <ContactAreaCode>555</ContactAreaCode>
      <ContactCountryCallingCode>1</ContactCountryCallingCode>
      <ContactTollFreeFlag xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
      <ContactGUID>123</ContactGUID>
      <ContactCreatedDate>2006-06-13T01:29:09.047000-04:00</ContactCreatedDate>
      <ContactLastModifiedDate>2007-02-23T16:36:10.260000-05:00</ContactLastModifiedDate>
      <ContactRecordStatus>Active</ContactRecordStatus>
      <ContactRecordStatusDate>2006-06-13T01:29:09.047000-04:00</ContactRecordStatusDate>
      <Role>Business</Role>
      <PhoneExtension/>
      <QCDoneStatus>Yes</QCDoneStatus>
      <QCDoneStatusDate>2006-06-13T01:29:09.047000-04:00</QCDoneStatusDate>
      <ActiveFromDate>2006-06-13T01:29:09.000000-04:00</ActiveFromDate>
      <GUID>321</GUID>
      <CreatedDate>2006-06-13T01:29:09.047000-04:00</CreatedDate>
      <ModifiedDate>2006-07-29T23:53:03.323000-04:00</ModifiedDate>
      <PreferredFlag>Yes</PreferredFlag>
      <RecordStatus>Inactive</RecordStatus>
      <RecordStatusDate>2006-07-29T23:53:03.393000-04:00</RecordStatusDate>
    </ContactMechanism>
    <ContactMechanism>
      <ContactType>Email</ContactType>
      <ContactTypeOtherSpecify xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
      <ContactValue>[email protected]</ContactValue>
      <ContactAreaCode xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
      <ContactCountryCallingCode>0</ContactCountryCallingCode>
      <ContactTollFreeFlag xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
      <ContactGUID>ddd</ContactGUID>
      <ContactCreatedDate>2006-06-13T01:29:09.047000-04:00</ContactCreatedDate>
      <ContactLastModifiedDate>2006-06-13T01:29:09.047000-04:00</ContactLastModifiedDate>
      <ContactRecordStatus>Active</ContactRecordStatus>
      <ContactRecordStatusDate>2006-06-13T01:29:09.047000-04:00</ContactRecordStatusDate>
      <Role>Business</Role>
      <PhoneExtension xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
      <QCDoneStatus>Yes</QCDoneStatus>
      <QCDoneStatusDate>2006-06-13T01:29:09.063000-04:00</QCDoneStatusDate>
      <ActiveFromDate>2006-06-13T01:29:09.063000-04:00</ActiveFromDate>
      <GUID>111</GUID>
      <CreatedDate>2006-06-13T01:29:09.063000-04:00</CreatedDate>
      <ModifiedDate>2006-06-13T01:29:09.063000-04:00</ModifiedDate>
      <PreferredFlag>Yes</PreferredFlag>
      <RecordStatus>Active</RecordStatus>
      <RecordStatusDate>2006-06-13T01:29:09.063000-04:00</RecordStatusDate>
    </ContactMechanism>
    </ContactMechanisms></Association></Associations></Person>
    Elapsed: 00:00:00.42
    Execution Plan
    Plan hash value: 95656148
    | Id  | Operation                        | Name                           | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT                 |                                |     1 | 18040 |     9   (0)| 00:00:01 |
    |   1 |  SORT AGGREGATE                  |                                |     1 | 10096 |            |          |
    |   2 |   TABLE ACCESS BY INDEX ROWID    | SYS_NT32zHSpCZQ9ynComtqqKsrw== |     1 | 10096 |     2   (0)| 00:00:01 |
    |*  3 |    INDEX RANGE SCAN              | SYS_C009300                    |     1 |       |     2   (0)| 00:00:01 |
    |   4 |    SORT AGGREGATE                |                                |     1 | 48284 |            |          |
    |   5 |     TABLE ACCESS BY INDEX ROWID  | SYS_NTjbkXqKq3S96fbEOM3Qs5Gg== |     1 | 48284 |     2   (0)| 00:00:01 |
    |*  6 |      INDEX RANGE SCAN            | SYS_C009296                    |     1 |       |     2   (0)| 00:00:01 |
    |   7 |      SORT AGGREGATE              |                                |     1 | 28187 |            |          |
    |   8 |       TABLE ACCESS BY INDEX ROWID| SYS_NTm2nBfKKNSGm6hs2e1Z0w/A== |     1 | 28187 |     2   (0)| 00:00:01 |
    |*  9 |        INDEX RANGE SCAN          | SYS_C009297                    |     1 |       |     2   (0)| 00:00:01 |
    |  10 |  SORT AGGREGATE                  |                                |     1 | 13910 |            |          |
    |  11 |   NESTED LOOPS                   |                                |     1 | 13910 |     6   (0)| 00:00:01 |
    |  12 |    NESTED LOOPS                  |                                |     1 |  8131 |     5   (0)| 00:00:01 |
    |  13 |     NESTED LOOPS                 |                                |     1 |  4097 |     4   (0)| 00:00:01 |
    |* 14 |      TABLE ACCESS FULL           | SYS_NT7Erd/G5iSPWX9w20Z5cNRg== |     1 |    43 |     3   (0)| 00:00:01 |
    |* 15 |      TABLE ACCESS BY INDEX ROWID | SYS_NTQWY/m3uES5GM7AByRclr8A== |     1 |  4054 |     1   (0)| 00:00:01 |
    |* 16 |       INDEX UNIQUE SCAN          | SYS_C009310                    |     1 |       |     0   (0)| 00:00:01 |
    |* 17 |     TABLE ACCESS BY INDEX ROWID  | SYS_NTTiDHMvB7RbSEfNxho66yQg== |     1 |  4034 |     1   (0)| 00:00:01 |
    |* 18 |      INDEX UNIQUE SCAN           | SYS_C009314                    |     1 |       |     0   (0)| 00:00:01 |
    |  19 |    TABLE ACCESS BY INDEX ROWID   | ORG_PERSON_ASSOC               |     1 |  5779 |     1   (0)| 00:00:01 |
    |* 20 |     INDEX UNIQUE SCAN            | SYS_C009320                    |     1 |       |     0   (0)| 00:00:01 |
    |* 21 |  FILTER                          |                                |       |       |            |          |
    |  22 |   TABLE ACCESS FULL              | PERSON                         |     1 | 18040 |     3   (0)| 00:00:01 |
    |  23 |   NESTED LOOPS                   |                                |       |       |            |          |
    |  24 |    NESTED LOOPS                  |                                |     1 |  5893 |     6   (0)| 00:00:01 |
    |  25 |     NESTED LOOPS                 |                                |     1 |  2125 |     5   (0)| 00:00:01 |
    |  26 |      NESTED LOOPS                |                                |     1 |    93 |     4   (0)| 00:00:01 |
    |* 27 |       TABLE ACCESS FULL          | SYS_NT7Erd/G5iSPWX9w20Z5cNRg== |     1 |    43 |     3   (0)| 00:00:01 |
    |* 28 |       TABLE ACCESS BY INDEX ROWID| SYS_NTQWY/m3uES5GM7AByRclr8A== |     1 |    50 |     1   (0)| 00:00:01 |
    |* 29 |        INDEX UNIQUE SCAN         | SYS_C009310                    |     1 |       |     0   (0)| 00:00:01 |
    |* 30 |      TABLE ACCESS BY INDEX ROWID | SYS_NTTiDHMvB7RbSEfNxho66yQg== |     1 |  2032 |     1   (0)| 00:00:01 |
    |* 31 |       INDEX UNIQUE SCAN          | SYS_C009314                    |     1 |       |     0   (0)| 00:00:01 |
    |* 32 |     INDEX UNIQUE SCAN            | SYS_C009320                    |     1 |       |     0   (0)| 00:00:01 |
    |  33 |    TABLE ACCESS BY INDEX ROWID   | ORG_PERSON_ASSOC               |     1 |  3768 |     1   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       3 - access("NESTED_TABLE_ID"=:B1)
       6 - access("NESTED_TABLE_ID"=:B1)
       9 - access("NESTED_TABLE_ID"=:B1)
      14 - filter("SYS_NC_TYPEID$" IS NOT NULL AND "PersonID"=:B1)
      15 - filter("SYS_NC_TYPEID$" IS NOT NULL)
      16 - access("NESTED_TABLE_ID"="SYS_ALIAS_1"."SYS_NC0002700028$")
      17 - filter("SYS_NC_TYPEID$" IS NOT NULL)
      18 - access("NESTED_TABLE_ID"="SYS_ALIAS_0"."SYS_NC0003700038$")
      20 - access("NESTED_TABLE_ID"="OA"."SYS_NC0002100022$")
      21 - filter( EXISTS (SELECT 0 FROM "XDBTEST"."SYS_NT7Erd/G5iSPWX9w20Z5cNRg=="
                  "SYS_ALIAS_1","XDBTEST"."SYS_NTQWY/m3uES5GM7AByRclr8A=="
                  "SYS_ALIAS_3","XDBTEST"."SYS_NTTiDHMvB7RbSEfNxho66yQg==" "SYS_ALIAS_0","XDBTEST"."ORG_PERSON_ASSOC" "OA"
                  WHERE "SYS_ALIAS_0"."NESTED_TABLE_ID"="OA"."SYS_NC0002100022$" AND
                  "SYS_ALIAS_1"."NESTED_TABLE_ID"="SYS_ALIAS_0"."SYS_NC0003700038$" AND "SYS_ALIAS_0"."SYS_NC_TYPEID$" IS
                  NOT NULL AND TO_NUMBER("SYS_ALIAS_0"."OrganizationID")=30097 AND
                  "SYS_ALIAS_4"."NESTED_TABLE_ID"="SYS_ALIAS_1"."SYS_NC0002700028$" AND "SYS_ALIAS_1"."SYS_NC_TYPEID$" IS
                  NOT NULL AND "SYS_ALIAS_4"."SYS_NC_TYPEID$" IS NOT NULL AND "SYS_ALIAS_4"."PersonID"=:B1))
      27 - filter("SYS_ALIAS_4"."SYS_NC_TYPEID$" IS NOT NULL AND "SYS_ALIAS_4"."PersonID"=:B1)
      28 - filter("SYS_ALIAS_1"."SYS_NC_TYPEID$" IS NOT NULL)
      29 - access("SYS_ALIAS_4"."NESTED_TABLE_ID"="SYS_ALIAS_1"."SYS_NC0002700028$")
      30 - filter("SYS_ALIAS_0"."SYS_NC_TYPEID$" IS NOT NULL AND
                  TO_NUMBER("SYS_ALIAS_0"."OrganizationID")=30097)
      31 - access("SYS_ALIAS_1"."NESTED_TABLE_ID"="SYS_ALIAS_0"."SYS_NC0003700038$")
      32 - access("SYS_ALIAS_0"."NESTED_TABLE_ID"="OA"."SYS_NC0002100022$")
    Note
       - dynamic sampling used for this statement
    SQL> select extract(person,'/Person/Associations/Association')
      2    from xml_person_association o
      3   where existsnode(person,'/Person/Associations/Association[OrganizationID=30097]')=1
      4  /
    <Association><Name>Org Name Office</Name><OrganizationID>30097</OrganizationID><OrganizationType>Agency</OrganizationType><Role>Employee</Role><Record
    Status>Active</RecordStatus><ImportedDate>2007-04-30</ImportedDate><PersonTypes><PersonType><Type>Resource Personnel</Type><GUID>3049ddcd-3590-4fd9-a5
    34-e2cea5b82c09</GUID><RecordStatus>Active</RecordStatus><RecordStatusDate>2006-06-13T00:57:22.977000-04:00</RecordStatusDate><CreatedDate>2006-06-13T
    00:

  • Select Query where multiple column in multiple values (cant use in clause)

    I can use (in clause) with on column like this:
    Select code from table where code in(1,2,3)
    -------------------------------My case:-------------------------------------------------
    I’ve 4 columns PK of table as below 
    I need to :
    select
    where (code, month, year) in ((1,1,2013) and (2,1,2014) and (2,2,2015))
    i can't write it this way :
    select where code in (1,2) and month in (1,2) and year in (2013,2014,2015)
    case i'll get my rows but others included like (1,1,2015) , (1,1,2014),(2,1,2013) .. etc
    I’m terribly want to solve this problem
    Please help me
    Code (pk)
    Month (pk)
    Year (pk)
    emp_code(pk)
    1
    1
    2013
    101
    1
    1
    2013
    102
    2
    1
    2013
    101
    2
    1
    2013
    102
    1
    2
    2013
    101
    1
    2
    2013
    102
    2
    2
    2013
    101
    2
    2
    2013
    102
    1
    1
    2014
    101
    1
    1
    2014
    102
    2
    1
    2014
    101
    2
    1
    2014
    102
    1
    2
    2014
    101
    1
    2
    2014
    102
    2
    2
    2014
    101
    2
    2
    2014
    102
    1
    1
    2015
    101
    1
    1
    2015
    102
    2
    1
    2015
    101
    2
    1
    2015
    102
    1
    2
    2015
    101
    1
    2
    2015
    102
    2
    2
    2015
    101
    2
    2
    2015
    102
    thank you

    In T-SQL you have to use OR-ed predicates. 
    In full ANSI Standard SQL youcan write row comparisons  (a,b,c) = (1,2,3) etc! but not in T-SQL dialect. Ignoring that problem, what you have is a design flaw called attribute splitting; you have put one unit of measurement
    in two columns. 
     I like the MySQL convention of using double zeroes for months and years, That is 'yyyy-mm-00' for a month within a year and 'yyyy-00-00' for the whole year. The advantages are that it will sort with the
    ISO-8601 data format required by Standard SQL and it is language independent. The pattern for validation is '[12][0-9][0-9][0-9]-00-00' and '[12][0-9][0-9][0-9]-[01][0-9]-00'
    --CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
    in Sets / Trees and Hierarchies in SQL

  • 'Missing select' error for update statement using WITH clause

    Hi,
    I am getting the below error for update statement using WITH clause
    SQL Error: ORA-00928: missing SELECT keyword
      UPDATE A
      set A.col1 = 'val1'
         where
      A.col2 IN (
      WITH D AS
      SELECT col2 FROM
      (SELECT col2, MIN(datecol) col3 FROM DS
      WHERE <conditions>
        GROUP BY PATIENT) D2
      WHERE
      <conditions on A.col4 and D2.col3>

    Hi,
    The format of a query using WITH is:
    WITH  d  AS
        SELECT  ...  -- sub_query
    SELECT  ...   -- main query
    You don't have a main query.  The keyword FROM has to come immediately after the right ')' that ends the last WITH clause sub-query.
    That explains the problem based on what you posted.  I can't tell if the real problem is in the conditions that you didn't post.
    I hope this answers your question.
    If not, post a complete test script that people can run to re-create the problem and test their ideas.  Include a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all the tables involved, and the results you want from that data.
    In the case of a DML operation (such as UPDATE) the sample data should show what the tables are like before the DML, and the results will be the contents of the changed table(s) after the DML.
    Explain, using specific examples, how you get those results from that data.
    Always say what version of Oracle you're using (e.g. 11.2.0.2.0).
    See the forum FAQ: https://forums.oracle.com/message/9362002

  • Problem using LIKE function

    Hi Guyz,
    I am having small problem using LIKE function . The problem is I am using LIKE function in the WHERE clause
    to compare a column to a particular value, which gets this value from the front end. If the user has a single quote in the string he entered then the LIKE function is not working because of the single quote. Is there any way I can escape the single quote like we escape '%' and '_'.
    Thankyou.

    Mod_plsql supports bind variables, as do almost all front-end tools that deal with Oracle (and most other databases). I do not code mod pl/sql myself, but others here do, and I see bind variables in their code all the time (if I don't, they hear from me :-)).
    If you pass a bind variable, the quote problem goes away. As far as I know (which is not very far), you should be able to take the string with the quote directly from your input field, bind it to the variable in your query and have no problems.
    I suspect that the reson you are having issues is that you are just gluing strings together to create a sql statement. this is the wrong approach.
    The java term for what you are looking for is prepared statement, I'm not sure what the equivalent is i mod plsql, but that should give you a start.
    John

  • Problem using  auto-complete SQL Developer

    Hi everyone ...
    I'm having a problem using the SQL Developer 3.2.20.09 87 ... when I try to use auto-complete in a 'SELECT' clause at a specific table (EX: clients.cod_client), if I have more tables in my 'FROM' clause, the program shows all columns from all tables. Even if I have specified the table I want to show the columns (like the exemple: clients.<columns>) ...
    I've tryed to change the properties at preferences->insight ... but there's no option to change it there.
    So, if anyone have faced this problem and solved, please help me ;)

    Hi,
    There is a specific forum for this kind of question which are not related to PL/SQL: {forum:id=260}
    Please mark this question as answered and post your question there.
    Regards.
    Al

  • How to use From clause as a block datasources

    Hi,
    I want to know how to use from clause as a block datasource.
    Could anyone give me an example to do that? I couldn't find it
    in the help file.
    I sincerely ask someone help me.
    Many thanks
    Diana

    Diana,
    I presume you are getting a "FRM-40505: error unable to perform
    query" when you try to execute query. I suggest you select the
    "Display Error" item from the "Help" menu to see the query that
    Oracle is generating. If the query that Oracle generates as a
    result of your "Query data source name" is not formed correctly,
    you will get the FRM-40505 error.
    Copy and paste the query that is displayed into SQLPLUS and test
    to see what happens when you try to execute the query from
    SQLPLUS. That will give you a better idea of what the cause of
    the problem is.
    From your example, a query that works should look like "select
    c_no from (select c_no from books)".
    Keep in mind that for blocks based on FROM clause, the query that
    produces the data is of the form :
    SELECT <all columns in the block>
    FROM <select statement entered in the "Query Data Source Name"
    blockproperty>
    The data source for the block is the select statement embedded in
    the from clause.
    Hope this helps.

  • Problem using OMB*Plus

    Hello,
    I'm getting this error when trying to connect to design repository via OMB*Plus:
    "OMB01118: Could not connect to repository! PRS-00306: Internal Error: Could not undo reservation for client .
    Please contact Oracle Support with the stack trace and details on how to reproduce it."
    Here's the interesting part:\
    1) I CAN connect to the same repos. from OWB client AND
    2) I can connect to this repository from a different box using OMB*PLus.
    Further, OMB*PLus itself on the box in question is not screwed up, as I can connect to repos. on other boxes!
    What could the problem be?
    Thanks in advance,
    Alex.

    I went further with investigating my scripting problem:
    OMBCONNECT OWBRT92USER/[email protected]:1521:EDW USE REPOSITORY 'OWBRT92' USE MULTIPLE_USER_MODE
    OMB01118: Could not connect to repository! Database connection error!
    So I tried to alter pieces of my connect statement:
    OMBCONNECT OWBRT92USER/[email protected]:1521:wrong USE REPOSITORY 'OWBRT92' USE MULTIPLE_USER_MODE
    API0420: Error message: Io exception: Connection refused(DESCRIPTION=(TMP=)(VSNN
    UM=153092608)(ERR=12514)(ERROR_STACK=(ERROR=(CODE=12514)(EMFI=4))))
    API0424: Please check if the the Oracle Service Name is correct.
    Obviously, connect string to database is OK !
    OMBCONNECT OWBRT92USER/[email protected]:1521:EDW USE REPOSITORY 'OWBRT92' USE MULTIPLE_USER_MODE
    API0420: Error message: ORA-01017: invalid username/password; logon denied
    And obviously, repository user is well identified !
    Since I tried using either 'SINGLE_USER_MODE', 'MULTIPLE_USER_MODE' and nothing and it brings the very laconic same OMB01118 message, I guess it has to deal with "use repository clause
    I tried to alter it to see what happens:
    OMBCONNECT OWBRT92USER/[email protected]:1521:EDW USE REPOSITORY 'WRONG' USE MULTIPLE_USER_MODE
    ...but it brings the very same OMB01118 message.
    Now I tried to connect to development repository:
    OMBCONNECT OWBDEV92/[email protected]:1521:EDW USE REPOSITORY 'OWBDEV92' USE MULTIPLE_USER_MODE
    Connected.
    Well, cool, 'means I can connect to devt. repository but I want to deploy to runtime and if I usE:
    OMBDEPLOY SPECIFICATION FROM C:\TEMP\deploytest.xml
    it yields:
    OMB05608: Connection to Runtime Platform has not been made.
    Well, what can I do ?
    Documentation B12187_02_Warehouse Builder Scripting Reference.pdf (chap. 2-12, page 48) mentions a OMBCONNECT_RUNTIME command that does not exist and the example is a strict copy of OMBCONNECT (even the example does not use OMBCONNECT_RUNTIME)
    OMB+> OWMBCONNECT_RUNTIME
    invalid command name "OWMBCONNECT_RUNTIME"
    I'm really stuck.
    Does anyone else connect to a runtime repository to deploy from a xml file ?
    Thanks

  • Problem with IN clause substitution in Sybase

    I am experiencing a problem with IN clause substitution in
    embedded SQL with a Sybase databse.
    My Cold Fusion server is MX 7.
    The Database is Adaptive Server Enterprise/12.5.0.3/EBF 10689
    IR/P/Sun_svr4/OS 5.8/rel12503/1915/64-bit/FBO/Thu Jan 23 16:05:19
    2003
    Here's the problem. I have a Cold Fusion variable
    bureau_incode which I am using to define the values in my IN
    clause. When I comment out my query and display this value to the
    HTML page, bureau_incode has the following value:
    ('OET','OGC','OIG','OLA','OMD','OMR','OSP','OTHER','OWD','PSHSB','WCB','WTB')
    My embedded SQL CFQUERY looks like this:
    quote:
    <cfquery name="qResults" datasource="#request.dsn#">
    Select Name,
    bureau_code,
    Telephone,
    CellPhone,
    Pager,
    Email,
    Availability,
    Explanation,
    Password,
    Admin,
    last_login = convert(varchar(20),last_login,0)
    from PAMS where Availability = 'N'
    <cfif #request.seltype# IS NOT "ALL">
    and bureau_code IN #bureau_incode#
    </cfif>
    </cfquery>
    When the code runs, I get the error
    Error Executing Database Query. Incorrect syntax near 'OET'.
    There is no incorrect syntax. Is there any special way to
    submit the IN clause to ColdFusion MX 7? Previously, we were using
    ColdFusion 4.5 (I believe) server, and the code worked perfectly,
    albiet with double-quotes in the replacement string. Any help would
    be appreciated. This type of substitution worked nicely in the
    previous server version, I can't imagine why it would no longer
    work.

    No, I am not. The parentheses are part of the #bureau_incode#
    coldfusion variable. I've edited the first message to make this
    more clear. I have tried the query with the parentheses in the
    #bureau_incode# variable, and with the parentheses in the CFquery
    with (#bureau_incode#). The results are always the same.
    I will indeed try to help with other stuff in the future. :)
    Thanks for trying to help!

  • Avoiding null and duplicate values using model clause

    Hi,
    I am trying to use model clause to get comma seperated list of data : following is the scenario:
    testuser>select * from test1;
    ID VALUE
    1 Value1
    2 Value2
    3 Value3
    4 Value4
    5 Value4
    6
    7 value5
    8
    8 rows selected.
    the query I have is:
    testuser>with src as (
    2 select distinct id,value
    3 from test1
    4 ),
    5 t as (
    6 select distinct substr(value,2) value
    7 from src
    8 model
    9 ignore nav
    10 dimension by (id)
    11 measures (cast(value as varchar2(100)) value)
    12 rules
    13 (
    14 value[any] order by id =
    15 value[cv()-1] || ',' || value[cv()]
    16 )
    17 )
    18 select max(value) oneline
    19 from t;
    ONELINE
    Value1,Value2,Value3,Value4,Value4,,value5,
    what I find is that this query has duplicate value and null (',,') coming in as data has null and duplicate value. Is there a way i can avoid the null and the duplicate values in the query output?
    thanks,
    Edited by: orausern on Feb 19, 2010 5:05 AM

    Hi,
    Try this code.
    with
    t as ( select substr(value,2)value,ind
            from test1
            model
            ignore nav
            dimension by (id)
            measures (cast(value as varchar2(100)) value, 0 ind)
            rules
            ( ind[any]=  instr(value[cv()-1],value[cv()]),
            value[any] order by id = value[cv()-1] || CASE WHEN value[cv()] IS NOT NULL
                                               and ind[cv()]=0     THEN ',' || value[cv()] END      
    select max(value) oneline
    from t;
    SQL> select * from test1;
            ID VALUE
             1 Value1
             2 Value2
             3 Value3
             4 Value4
             5 Value4
             6
             7 value5
             8
    8 ligne(s) sélectionnée(s).
    SQL> with
      2   t as ( select substr(value,2)value,ind
      3          from test1
      4          model
      5          ignore nav
      6          dimension by (id)
      7          measures (cast(value as varchar2(100)) value, 0 ind)
      8          rules
      9          ( ind[any]=  instr(value[cv()-1],value[cv()]),
    10          value[any] order by id = value[cv()-1] || CASE WHEN value[cv()] IS NOT NULL
    11                                             and ind[cv()]=0     THEN ',' || value[cv()] END 
    12          )
    13        )
    14   select max(value) oneline
    15   from t;
    ONELINE
    Value1,Value2,Value3,Value4,value5
    SQL>

  • Problem using File sharing  in a small office network

    I have a problem using File sharing on an Imac and Macbook Pro.
    My office has a small network running Windows Small office file server 2003. I have one Windows 2000 PC connected to it and 3 Macs, an 2.4 gHz Intel iMac running Leopard 10.5.6 , a MBP running the same and a Mac Mini running 10.5.
    From the Finder Shared window of the Mac Mini, I can see all the computers on the network. It also used to be the case for the iMac, but the MBP could never see the Windows PC’s, not the server or the Win2000. This wasn’t a big problem as I was communicating between the Macs and using the shared printer on the iMac.
    On Monday Jan 19 the iMac was suddenly unavailable to the other 2 Macs. It was working normally on the Friday. The iMac can access the Mac Mini and copy files to it. The Mac Mini can see the iMac but cannot access it. Even trying to connect as, ends in a failed connection. I have tried rebooting, turning File sharing off and then on again to no avail.
    The iMac now also cannot see the Windows PC’s which it previously could.
    To get files from the MBP for printing, I now copy it to the Mac Mini and acces the folder from the iMac, a very tedious procedure. I don’t know why this happened and am scared that the Mac Mini is going to do the same thing.
    All three computers are also running VMware 2.0 with Windows XP pro, and from VMware the server is visible on all the computers.
    Any help will be much appreciated, I live in a small town in South Africa and the local computer suppliers have no knowledge of the Macs.
    I think that the problem with the iMac may have started after a software upgrade to 10.5.6 but I am not entirely sure.
    Thank you
    ajdk

    Well, you're current method sounds pretty good. But if you want to user a file server, hey go ahead.
    What you want to do when you centralize project files is to keep track of which one is the newest and becareful not to overwrite files with the same name. So you either have to set up individual spaces on the server (separate AFP/FTP folders maybe), or you'll need to run a file checkout service.
    The individual space is cheaper, but it's not much of a difference from backing up to the network drive. Since you have Gigabit connections, you might even opt to save ALL the user files on the server instead of just the project files.
    If you want to run a file checkout service, there's two approaches. You can run a service that can host any kind of file, or you can run a version control system for each kind of application (Photoshop, Word, etc.). Please notice, that as you read further and further along, the methods become more and more expensive and complicated. Once you get to this point, it will be necessary to purchase or build software in addition to the Mac OS X Server package.

  • Can we use where clause in Update on Merge statement?

    Hi All,
    I tried to execute the following Merge Query:
    When this query is executed without ‘Where clause’ in Update statement its working fine. When executed with ‘Where clause’ it throwing the following error:
    ORA-00905: missing keyword.
    Following is the sample query which I tried to execute:
    MERGE INTO TABLE_NAME
    USING (SELECT COLUMN FORM TABLES)
    ON (CONDITION)
    WHEN MATCHED THEN
    UPDATE SET
         COLUMN UPATES
    WHERE CONDITION -- Can we use where clause here?
    WHEN NOT MATCHED THEN
    INSERT
    INSERT VALUES;
    Can some one help on this?
    Thanks in advance.
    Darius

    Yes:
    SQL> drop table emp1;
    Table dropped.
    SQL> create table emp1 as select * from emp where deptno = 30;
    Table created.
    SQL> update emp1 set sal = sal*2;
    6 rows updated.
    SQL> commit;
    Commit complete.
    SQL> select ename,sal from emp1;
    ENAME             SAL
    ALLEN            3200
    WARD             2500
    MARTIN           2500
    BLAKE            5700
    TURNER           3000
    JAMES            1900
    6 rows selected.
    SQL> MERGE INTO emp1
      2  USING(select * from emp) emp
      3  ON (emp1.empno = emp.empno)
      4  WHEN MATCHED THEN
      5  UPDATE SET sal = emp.sal WHERE ename = 'TURNER'
      6  WHEN NOT MATCHED THEN
      7  INSERT(ename,sal) VALUES(emp.ename,emp.sal);
    9 rows merged.
    SQL> select ename,sal from emp1;
    ENAME             SAL
    ALLEN            3200
    WARD             2500
    MARTIN           2500
    BLAKE            5700
    TURNER 1500
    JAMES            1900
    SMITH             800
    JONES            2975
    CLARK            2450
    SCOTT            3000
    KING             5000
    ENAME             SAL
    ADAMS            1100
    FORD             3000
    MILLER           1300
    14 rows selected.
    SQL> SY.

  • Huge problem using apple mail while sending email to a group...

    Hey - I am quite confused... apple mail has huge problems using groups with about 150 addresses when writing and sending an email... the writing of emails is nearly impossible. Once the group name is inserted in the addressline (address book in iCloud!), apple mail uses nearly 100% CPU and further writing is nearly impossible. When sending such an email, all addresses are suddenly visible - though the box is NOT checked and the addresses should be hidden... what can I do? I use this feature (sending mails to groups) on a daily basis and cannot accept visible addresses...
    Greetings and sorry for inconvenient english...
    Christof

    How about next time you send to the group, cc yourself, or include yourself in the group. Then receive the email on the iphone, you can "reply all" in order to send to the group. If you use an imap account, you can make a new folder, call it something like "groups", and save different group emails there for the next time you need to "reply all".

Maybe you are looking for

  • Nokia 206 does not turn on after update

    Hi Just got a Nokia 206 Updated the software. Itupdated and restarted fine Then I checked for updates again, and it updated a second time Everything went fine, and the phone restarted. It said "Update Successful" or something like that I remember tha

  • How to compile and execute lex,yac,c and java programs

    its the 3rd day on my New MacBook pro.. as i just migrated from windows to mac i love to work on this.. The main problem  is i DON't know ....... how to compile and execute 1) lex and yac programs 2) c program 3) java program so please help me THIS i

  • FND tables design

    Hi, I was going through FND Design Data section on eTRM website . I need to understand a few things about table design here. I was surprised to see one composite primary key and one composite unique key instead of primary keys in single columns(concu

  • BI Content Remote Activation of Datasource - Transports

    During the process of installing BI content in the Dev BW Environment, I am promted to login to the source system (CRM DEV in this case) so that the BI content datasources can be activated and replicated remotely. This process works fine. The questio

  • "Mandatory condition VA00 is missing"  in standard order.

    Hi Apologies but I could not find the right answer in foroum so I am posting this .. I have a problem while creating va01 the error in condition tab in items says "Mandatory condition VA00 is missing" and upon analysis it says:VA00 111 Condition igno