ORA-19007 - Schema does not match

On my database, we have two schemas with matching tables in each - one for active data and one for data that is being held for longer-term research. Both contain an XMLType column registered to the same schema. However, when I try to insert directly from the active into the archive, I get the following:
SQL> insert into eci_archv_schema.rev_item_earn_dtl_archv
2 select * from eci_schema.rev_item_earn_dtl
3 where ROWNUM = 1;
insert into eci_archv_schema.rev_item_earn_dtl_archv
ERROR at line 1:
ORA-19007: Schema http://xmlns.foo.com/1.3.1/ABC.xsd does not match expected http://xmlns.foo.com/1.3.1/ABC.xsd.
The only way in which I can successfully move the data from one to the other is to wrap the select in one of the following:
1. XMLType.createXML(my_xml_column.getCLOBVal())
2. XMLType.createNonSchemaBasedXML(my_xml_column)
Both of these take an exceptionally long amount of time to complete and cause my archiving process to be very, very slow. It would appear that because the schemas were registered under different database schemas, they are somehow seen as incompatible. Is this the case or do they actually not match in some other way? Is there an easy way to compare them?
FYI: We are running 11.2.0.3 but this also occurs on 11.2.0.2. Any help would be appreciated.

It would appear that because the schemas were registered under different database schemas, they are somehow seen as incompatible. Possibly.
Is this the case or do they actually not match in some other way? Is there an easy way to compare them?Are both XML schemas identical?
If so, why not register only one globally and give access to both DB schemas?
Does XML instances have xsi:schemaLocation or xsi:noNamespaceSchemaLocation attributes?
Are they the same?
A test case would be welcome actually.
Edited by: odie_63 on 3 oct. 2012 18:50

Similar Messages

  • ORA-19007: Schema - does not match expected T0090.xsd for non xsd owner

    I have registered an xsd in /home/divload/xsd/T0090.xsd. User "prmt" is the owner of this resource. User prmt can schemavalidate xml against this xsd just as it is now. However, I have package code in "prmt_app" user account that will actually do the schemavalidate - not prmt user. When I run the exact same code using the exact same xml with the T0090.xsd above I am getting ORA-19007: Schema - does not match expected T0090.xsd. prmt_app has "all" privs on "/home", "/home/divload", "/home/divload/xsd", and "/home/divload/xsd/T0090.xsd". What am I missing?
    XSD header info
    <?xml version="1.0" encoding="utf-8"?>
    <xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xdb="http://xmlns.oracle.com/xdb">
         <xs:element name="T0090" xdb:defaultTable="T0090">
    ...XML header info
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <T0090 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="T0090.xsd">
    <PERMIT>
    ...The error occurs when I am inserting into this table off disk..
    create table prmt.cview_xml (filename varchar2(256), xmldoc xmltype) xmltype xmldoc xmlschema "T0090.xsd" element "T0090";
    Edited by: Mark Reichman on Jun 28, 2010 2:42 PM

    I did all that before posting the orignial post..
    declare
      v_schema_exists varchar2(1) := 'N';
      res             boolean;
      schemaURL       varchar2(100) := 'T0090.xsd';
      schemaPath      varchar2(100) :=  '/prmt/xsd/T0090.xsd'; --'/public/T0090.xsd';
      xmlSchema xmlType := XMLTYPE(bfilename('DIR_PRMT_OUT_CVIEW','T0090.xsd'),NLS_CHARSET_ID('AL32UTF8'));
    begin
      begin
        select 'Y'
          into v_schema_exists
          from sys.all_xml_schemas  -- changed from user_xml_schemas
         where schema_url = schemaURL;
        dbms_xmlSchema.deleteSchema(schemaURL,4);
        exception
          when NO_DATA_FOUND then
            null;
      end;
      if (dbms_xdb.existsResource(schemaPath)) then
        dbms_xdb.deleteResource(schemaPath);
      end if;
      res := dbms_xdb.createResource(schemaPath,xmlSchema);   
      dbms_xmlschema.registerSchema ( schemaURL, xdbURIType(schemaPath).getClob(), TRUE, TRUE, FALSE, TRUE );
    end;
    / I guess my understanding was that I could grant another oracle user access to my registered schema just like I can grant a single user access to a table. Evidently I only have two options. Only the schema owner can use the schema or everyone can use the schema and I cannot grant access to a single user other than myself.
    Edited by: Mark Reichman on Jul 2, 2010 9:08 AM
    Edited by: Mark Reichman on Jul 2, 2010 9:09 AM

  • Why my XML is not loading ?? (ORA-19007: Schema - does not match expected )

    Hi,
    I want to load a XML document in structured XMLType. You can run my code on your database if you have a directory object called LOG_DIR. I am on Oracle 10.1 .
    The schema is a simple example which describe a database table(like it will have 1 or more columns and 0 or more indexes). My schema looks like,
    <xs:schema elementFormDefault="qualified" attributeFormDefault="unqualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:element name="Tables" type="Table">
    <xs:annotation>
    <xs:documentation>Table defination</xs:documentation>
    </xs:annotation>
    </xs:element>
    <xs:element name="table_name" type="xs:string"/>
    <xs:complexType name="Table">
    <xs:sequence>
    <xs:element name="Column" type="Column" minOccurs="1"/>
    <xs:element name="Index" type="Index" minOccurs="0"/>
    </xs:sequence>
    </xs:complexType>
    <xs:complexType name="Column">
    <xs:annotation>
    <xs:documentation>Column of the table</xs:documentation>
    </xs:annotation>
    <xs:sequence>
    <xs:element name="Name" type="xs:string" minOccurs="1"/>
    <xs:element name="Type" type="xs:string" minOccurs="1"/>
    <xs:element name="Capacity" type="xs:decimal" minOccurs="1"/>
    </xs:sequence>
    </xs:complexType>
    <xs:complexType name="Index">
    <xs:annotation>
    <xs:documentation>Index on the table</xs:documentation>
    </xs:annotation>
    <xs:sequence>
    <xs:element name="Name" type="xs:string" minOccurs="1"/>
    <xs:element name="Type" type="xs:string" minOccurs="0"/>
    </xs:sequence>
    </xs:complexType>
    </xs:schema>
    I registered the schema,
    BEGIN
    DBMS_XMLSCHEMA.registerSchema(
    SCHEMAURL => 'tables.xsd',
    SCHEMADOC => bfilename('LOG_DIR','tables.xsd'),
    CSID => nls_charset_id('AL32UTF8')
    END;
    This was successfull, also the following create table was ok,
    CREATE TABLE TMP_XML_TABLES
    file_name VARCHAR2(2000),
    load_date DATE,
    xml_document XMLType
    XMLType COLUMN xml_document
    XMLSchema "http://xmlns.oracle.com/xdb/schemas/TDB/tables.xsd"
    ELEMENT "Tables";
    Now I have a XML document,
    <Tables xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://xmlns.oracle.com/xdb/schemas/TDB/tables.xsd">
    <table_name>trades</table_name>
    <Column><Name>trade_id</Name><Type>varchar2</Type><Capacity>50</Capacity></Column>
    <Column><Name>source</Name><Type>varchar2</Type><Capacity>100</Capacity></Column>
    <Column><Name>trade_date</Name><Type>date</Type></Column>
    <Column><Name>trader</Name><Type>varchar2</Type><Capacity>200</Capacity></Column>
    <Index><Name>trades_pk</Name><Type>btree</Type></Index>
    <Index><Name>trades_idx1</Name><Type>bitmap</Type></Index>
    </Tables>
    When I am trying to load this, I get the error,
    SQL> INSERT INTO TMP_XML_TABLES
    2 VALUES
    3 ('tables1.xml',
    4 sysdate,
    5 XMLType
    6 (
    7 bfilename('LOG_DIR','tables1.xml'),
    8 nls_charset_id('AL32UTF8')
    9 )
    10 );
    INSERT INTO TMP_XML_TABLES
    ERROR at line 1:
    ORA-19007: Schema - does not match expected tables.xsd.
    Can somebody please explain the cause ???
    Thanks and Regards

    A quick search of the forum for ORA-19007 should have allowed you to find the answer to your problem. Since you XML Schema does not declare a target namespace you need to use the xsi:noNamespaceSchemaLocation tag rather than the schemaLocation tag..
    Also please do not use URLs starting http://xmlns.oracle.com for your schemaLocation hint. If you do no own your own domain I'd suggest example.org...
    Finally please make sure that your XML Instance is valid per your XML Schema before posting. You can do this using tools like JDeveloper or XMLSpy. What should have been a 5 min repsonse took me over 20 mins to work through due to the errors in the XML Schema...
    Anyway here's a working example for you
    SQL>
    SQL>
    SQL> var schemaURL varchar2(256)
    SQL> var schemaPath varchar2(256)
    SQL> --
    SQL> begin
      2    :schemaURL := 'http://xmlns.examples.org/xdb/schemas/TDB/tables.xsd';
      3    :schemaPath := '/public/testcase.xsd';
      4  end;
      5  /
    PL/SQL procedure successfully completed.
    SQL> DROP TABLE TMP_XML_TABLES
      2  /
    Table dropped.
    SQL> call dbms_xmlSchema.deleteSchema(:schemaURL,4)
      2  /
    Call completed.
    SQL> declare
      2    res boolean;
      3    xmlSchema xmlType := xmlType(
      4  '<xs:schema elementFormDefault="qualified" attributeFormDefault="unqualified" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xdb="
    tp://xmlns.oracle.com/xdb">
      5     <xs:element name="Tables" xdb:defaultTable="TABLES_TABLE">
      6     <xs:annotation>
      7                     <xs:documentation>Table defination</xs:documentation>
      8             </xs:annotation>
      9             <xs:complexType>
    10                     <xs:complexContent>
    11                             <xs:extension base="Table"/>
    12                     </xs:complexContent>
    13             </xs:complexType>
    14     </xs:element>
    15     <xs:complexType name="Table">
    16             <xs:sequence>
    17                     <xs:element name="table_name" type="xs:string"/>
    18                     <xs:element name="Column" type="Column" maxOccurs="unbounded"/>
    19                     <xs:element name="Index" type="Index" minOccurs="0" maxOccurs="unbounded"/>
    20             </xs:sequence>
    21     </xs:complexType>
    22     <xs:complexType name="Column">
    23             <xs:annotation>
    24                     <xs:documentation>Column of the table</xs:documentation>
    25             </xs:annotation>
    26             <xs:sequence>
    27                     <xs:element name="Name" type="xs:string"/>
    28                     <xs:element name="Type" type="xs:string"/>
    29                     <xs:element name="Capacity" type="xs:decimal"/>
    30             </xs:sequence>
    31     </xs:complexType>
    32     <xs:complexType name="Index">
    33             <xs:annotation>
    34                     <xs:documentation>Index on the table</xs:documentation>
    35             </xs:annotation>
    36             <xs:sequence>
    37                     <xs:element name="Name" type="xs:string"/>
    38                     <xs:element name="Type" type="xs:string" minOccurs="0"/>
    39             </xs:sequence>
    40     </xs:complexType>
    41  </xs:schema>
    42  ');
    43  begin
    44    if (dbms_xdb.existsResource(:schemaPath)) then
    45      dbms_xdb.deleteResource(:schemaPath);
    46    end if;
    47    res := dbms_xdb.createResource(:schemaPath,xmlSchema);
    48  end;
    49  /
    PL/SQL procedure successfully completed.
    SQL> begin
      2    dbms_xmlschema.registerSchema
      3    (
      4      :schemaURL,
      5      xdbURIType(:schemaPath).getClob(),
      6      TRUE,TRUE,FALSE,TRUE
      7    );
      8  end;
      9  /
    PL/SQL procedure successfully completed.
    SQL> CREATE TABLE TMP_XML_TABLES
      2  (
      3  file_name VARCHAR2(2000),
      4  load_date DATE,
      5  xml_document XMLType
      6  )
      7  XMLType COLUMN xml_document
      8  XMLSchema "http://xmlns.examples.org/xdb/schemas/TDB/tables.xsd"
      9  ELEMENT "Tables"
    10  /
    Table created.
    SQL> insert into TMP_XML_TABLES values ('testcase1.xml',sysdate,xmltype(
      2  '<Tables xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://xmlns.examples.org/xdb/schemas/T
    /tables.xsd">
      3     <table_name>trades</table_name>
      4     <Column>
      5             <Name>trade_id</Name>
      6             <Type>varchar2</Type>
      7             <Capacity>50</Capacity>
      8     </Column>
      9     <Column>
    10             <Name>source</Name>
    11             <Type>varchar2</Type>
    12             <Capacity>100</Capacity>
    13     </Column>
    14     <Column>
    15             <Name>trade_date</Name>
    16             <Type>date</Type>
    17     </Column>
    18     <Column>
    19             <Name>trader</Name>
    20             <Type>varchar2</Type>
    21             <Capacity>200</Capacity>
    22     </Column>
    23     <Index>
    24             <Name>trades_pk</Name>
    25             <Type>btree</Type>
    26     </Index>
    27     <Index>
    28             <Name>trades_idx1</Name>
    29             <Type>bitmap</Type>
    30     </Index>
    31  </Tables>'))
    32  /
    1 row created.
    SQL> set long 10000 pages 0 lines 160
    SQL> /
    1 row created.
    SQL> select * from TMP_XML_TABLES
      2  /
    testcase1.xml
    21-APR-06
    <Tables xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://xmlns.examples.org/xdb/schemas/TDB/tab
    s.xsd">
      <table_name>trades</table_name>
      <Column>
        <Name>trade_id</Name>
        <Type>varchar2</Type>
        <Capacity>50</Capacity>
      </Column>
      <Column>
        <Name>source</Name>
        <Type>varchar2</Type>
        <Capacity>100</Capacity>
      </Column>
      <Column>
        <Name>trade_date</Name>
        <Type>date</Type>
      </Column>
      <Column>
        <Name>trader</Name>
        <Type>varchar2</Type>
        <Capacity>200</Capacity>
      </Column>
      <Index>
        <Name>trades_pk</Name>
        <Type>btree</Type>
      </Index>
      <Index>
        <Name>trades_idx1</Name>
        <Type>bitmap</Type>
      </Index>
    </Tables>
    testcase1.xml
    21-APR-06
    <Tables xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://xmlns.examples.org/xdb/schemas/TDB/tab
    s.xsd">
      <table_name>trades</table_name>
      <Column>
        <Name>trade_id</Name>
        <Type>varchar2</Type>
        <Capacity>50</Capacity>
      </Column>
      <Column>
        <Name>source</Name>
        <Type>varchar2</Type>
        <Capacity>100</Capacity>
      </Column>
      <Column>
        <Name>trade_date</Name>
        <Type>date</Type>
      </Column>
      <Column>
        <Name>trader</Name>
        <Type>varchar2</Type>
        <Capacity>200</Capacity>
      </Column>
      <Index>
        <Name>trades_pk</Name>
        <Type>btree</Type>
      </Index>
      <Index>
        <Name>trades_idx1</Name>
        <Type>bitmap</Type>
      </Index>
    </Tables>Since you are tracking metadata about the documents (name, date loaded) you might want to consider using the XDB repository to load the documents. The folllowing shows how you can do this from SQL and then create a view which contains the metadata and document content. The advantage of this approach is you can now load the documents using FTP or WebDAV.
    SQL> declare
      2    res boolean;
      3    document xmltype := xmltype(
      4  '<Tables xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://xmlns.examples.org/xdb/schemas/T
    /tables.xsd">
      5     <table_name>trades</table_name>
      6     <Column>
      7             <Name>trade_id</Name>
      8             <Type>varchar2</Type>
      9             <Capacity>50</Capacity>
    10     </Column>
    11     <Column>
    12             <Name>source</Name>
    13             <Type>varchar2</Type>
    14             <Capacity>100</Capacity>
    15     </Column>
    16     <Column>
    17             <Name>trade_date</Name>
    18             <Type>date</Type>
    19     </Column>
    20     <Column>
    21             <Name>trader</Name>
    22             <Type>varchar2</Type>
    23             <Capacity>200</Capacity>
    24     </Column>
    25     <Index>
    26             <Name>trades_pk</Name>
    27             <Type>btree</Type>
    28     </Index>
    29     <Index>
    30             <Name>trades_idx1</Name>
    31             <Type>bitmap</Type>
    32     </Index>
    33  </Tables>');
    34  begin
    35    res := dbms_xdb.createResource('/public/testcase.xml',document);
    36  end;
    37  /
    PL/SQL procedure successfully completed.
    SQL> create or replace view TMP_XML_TABLES_VIEW as
      2  select extractValue(res,'/Resource/DisplayName') FILENAME,
      3         extractValue(res,'/Resource/CreationDate') LOAD_DATE,
      4         object_value XML_DOCUMENT
      5    from RESOURCE_VIEW, TABLES_TABLE t
      6   where extractValue(res,'/Resource/XMLRef')= ref(t)
      7  /
    View created.
    SQL> select * from TABLES_TABLE
      2  /
    <Tables xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://xmlns.examples.org/xdb/schemas/TDB/tab
    s.xsd">
      <table_name>trades</table_name>
      <Column>
        <Name>trade_id</Name>
        <Type>varchar2</Type>
        <Capacity>50</Capacity>
      </Column>
      <Column>
        <Name>source</Name>
        <Type>varchar2</Type>
        <Capacity>100</Capacity>
      </Column>
      <Column>
        <Name>trade_date</Name>
        <Type>date</Type>
      </Column>
      <Column>
        <Name>trader</Name>
        <Type>varchar2</Type>
        <Capacity>200</Capacity>
      </Column>
      <Index>
        <Name>trades_pk</Name>
        <Type>btree</Type>
      </Index>
      <Index>
        <Name>trades_idx1</Name>
        <Type>bitmap</Type>
      </Index>
    </Tables>
    SQL> select * from TMP_XML_TABLES_VIEW
      2  /
    testcase.xml
    21-APR-06 02.21.37.031000 PM
    <Tables xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://xmlns.examples.org/xdb/schemas/TDB/tab
    s.xsd">
      <table_name>trades</table_name>
      <Column>
        <Name>trade_id</Name>
        <Type>varchar2</Type>
        <Capacity>50</Capacity>
      </Column>
      <Column>
        <Name>source</Name>
        <Type>varchar2</Type>
        <Capacity>100</Capacity>
      </Column>
      <Column>
        <Name>trade_date</Name>
        <Type>date</Type>
      </Column>
      <Column>
        <Name>trader</Name>
        <Type>varchar2</Type>
        <Capacity>200</Capacity>
      </Column>
      <Index>
        <Name>trades_pk</Name>
        <Type>btree</Type>
      </Index>
      <Index>
        <Name>trades_idx1</Name>
        <Type>bitmap</Type>
      </Index>
    </Tables>
    SQL>
    SQL>
    SQL>

  • SQL LOADER and ORA-01861: literal does not match format string

    Hi,
    I've to load data through control_file(.ctl) into oracle table through sqlldr. Oracle 11g, win xp.
    as soon as I use - sqlldr dss/dss control=orders.ctl I get error or nothing.
    Text file that is generated after loading fails has the following error.
    Record 1: Rejected - Error on table ORDERS, column O_ORDERDATE.
    ORA-01861: literal does not match format string
    I have checked the format of data to be loaded into Orders table is like this : *1996-01-02.*
    I checked the format of data in my database by querying sysdate from dual i.e. 10-JAN-10
    I thought that changing its format might solve my problem so i tried this:
    SQL> alter session set nls_date_format='YYYY-MM-DD';
    Session altered.
    SQL> select sysdate from dual;
    SYSDATE
    2010-01-10but still i'm getting the same error. I've to load millions of data. how I can solve this issue.
    Please suggest.
    Thanks alot.
    Best Regads,
    Kam

    Hi,
    It's strange ....nobody knew it?. I think this type of load problem will be very common isn't it.... where date column data is in a different format than in the db i.e.
    How to change *1996-01-02* in the Control_file to make it able to load in the table where sysdate is like this: *11-JAN-10*
    Sample data to be loaded is :
    1|36901|O|173665.47|1996-01-02|5-LOW|Clerk#000000951|0|nstructions sleep furiously among |
    Desc Orders
    O_ORDERDATE NOT NULL DATEI have tested this by creating a test table and a test control file by omitting this O_ORDERDATE and then everything was fine, data was inserted but don't know how to load this DATE also.
    Also not able to understand about POSITION in the control file...?
    Regards,
    Kam

  • SQL Error: ORA-01861: literal does not match format string

    Hello,
    I'm trying to do data mining on a web log which recorded one day web access information from a busy web server. I imported the data into Oracle Data miner, and created a table (WEBLOG). The idea is to create a new field, i.e. session, for the users so that each session could be thought as a representative of a user-intent (aka topic). Now based on this, data mining models would be used to cluster(group) the users based on their similarity. The first step is to prepare the data which involves using SQL queries. So first, all I did was to create a function for date and time. This is the following code I used,
    create or replace function ssndate(p_date in varchar2 default '03-01-18',
    p_time in varchar2)
    return number
    $if dbms_db_version.ver_le_10 $then
    deterministic
    $elsif dbms_db_version.ver_le_11 $then
    result_cache
    $end
    as
    begin
    return trunc((to_date(p_date||' '||p_time, 'dd-mm-yy hh24:mi:ss')
    - to_date('01-01-90','dd-mm-yy')) * (86400/2400));
    end ssndate;
    The function ssndate compiled successfully.
    The next step I took was to create a view through the following query,
    create or replace view WEBLOG_VIEWS
    as
    select (select ssndate(LOG_DATE, LOG_TIME) from dual) as "SESSION_DT",
    C_IP,
    CS_USER_AGENT,
    (CS_URI_STEM||'?'||CS_URI_QUERY) as WEB_LINK
    from WEBLOG;
    This was successful as well. The problem is in the next step where I try to do data grouping.
    create table FINAL_WEBLOG as
    select SESSION_DT, C_IP, CS_USER_AGENT,
    listagg(WEB_LINK, ' ')
    within group(order by C_IP, CS_USER_AGENT) "WEB_LINKS"
    from WEBLOG_VIEWS
    group by C_IP, CS_USER_AGENT, SESSION_DT
    order by SESSION_DT
    For this, I got the error,
    Error starting at line 1 in command:
    create table FINAL_LOG as
    select SESSION_DT, C_IP, CS_USER_AGENT,
    listagg(WEB_LINK, ' ')
    within group(order by C_IP, CS_USER_AGENT) "WEB_LINKS"
    from WEBLOG_VIEWS
    group by C_IP, CS_USER_AGENT, SESSION_DT
    order by SESSION_DT
    Error at Command Line:1 Column:7
    Error report:
    SQL Error: ORA-01861: literal does not match format string
    ORA-06512: at "DMUSER.SSNDATE", line 11
    ORA-06512: at line 1
    01861. 00000 - "literal does not match format string"
    *Cause:    Literals in the input must be the same length as literals in
    the format string (with the exception of leading whitespace).
    If the "FX" modifier has been toggled on, the literal must
    match exactly, with no extra whitespace.
    *Action:   Correct the format string to match the literal.
    I don't know where I'm going wrong with this.. the to_date function should be fine. In the data that I possess, the date and time are in no format. Example: 30118 and 0:00:09 respectively. If anyone has any clue about this I would be sincerely grateful for any help that I can get!! It's quite urgent..
    The Oracle version is 11.2.0.1.0
    Edited by: 975265 on Dec 5, 2012 5:31 PM

    975265 wrote:
    Ok.. Looks like I touched a nerve there. I apologize. I'm still a student, and this is the first time that I've tried something at this level. I'm still in the learning process, so I was hoping that someone could point me in the right direction in order to "fix" the data.Not so much touching a nerve as simply trying to implement a very very poor, but all too common, practice. Since you are a student (which we didn't know until this post) most people will cut you some slack. However, this little exchange should now be burned into your brain as you move forward. One of the very first rules of programming is to ALWAYS use the correct data types for your data. And along with that, never ever depend on implicit type conversions - always use the proper explicit conversion functions.
    And as a slight follow-on, when considering the appropriate data type, don't assume that just because we refer to a given element as a 'something number' that it is indeed a number. Telephone "numbers" are NOT numbers. U.S. Social Security "numbers" are NOT numbers. U.S. Postal Zip codes are NOT numbers. All are just character strings which, by convention, we limit to the same characters we use to represent numbers.
    And since this entire discussion came up around the representation of dates, you might want to take a look at http://edstevensdba.wordpress.com/2011/04/07/nls_date_format/
    Now, go forth and be a smarter programmer than your peers.
    Edited by: EdStevens on Dec 6, 2012 6:12 AM

  • Error: ORA-01861: literal does not match format string

    Hi,
    I am doing a RFC-XI-JDBC scenario.
    In the CC monitoring , i am getting this error for the reciver CC:
    "Error while parsing or executing XML-SQL document: Error processing request in sax parser: Error when executing statement for table/stored proc. "TableNAMe"(structure 'STATEMENTNAME'): java.sql.SQLException: ORA-01861: literal does not match format string "
    Please guide me what can be the cause and how to solve it.
    Thanks,
    Puneet

    This is how my payload looks like :
    <?xml version="1.0" encoding="UTF-8"?>
    <ns1:MT_JDBC_REC xmlns:ns1="https:namespace.scene3">
    <STATEMENTNAME>
    <TABLE_NAME action="INSERT">
    <TABLE>ggclgis</TABLE>
    <access>
    <VALVE_ID>12584</VALVE_ID>
    <EQUNR>122</EQUNR>
    <ERNAM>12122</ERNAM>
    <INVNR>1212</INVNR>
    <GROES>1212</GROES>
    <ELIEF>123</ELIEF>
    <GWLEN>21-jul-2008</GWLEN>
    <GWLDT>12-jun-2006</GWLDT>
    <SERGE>wqwqw</SERGE>
    <TYPBZ>wqwqwq</TYPBZ>
    </access>
    </TABLE_NAME>
    </STATEMENTNAME>
    </ns1:MT_JDBC_REC>
    Please tell me if it looks fine.

  • ORA-01861 literal does not match format string, ORA-02063preceding line fro

    We have upgraded a client from 8.0.5 to 9.2.03. The following query is called from a report that was built using Cold Fusion5. It worked in 8.0.5, but not 9.2.03. When you run the report you get the errors
    [Oracle][ODBC][Ora]ORA-01861: literal does not match format string ORA-02063: preceding line from FRPE
    Here's the query:
    SELECT x.acct, x.obj, x.offn, x.status, x.asofdate, max( decode( x.func_id, 1, t, null ) ) UOB, max( decode( x.func_id, 12, t, null ) ) COB, max( decode( x.func_id, 24, t, null ) ) Rate_Warning, max( decode( x.func_id, 2, t, null ) ) Sector_Change, max( decode( x.func_id, 2006, t, null) ) FRRFRD , max( decode( x.func_id, 2003, t, null ) ) No_Tcode , max( decode( x.func_id, 2004, t, null) ) No_Sector FROM ( SELECT a.acct, a.func_id, count(*) cnt, 'Fail' t, b.obj, b.offn, b.status,a.asofdate FROM frpfaud@FRPE a, frpair@FRPE b WHERE a.acct=b.acct AND a.asofdate='2008-02-29 00:00:00' AND b.bnk not like 'B%' and b.obj not in ('KL') and b.obj in ('GAF') GROUP BY a.acct, a.func_id,b.obj,b.offn,b.status,a.asofdate) x GROUP BY x.acct, x.obj,x.offn,x.status,x.asofdate
    Now, this query will not work by running straight through SQL worksheet in either the 8.0.5 or 9.2.03 regions. So I guess it has something to do with Cold Fusion- which I know nothing about. Has anyone had any experience using Cold Fusion to issue a query? What would be the cause of the difference between the Oracle versions? That is the only thing that changed.
    Thanks for any input.

    I actually want the date format of DD-MON-YY. Which, from what I understand, is the default format for both Oracle 8.0.5 and 9.2.03. I'm trying to figure out why it is now displaying as 'yyyy-mm-dd hh24:mi:ss'. I could convince the client that the code needs changing if I had evidence that this version of Oracle (9.2.03) used a different default date format. Or if Cold Fusion pulls the date differently. Ughh.
    Here are the database parameters:
    SQL> show parameter nls_date_format
    NAME TYPE VALUE
    nls_date_format string
    select sysdate from dual;
    SYSDATE
    26-FEB-08
    1 row selected.
    select * from nls_session_parameters
    PARAMETER VALUE
    NLS_LANGUAGE AMERICAN
    NLS_TERRITORY AMERICA
    NLS_CURRENCY $
    NLS_ISO_CURRENCY AMERICA
    NLS_NUMERIC_CHARACTERS .,
    NLS_CALENDAR GREGORIAN
    NLS_DATE_FORMAT DD-MON-RR
    NLS_DATE_LANGUAGE AMERICAN
    NLS_SORT BINARY
    NLS_TIME_FORMAT HH.MI.SSXFF AM
    NLS_TIMESTAMP_FORMAT DD-MON-RR HH.MI.SSXFF AM
    NLS_TIME_TZ_FORMAT HH.MI.SSXFF AM TZR
    NLS_TIMESTAMP_TZ_FORMAT DD-MON-RR HH.MI.SSXFF AM TZR
    NLS_DUAL_CURRENCY $
    NLS_COMP BINARY
    NLS_LENGTH_SEMANTICS BYTE
    NLS_NCHAR_CONV_EXCP FALSE
    17 rows selected.
    select * from v$nls_parameters
    PARAMETER VALUE
    NLS_LANGUAGE AMERICAN
    NLS_TERRITORY AMERICA
    NLS_CURRENCY $
    NLS_ISO_CURRENCY AMERICA
    NLS_NUMERIC_CHARACTERS .,
    NLS_CALENDAR GREGORIAN
    NLS_DATE_FORMAT DD-MON-RR
    NLS_DATE_LANGUAGE AMERICAN
    NLS_CHARACTERSET WE8MSWIN1252
    NLS_SORT BINARY
    NLS_TIME_FORMAT HH.MI.SSXFF AM
    NLS_TIMESTAMP_FORMAT DD-MON-RR HH.MI.SSXFF AM
    NLS_TIME_TZ_FORMAT HH.MI.SSXFF AM TZR
    NLS_TIMESTAMP_TZ_FORMAT DD-MON-RR HH.MI.SSXFF AM TZR
    NLS_DUAL_CURRENCY $
    NLS_NCHAR_CHARACTERSET AL16UTF16
    NLS_COMP BINARY
    NLS_LENGTH_SEMANTICS BYTE
    NLS_NCHAR_CONV_EXCP FALSE
    19 rows selected.

  • ORA-01861: literal does not match format string

    Hi Experts,
    Whenever i am running the my procedure in oracle appliactions i am getting this error.
    ORA-01861: literal does not match format string .
    pkg is below:--->
    CREATE OR REPLACE PACKAGE Arc0471_Pending_Crc_Prc_Pkg IS
      --Insert into Custom Table
        PROCEDURE Arc_Insert_Data(P_ORG_ID VARCHAR2, P_BC_CODE VARCHAR2, P_GL_DATE VARCHAR2, P_DB_LINK VARCHAR2);
    END Arc0471_Pending_Crc_Prc_Pkg;
    CREATE OR REPLACE PACKAGE BODY Arc0471_Pending_Crc_Prc_Pkg IS
            PROCEDURE Arc_Insert_Data(P_ORG_ID VARCHAR2, P_BC_CODE VARCHAR2, P_GL_DATE VARCHAR2, P_DB_LINK VARCHAR2)
            IS
              v_val         varchar2(32000);          
              v_cursor1     integer;
              v_cursor2     integer;
              v_returncode  integer;
            BEGIN
           v_val   := ' ';
            v_val :=' INSERT INTO ARC.ARC_CRC_PRC_INVC ';
              v_val := v_val||' (CTA_TRX_NUMBER ,CTA_TRX_DATE ,DUE_DATE ,';
              v_val := v_val||' BILL_TO_CUSTOMER_NO,     BILL_TO_CUSTOMER_NAME ,     BILL_TO_LOCATION ,';
              v_val := v_val||' BILL_TO_ADDRESS ,ORIGINAL_AMOUNT ,APPLIED_AMOUNT , EXCHANGE_RATE     ,';
              v_val := v_val||' INVOICE_CURRENCY_CODE , ACCOUNT_CLASS , GL_DATE  , CTA_CUSTOMER_TRX_ID ,';
              v_val := v_val||' ORG_ID , CREATED_BY , CREATION_DATE ,LAST_UPDATE_BY , LAST_UPDATE_DATE , LAST_UPDATE_LOGIN )';
            v_val := v_val||' SELECT  CTA.TRX_NUMBER ,     CTA.TRX_DATE , APS.DUE_DATE ,';
              v_val := v_val||' HCA.ACCOUNT_NUMBER ,     HP.PARTY_NAME ,     HCSUA.LOCATION ,';
              v_val := v_val||' SUBSTR(HL.ADDRESS1 ||'||''' '''||'|| HL.ADDRESS2 ||'||'''  '''|| '||HL.ADDRESS3||'||'''  '''|| '||HL.ADDRESS4|| '||'''  ''' ||'||HL.PROVINCE||'||'''  '''||'|| HL.CITY ||'||'''  '''||'|| HL.STATE ||'||'''  '''||'|| HL.POSTAL_CODE ||'||'''  '''||'||FTL.TERRITORY_SHORT_NAME,0,1500),';
              v_val := v_val||' APS.AMOUNT_DUE_ORIGINAL , APS.AMOUNT_APPLIED,APS.EXCHANGE_RATE, APS.INVOICE_CURRENCY_CODE, CTLA.ACCOUNT_CLASS,';
              v_val := v_val||' APS.GL_DATE , CTA.CUSTOMER_TRX_ID , CTA.ORG_ID ,FND_GLOBAL.USER_ID ,';
              v_val := v_val||' SYSDATE , FND_GLOBAL.USER_ID , SYSDATE , FND_GLOBAL.LOGIN_ID '  ;  
             v_val := v_val||' FROM ' ;
             v_val := v_val||' AR.RA_CUSTOMER_TRX_ALL CTA,';
              v_val := v_val||' AR.RA_CUST_TRX_TYPES_ALL CTTA,';
              v_val := v_val||' AR.RA_CUST_TRX_LINE_GL_DIST_ALL CTLA,';
              v_val := v_val||' AR.HZ_PARTIES HP,';
              v_val := v_val||' AR.HZ_CUST_ACCOUNTS HCA,';
              v_val := v_val||' AR.HZ_CUST_SITE_USES_ALL HCSUA,';
              v_val := v_val||' AR.HZ_LOCATIONS HL,';
              v_val := v_val||' AR.HZ_PARTY_SITES HPS,';
              v_val := v_val||' AR.AR_PAYMENT_SCHEDULES_ALL APS,';
              v_val := v_val||' AR.HZ_CUST_ACCT_SITES_ALL HCASA,';
              v_val := v_val||' GL.GL_CODE_COMBINATIONS GCC,';
              v_val := v_val||' AR.AR_RECEIVABLE_APPLICATIONS_ALL ARAA,';
              v_val := v_val||' APPLSYS.FND_TERRITORIES_TL FTL ,';
              v_val := v_val||' ONT.OE_TRANSACTION_TYPES_TL'|| P_DB_LINK ||' IND_OTT, ' ;
              v_val := v_val||' ONT.OE_ORDER_HEADERS_ALL'||P_DB_LINK ||'  IND_OH, ';
              v_val := v_val||' AR.RA_CUSTOMER_TRX_ALL'||P_DB_LINK ||' IND_RCTA   ';
             v_val := v_val||' WHERE   CTA.ORG_ID = '||''''|| P_ORG_ID||'''';
             v_val := v_val||' AND   CTTA.ORG_ID = '||''''|| P_ORG_ID||'''' ;
             v_val := v_val||' AND   CTLA.ORG_ID = '||''''|| P_ORG_ID||'''' ;
             v_val := v_val||' AND   HCSUA.ORG_ID = '||''''|| P_ORG_ID||'''' ;
             v_val := v_val||' AND   APS.ORG_ID =  '||''''||P_ORG_ID||'''';
             v_val := v_val||' AND   HCASA.ORG_ID = '||''''|| P_ORG_ID||'''' ;
             v_val := v_val||' AND   CTLA.ACCOUNT_CLASS     =     '||'''REC''';
              v_val := v_val||' AND   CTLA.GL_DATE <= TRUNC(TO_DATE( '||''''||P_GL_DATE||''''||','||'''DD/MM/RRRR HH24:MI:SS'''||'))';
             v_val := v_val||' AND   NVL(ARAA.APPLY_DATE,TO_DATE( '||''''||P_GL_DATE||''''||','||'''DD/MM/RRRR HH24:MI:SS'''||')) <= TRUNC(TO_DATE ('||''''||P_GL_DATE||''''||','||'''DD/MM/RRRR HH24:MI:SS'''||'))';
             v_val := v_val||' AND   TO_DATE(APS.TRX_DATE,'||'''DD-MON-RRRR'''||') >'|| '''02-SEP-2007''' ;
             v_val := v_val||' AND     CTA.CUST_TRX_TYPE_ID    =     CTTA.CUST_TRX_TYPE_ID';
             v_val := v_val||' AND     CTLA.CUSTOMER_TRX_ID     =     CTA.CUSTOMER_TRX_ID';
             v_val := v_val||' AND     HCA.CUST_ACCOUNT_ID     =     CTA.BILL_TO_CUSTOMER_ID';
             v_val := v_val||' AND     HCA.PARTY_ID          =     HP.PARTY_ID';
             v_val := v_val||' AND     HCSUA.SITE_USE_ID     =     CTA.BILL_TO_SITE_USE_ID';
             v_val := v_val||' AND     HL.LOCATION_ID          =     HPS.LOCATION_ID';
             v_val := v_val||' AND     HPS.PARTY_ID          =     HCA.PARTY_ID';
               v_val := v_val||' AND     APS.CUSTOMER_TRX_ID     =     CTLA.CUSTOMER_TRX_ID';
             v_val := v_val||' AND     HCASA.CUST_ACCOUNT_ID     =     HCA.CUST_ACCOUNT_ID';
             v_val := v_val||' AND   HCASA.CUST_ACCT_SITE_ID =HCSUA.CUST_ACCT_SITE_ID';
             v_val := v_val||' AND   HCASA.PARTY_SITE_ID=HPS.PARTY_SITE_ID';
             v_val := v_val||' AND     ARAA.APPLIED_CUSTOMER_TRX_ID(+) = CTA.CUSTOMER_TRX_ID';
             v_val := v_val||' AND   IND_RCTA.TRX_NUMBER = CTA.TRX_NUMBER';
             v_val := v_val||' AND     TO_CHAR(IND_OH.ORDER_NUMBER) = IND_RCTA.CT_REFERENCE';
             v_val := v_val||' AND     IND_OTT.TRANSACTION_TYPE_ID = IND_OH.ORDER_TYPE_ID';
              --v_val := v_val||' AND   ARC.Arc0463_Get_Remng_Amt(APS.TRX_NUMBER,'||''''|| P_GL_DATE||''''||','||'APS.INVOICE_CURRENCY_CODE) <> 0';
             v_val := v_val||' AND   IND_OTT.NAME IN ('||'''D0M RC Imported Sale'''||','||'''D0M RC Indigenous Sale'''||')';
             v_val := v_val||' AND   GCC.CODE_COMBINATION_ID = CTLA.CODE_COMBINATION_ID';
             v_val := v_val||' AND   GCC.SEGMENT1 = '|| ''''||P_BC_CODE||'''';
             v_val := v_val||' AND   HL.COUNTRY = FTL.TERRITORY_CODE';
             v_val := v_val||' AND   FTL.LANGUAGE = USERENV('||'''LANG'''||')';          
                v_cursor1 := dbms_sql.open_cursor;
              dbms_sql.parse(v_cursor1,v_val,DBMS_SQL.NATIVE);
              v_returncode := dbms_sql.execute(v_cursor1);
              dbms_sql.close_cursor(v_cursor1);
         COMMIT;
         EXCEPTION     
                    WHEN DUP_VAL_ON_INDEX THEN
                                    NULL;
                   WHEN OTHERS THEN
                        COMMIT;
                   FND_FILE.PUT_LINE(FND_FILE.OUTPUT, 'IN WHEN OTHERS THEN OF INSERT INTO ARC.ARC_CRC_PRC_INVC'||SQLCODE || ' - ' || SQLERRM);
                -- dbms_output.put_line(sqlcode||sqlerrm);
            END Arc_Insert_Data;
    END Arc0471_Pending_Crc_Prc_Pkg;in above procdure APS.TRX_DATE having the format like this..23/3/2006. in Backend this procedure is working fine ..in toad(version 8.0.0.47). database is 9.0.
    but in oracle apps it is giving error like "literal does not match format string".
    please give me the solution...
    Thanks in ADv...

    Hi,
    It is the Date Data type...There's your problem then; NEVER, EVER, EVER to_date a date!! As you have discovered, it leads to problems when your code is run on different clients due to the different NLS settings they may have. You've been lucky, in other words, that your code has been working at all!
    What to_dating a date does is this:
    to_date(to_char(date_value, <format in NLS_DATE_FORMAT parameter>), <format in NLS_DATE_FORMAT parameter>) You've been lucky because your NLS_DATE_FORMAT has the same format as the data, on your client. On the database, however, it is clearly different.
    Simply remove the to_date from your already-a-date value, and you should find that it works fine.

  • Using Express when the database schema does not match theclass model

    We are working on a large pay/personnel management system and are
    evaluating Fort&eacute; Express and Sage Scaffolds. We need to answer some big
    questions in the near future, and I was hoping that there may be someone
    out there with the answers.
    1. How different can the database schema and the class model be, before
    Express becomes a bad choice of framework? What solutions exist for cases
    where Express is still a viable option?
    2. Assuming that we can get around the problem in question 1, will the
    Application Model features still work afterwards? (i.e. how sensitive are
    the client-side services to changes in the database services?)
    3. Express seems to use domain classes everywhere, whereas we are always
    being advised to use scalar attributes wherever possible. How badly does
    this affect the performance of Express applications?
    4. Has anybody out there used Sage Scaffolds on a large project recently?
    How did it go? What problems should we watch out for? Doesn't its 'Chain
    of Responsibility' pattern tend to produce a lot of unnecessary objects at
    run-time?
    5. Has anybody used the Born collection classes? How do they compare with
    Brahma's Fortify?
    Thanks to those who have already helped - all input gratefully received!
    Tim Kimber
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>

    I did all that before posting the orignial post..
    declare
      v_schema_exists varchar2(1) := 'N';
      res             boolean;
      schemaURL       varchar2(100) := 'T0090.xsd';
      schemaPath      varchar2(100) :=  '/prmt/xsd/T0090.xsd'; --'/public/T0090.xsd';
      xmlSchema xmlType := XMLTYPE(bfilename('DIR_PRMT_OUT_CVIEW','T0090.xsd'),NLS_CHARSET_ID('AL32UTF8'));
    begin
      begin
        select 'Y'
          into v_schema_exists
          from sys.all_xml_schemas  -- changed from user_xml_schemas
         where schema_url = schemaURL;
        dbms_xmlSchema.deleteSchema(schemaURL,4);
        exception
          when NO_DATA_FOUND then
            null;
      end;
      if (dbms_xdb.existsResource(schemaPath)) then
        dbms_xdb.deleteResource(schemaPath);
      end if;
      res := dbms_xdb.createResource(schemaPath,xmlSchema);   
      dbms_xmlschema.registerSchema ( schemaURL, xdbURIType(schemaPath).getClob(), TRUE, TRUE, FALSE, TRUE );
    end;
    / I guess my understanding was that I could grant another oracle user access to my registered schema just like I can grant a single user access to a table. Evidently I only have two options. Only the schema owner can use the schema or everyone can use the schema and I cannot grant access to a single user other than myself.
    Edited by: Mark Reichman on Jul 2, 2010 9:08 AM
    Edited by: Mark Reichman on Jul 2, 2010 9:09 AM

  • SSIS OLE DB Data Source: literal does not match format string

    Dear All,
    this is my first post on this forum, so sorry if I choose wrong category for this question, but I stuck...
    I'm using SSIS from SQL Server 2k8 R2 in Windows Server 2k8 R2. I have installed Oracle Client 10.2.0.2 32 bits and Oracle Client 10.2.0.4 64bits. I want to connect to Oracle 8i and Oracle 9i by these clients.
    Unfortunately when I want to see a preview, only error occurs to me:
    ORA-01861: literal does not match format string (OraOLEDB)
    I have read a lot about this issue but nothing helps me (to_date, cast, convert etc.).
    This is query which I use:
    SELECT COMPANYID, TRANSACTIONTYPE, TRANSACTIONDATE,
    PRODUCT, PRODUCTIONSITE, BATCHNUMBER,
    BINNUMBER, QUANTITYSTOCKUNIT, QUANTITY,
    UNITOFMEASURE, TRANSACTIONCURRENCYID, COST
    FROM APPS.DW_PRODUCTION
    WHERE TRANSACTIONDATE >= '20050101'
    AND TRANSACTIONDATE &lt; '99991231'I have investigated that the problem is with TRANSACTIONDATE column (which is VARCHAR2 data type in database).
    I want also inform You that the same query in SSIS 2005 on Windows 2005 64 bits worked fine.
    Could You help me to find a solution?
    Thanks in advance,
    Łukasz - chalunster
    PS. Sorry for my english
    Edited by: BluShadow on 16-May-2011 15:15
    put {noformat}{noformat} tags into the message and encoded the &lt; symbol so that it formats correctly.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    user10450810 wrote:
    Dear All,
    this is my first post on this forum, so sorry if I choose wrong category for this question, but I stuck...
    I'm using SSIS from SQL Server 2k8 R2 in Windows Server 2k8 R2. I have installed Oracle Client 10.2.0.2 32 bits and Oracle Client 10.2.0.4 64bits. I want to connect to Oracle 8i and Oracle 9i by these clients.
    Unfortunately when I want to see a preview, only error occurs to me:
    ORA-01861: literal does not match format string (OraOLEDB)
    I have read a lot about this issue but nothing helps me (to_date, cast, convert etc.).
    This is query which I use:
    SELECT COMPANYID, TRANSACTIONTYPE, TRANSACTIONDATE,
    PRODUCT, PRODUCTIONSITE, BATCHNUMBER,
    BINNUMBER, QUANTITYSTOCKUNIT, QUANTITY,
    UNITOFMEASURE, TRANSACTIONCURRENCYID, COST
    FROM APPS.DW_PRODUCTION
    WHERE TRANSACTIONDATE >= '20050101'
    AND TRANSACTIONDATE < '99991231'
    I have investigated that the problem is with TRANSACTIONDATE column (which is VARCHAR2 data type in database).
    I want also inform You that the same query in SSIS 2005 on Windows 2005 64 bits worked fine.
    Could You help me to find a solution?
    Thanks in advance,
    Łukasz - chalunster
    PS. Sorry for my englishHi
    Welcome to OTN Forums!
    Are you sure you are using following code
    SELECT COMPANYID, TRANSACTIONTYPE, TRANSACTIONDATE,
    PRODUCT, PRODUCTIONSITE, BATCHNUMBER,
    BINNUMBER, QUANTITYSTOCKUNIT, QUANTITY,
    UNITOFMEASURE, TRANSACTIONCURRENCYID, COST
    FROM APPS.DW_PRODUCTION
    WHERE TRANSACTIONDATE >= '20050101'
    AND TRANSACTIONDATE < 'If yes, then youistake is there,
    WHERE TRANSACTIONDATE >= '20050101'
    AND TRANSACTIONDATE < 'your script is not ended you can use this
    WHERE TRANSACTIONDATE >= '20050101'
    AND TRANSACTIONDATE < '20110101'or
    WHERE to_date(TRANSACTIONDATE,'YYYYMMDD')  >= to_date('20050101','YYYYMMDD')
    AND to_date(TRANSACTIONDATE,'YYYYMMDD') < to_date('20110101','YYYYMMDD')Edited by: Mahir M. Quluzade on May 16, 2011 6:59 PM

  • Still ORA-19007: Schema and element do not match Error

    Hi all,
    I'm new to XML and dealing with lots of information but I'm stuck with this error ORA-19007: Schema and element do not match. Read some forums and tried some possibitlities but none has solved this issue. I think this is related with some malformed headers definitions but I'm not sure, so any help will be much appreciated.
    Here's what I've done so far:
    This is the xml file - emp.xml:
    <?xml version="1.0" encoding="UTF-8"?>
    <!--Sample XML file generated by XMLSpy v2006 rel. 3 sp2 (http://www.altova.com)-->
    <employees xmlns:xdb="http://xmlns.oracle.com/xdb" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://xmlns.oracle.com/xdb/emp.xsd">
         <employee team="Team Test">
              <id>1</id>
              <name>Nelson Branco</name>
              <comment>No Comments</comment>
         </employee>
    </employees>
    ...and this is the XSD file: emp.xsd:
    <?xml version="1.0" encoding="ISO-8859-15"?>
    <!-- edited with XMLSpy v2006 rel. 3 sp2 (http://www.altova.com) by Nelson Branco (Oracle Corp) -->
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xdb="http://xmlns.oracle.com/xdb" elementFormDefault="qualified" xdb:storeVarrayAsTable="true">
         <xs:element name="comment" type="xs:string"/>
         <xs:element name="id" type="xs:string"/>
         <xs:element name="name" type="xs:string"/>
         <xs:complexType name="employeeType">
              <xs:sequence>
                   <xs:element ref="id"/>
                   <xs:element ref="name"/>
                   <xs:element ref="comment" minOccurs="0"/>
              </xs:sequence>
              <xs:attribute name="team" type="xs:string" use="optional"/>
         </xs:complexType>
         <xs:element name="employee" type="employeeType"/>
         <xs:element name="employees" xdb:defaultTable="EMPLOYEES">
              <xs:complexType>
                   <xs:sequence>
                        <xs:element ref="employee" maxOccurs="unbounded"/>
                   </xs:sequence>
              </xs:complexType>
         </xs:element>
    </xs:schema>
    1) Created folders
    declare
    ignore boolean;
    begin
    ignore := dbms_xdb.createFolder('/public/Emp');
    ignore := dbms_xdb.createFolder('/public/Emp/xsd');
    ignore := dbms_xdb.createFolder('/public/Emp/xml');
    commit ;
    end;
    2) Copied emp.xsd to /public/Emp/xsd in Win Explorer (via WebDAV connection)
    3) Registered the schema
    begin
    dbms_xmlschema.registerURI(schemaURL => 'http://xmlns.oracle.com/xdb/emp.xsd'
    ,schemaDocURI => '/public/Emp/xsd/emp.xsd'
    ,genTables => true
    commit ;
    end ;
    4) Copied the xml file to /public/Emp/xml. At this point I was expecting that the xml file was automatically uploaded to corresponding tables based on is content but it didn't happen. I didn't got any error also. When I issue:
    Select count(*) from employees
    ...or
    select y."name", y."team" from employees x, table(x.xmldata."employee") y
    ...got 0 rows returned
    5) So then created the table:
    create table emp_tab(
    id number,
    emp sys.XMLType
    xmltype column emp
    XMLSCHEMA "http://xmlns.oracle.com/xdb/emp.xsd"
    element "employee";
    6) And tried to insert one record based on the emp.xml:
    insert into emp_tab values (1,
    xmltype('<?xml version="1.0" encoding="UTF-8"?>
    <!--Sample XML file generated by XMLSpy v2006 rel. 3 sp2 (http://www.altova.com)-->
    <employees xmlns:xdb="http://xmlns.oracle.com/xdb" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://xmlns.oracle.com/xdb/emp.xsd">
         <employee team="Team Test">
              <id>1</id>
              <name>Nelson Branco</name>
              <comment>No Comments</comment>
         </employee>
    </employees>'));
    ...and that when I get ORA-19007: Schema and element do not match.
    Any help on this will be appreciated. Thx.

    SQL> set echo on
    SQL> spool testcase.log
    SQL> --
    SQL> connect sys/ as sysdba
    Enter password:
    Connected.
    SQL> set define on
    SQL> --
    SQL> define USERNAME = OTNTEST
    SQL> --
    SQL> def PASSWORD = OTNTEST
    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 OTNTEST cascade
    User dropped.
    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 OTNTEST identified by OTNTEST
    Grant succeeded.
    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 OTNTEST
    Grant succeeded.
    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 OTNTEST
    Grant succeeded.
    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 OTNTEST default tablespace USERS temporary tablespace TEMP
    User altered.
    SQL> connect &USERNAME/&PASSWORD
    Connected.
    SQL> --
    SQL> alter session set events ='19027 trace name context forever, level 0x800'
      2  /
    Session altered.
    SQL> var schemaURL varchar2(256)
    SQL> var schemaPath varchar2(256)
    SQL> --
    SQL> begin
      2    :schemaURL := 'http://xmlns.oracle.com/xdb/emp.xsd';
      3    :schemaPath := '/public/testcase.xsd';
      4  end;
      5  /
    PL/SQL procedure successfully completed.
    SQL> create or replace directory XMLDIR as 'c:\xdb\otn'
      2  /
    Directory created.
    SQL> declare
      2    res boolean;
      3    xmlSchema xmlType := xmlType(
      4  '<?xml version="1.0" encoding="ISO-8859-15"?>
      5  <!-- edited with XMLSpy v2006 rel. 3 sp2 (http://www.altova.com) by Nelson Branco (Oracle Corp) -->
      6  <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xdb="http://xmlns.oracle.com/xdb" elementFormDefault="qualified" xdb:store
    VarrayAsTable="true">
      7  <xs:element name="comment" type="xs:string"/>
      8  <xs:element name="id" type="xs:string"/>
      9  <xs:element name="name" type="xs:string"/>
    10  <xs:complexType name="employeeType">
    11  <xs:sequence>
    12  <xs:element ref="id"/>
    13  <xs:element ref="name"/>
    14  <xs:element ref="comment" minOccurs="0"/>
    15  </xs:sequence>
    16  <xs:attribute name="team" type="xs:string" use="optional"/>
    17  </xs:complexType>
    18  <xs:element name="employee" type="employeeType"/>
    19  <xs:element name="employees" xdb:defaultTable="EMPLOYEES">
    20  <xs:complexType>
    21  <xs:sequence>
    22  <xs:element ref="employee" maxOccurs="unbounded"/>
    23  </xs:sequence>
    24  </xs:complexType>
    25  </xs:element>
    26  </xs:schema>');
    27  begin
    28    if (dbms_xdb.existsResource(:schemaPath)) then
    29      dbms_xdb.deleteResource(:schemaPath);
    30    end if;
    31    res := dbms_xdb.createResource(:schemaPath,xmlSchema);
    32  end;
    33  /
    PL/SQL procedure successfully completed.
    SQL> begin
      2    dbms_xmlschema.registerSchema
      3    (
      4      :schemaURL,
      5      xdbURIType(:schemaPath).getClob(),
      6      TRUE,TRUE,FALSE,TRUE
      7    );
      8  end;
      9  /
    PL/SQL procedure successfully completed.
    SQL> var xmltext varchar2(4000)
    SQL> --
    SQL> begin
      2    :xmltext :=
      3  '<?xml version="1.0" encoding="UTF-8"?>
      4  <!--Sample XML file generated by XMLSpy v2006 rel. 3 sp2 (http://www.altova.com)-->
      5  <employees xmlns:xdb="http://xmlns.oracle.com/xdb" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation=
    "http://xmlns.oracle.com/xdb/emp.xsd">
      6  <employee team="Team Test">
      7  <id>1</id>
      8  <name>Nelson Branco</name>
      9  <comment>No Comments</comment>
    10  </employee>
    11  </employees>';
    12  end;
    13  /
    PL/SQL procedure successfully completed.
    SQL> insert into EMPLOYEES values ( xmltype(:xmltext));
    1 row created.
    SQL> /
    1 row created.
    SQL> create table emp_tab
      2  (
      3     id number,
      4     emp sys.XMLType
      5  )
      6  xmltype column emp
      7  XMLSCHEMA "http://xmlns.oracle.com/xdb/emp.xsd"
      8  element "employee"
      9  /
    Table created.
    SQL> insert into EMP_TAB values ( 1, xmltype(:xmltext))
      2  /
    insert into EMP_TAB values ( 1, xmltype(:xmltext))
    ERROR at line 1:
    ORA-19040: Element employees does not match expected employee.
    SQL> drop table emp_tab
      2  /
    Table dropped.
    SQL> create table emp_tab
      2  (
      3     id number,
      4     emp sys.XMLType
      5  )
      6  xmltype column emp
      7  XMLSCHEMA "http://xmlns.oracle.com/xdb/emp.xsd"
      8  element "employees"
      9  /
    Table created.
    SQL> insert into EMP_TAB values ( 1, xmltype(:xmltext))
      2  /
    1 row created.
    SQL>

  • ORA-19007: Schema and element do not match

    I've registered a schema with my DB provided in the Oracle 9i XML DataBase Developer's Guide. I've created a table that has one field of type XMLType and is associated with the registered schema. Now I am trying to insert an xml string - also directly from the Oracle's developer's guide site and am getting 'ORA-19007: Schema and element do not match'.
    These are the steps I took:
    1.begin dbms_xmlschema.registerSchema( 'http://www.oracle.com/po.xsd', getClobDocument ('po.xsd','XSDDIR'), TRUE, TRUE, FALSE, FALSE); end;
    2.create table po_tab(id number,po sys.XMLType ) xmltype column po XMLSCHEMA "http://www.oracle.com/po.xsd"element "PurchaseOrder";
    3.INSERT INTO PurchaseOrder VALUES (xmltype.createxml('<PurchaseOrder xmlns="http://www.oracle.com/po.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.oracle.com/po.xsd"><PONum>1001</PONum><Company>Oracle Corp</Company><Item><Part>9i Doc Set</Part><Price>2550</Price></Item></PurchaseOrder>'));
    this is the po.xsd used:
    <schema targetNamespace="http://www.oracle.com/PO.xsd"
    xmlns:po="http://www.oracle.com/PO.xsd"
    xmlns="http://www.w3.org/2001/XMLSchema">
    <complexType name="PurchaseOrderType">
    <sequence>
    <element name="PONum" type="decimal"/>
    <element name="Company">
    <simpleType>
    <restriction base="string">
    <maxLength value="100"/>
    </restriction>
    </simpleType>
    </element>
    <element name="Item" maxOccurs="1000">
    <complexType>
    <sequence>
    <element name="Part">
    <simpleType>
    <restriction base="string">
    <maxLength value="1000"/>
    </restriction>
    </simpleType>
    </element>
    <element name="Price" type="float"/>
    </sequence>
    </complexType>
    </element>
    </sequence>
    </complexType>
    <element name="PurchaseOrder" type="po:PurchaseOrderType"/>
    </schema>
    thanks in advance

    Minor correction to the previous message, sorry: I've registered a schema with my DB provided in the
    Oracle 9i XML DataBase Developer's Guide. I've
    created a table that has one field of type XMLType
    and is associated with the registered schema. Now I
    am trying to insert an xml string - also directly
    from the Oracle's developer's guide site and am
    getting 'ORA-19007: Schema and element do not
    match'.
    These are the steps I took:
    1.begin dbms_xmlschema.registerSchema(
    'http://www.oracle.com/po.xsd', getClobDocument
    ('po.xsd','XSDDIR'), TRUE, TRUE, FALSE, FALSE); end;
    2.create table po_tab(id number,po sys.XMLType )
    xmltype column po XMLSCHEMA
    "http://www.oracle.com/po.xsd"element
    "PurchaseOrder";
    3.INSERT INTO PurchaseOrder VALUES
    (xmltype.createxml(1,'<PurchaseOrder
    xmlns="http://www.oracle.com/po.xsd"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.oracle.com/po.xsd"><PON
    m>1001</PONum><Company>Oracle
    Corp</Company><Item><Part>9i Doc
    Set</Part><Price>2550</Price></Item></PurchaseOrder>')
    this is the po.xsd used:
    <schema
    targetNamespace="http://www.oracle.com/PO.xsd"
    xmlns:po="http://www.oracle.com/PO.xsd"
    xmlns="http://www.w3.org/2001/XMLSchema">
    <complexType name="PurchaseOrderType">
    <sequence>
    <element name="PONum" type="decimal"/>
    <element name="Company">
    <simpleType>
    <restriction base="string">
    <maxLength value="100"/>
    </restriction>
    </simpleType>
    </element>
    <element name="Item" maxOccurs="1000">
    <complexType>
    <sequence>
    <element name="Part">
    <simpleType>
    <restriction base="string">
    <maxLength value="1000"/>
    </restriction>
    </simpleType>
    </element>
    <element name="Price" type="float"/>
    </sequence>
    </complexType>
    </element>
    </sequence>
    </complexType>
    <element name="PurchaseOrder"
    type="po:PurchaseOrderType"/>
    </schema>
    thanks in advance

  • Output map: Document Type does not match any of the given schemas

    On a send port, we have a map that uses a custom xslt. We were hoping to somehow design the map so the output was essentially a generic xs:any schema.  But unless we ad a reference from our map assembly to the assembly that holds the actual schema for
    the message pertaining to the map out put we get an error:
    The Messaging Engine failed while executing the outbound map for the message going to the destination URL "C:\BizTalk\Test\%MessageID%.xml"
    with the Message Type http://test#testmessage. Details:"Document type "outputtest#outputtestmessage" does not match any of the given schemas.
    Is there a way to avoid having to have the reference? 

    Hi ,
    In BizTalk messages are distinct from each other based on the message type . In your case http://test#testmessage (Namespace#RootNode)
    Now coming to your case have you verified whether you have a schema type matching the response is deployed with the solution. The easy way is to look into specific BizTalk application schema node .
    If not ,What you can do is to create a new schema for output having "TestMessage" as record and any element inside it. After that apply a mass copy
    funtiod from source t destination(in your case any type schema created).
    Thanks
    Abhishek

  • The document type does not match any of the given schemas. batching

    I am aggregating messages(batching) in Orchestation by calling pipeline. I have send pipeline where I have standard assemble component and custom pipeline in encode to assign some values .
    When I test it I get following error There was a failure executing the send pipeline: "Zones._870.Pipeline.Send870Pipeline, Zones.870, Version=1.0.0.0, Culture=neutral, PublicKeyToken=51b3a99d8425ff5a" Source: "ZonesAssignGUID" Send
    Port: "SendToAX870" URI: "C:\File_Out\Ingram\870\%MessageID%.xml" Reason: The document type "http://schemas.microsoft.com/dynamics/2011/01/documents/Message#Envelope" does not match any of the given schemas.  
    Can somebody help me how to resolve this issue? 

    Yes this is configured schema as envelope schema. This one is deployed in biztalk . I tried whatever suggest below query and return one record. Not sure but looks like error message misguiding here.
    select * from BT_DocumentSpec where msgtype like '%http://schemas.microsoft.com/dynamics/2011/01/documents/Message#Envelope%'

  • The document type does not match any of the given schemas

    Hi,
    I have created an envelope schema.To precisely process inbound envelope documents,in the xml disassembler component i have used the Documentspec and envelopespec properties.
    in the properties i have the the schema name,Assemblyname
    but i have got the error like The document type does not match any of the given schemas.
    I have verified the schemas have deployed properly.
    can you help me on this?

    Hi Sujith,
    As pointed out by Johns lot's of thing can cause this. You have to analyze lot of things, but this kind of error indicates that the message type that you are debatching is not deployed. For Example :
    If you are debatching on Order than Order schema should be deployed in the admin console.
    One more point that you need not to specifiy Documentspec and envelopespec properties until and unless there are multiple schema's of same message type deployed in different assembly. The dissasembler component will automaticaly disassemble the messages
    just looking after the body XPATH.
    Regards,
    Rahul Madaan

Maybe you are looking for

  • Multiple Windows accounts using a single Library

    I have not found a way to solve this problem but I am convinced that it is my lack of Windows expertise, so hopefully someone can point me in the right direction. I am talking about the iTunes Library and NOT Music Folder. I have two login accounts i

  • Software update - networking error (Mac OS 10.4.11)

    Hi everyone, I've been having problems running software update on my 867 MHz Powerbook G4. Every time I try to run software update, I get the same message: "A networking error has occurred: timed out (-1001). Make sure you can connect to the Internet

  • Imported Slide Show Problems

    I imported a slide from Photoshop Elements 7.0 into Premiere Elements 7.0. I did get an error that .jpg files could not be imported into Premiere. Some .jpgs showed and some did not. Any suggestion? Also, text titles I added in Photoshop are very blu

  • Problem deploying Duke's Bookstore JavaEE5 example

    Hello everyone, I am having problems deploying the Duke's Bookstore example. I am trying to follow the tutorial. I have already updated the information concerning AS_ADMIN_PASSWORD on the file "build.properties". It took me some times... by the way i

  • Doubt in Serial No's

    Hi All,           I have a doubt with regards to Serial No generation.Do they get created at the time of creation of Prod. Order. I have a requirement to change the format of serial no generation in my project with Basic Start date as one of the para