Schema validation problem in oracle 11g

Hi,
I am facing the following problem.
The Issue.xsd contains two elements (element1, element2) described as below. It contains two types
1. simpleType - MyStringType
2. complexType - MyType, an extension of MyStringType
Oracle XML DB can able to validate element2(simpleType), but not element1(complexType).
---------------------Issue.xsd File ------------------
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="ConfigRoot" xmlns:xdb="http://xmlns.oracle.com/xdb" targetNamespace="ConfigRoot" elementFormDefault="qualified">
     <xsd:element name="ConfigRoot" xdb:defaultTable="CONFIG_TBL_ISSUE">
          <xsd:complexType>
               <xsd:sequence>
                    <xsd:element name="element1" type="MyType"/>
                    <xsd:element name="element2" type="MyStringType"/>
               </xsd:sequence>
          </xsd:complexType>
     </xsd:element>
     <xsd:simpleType name="MyStringType">
          <xsd:restriction base="xsd:string">
               <xsd:pattern value="\d{2}([\W])\d{2}([\W])\d{2}"/>
          </xsd:restriction>
     </xsd:simpleType>
     <xsd:complexType name="MyType">
          <xsd:simpleContent>
               <xsd:extension base="MyStringType">
                    <xsd:attribute name="id" type="xsd:integer"/>
               </xsd:extension>
          </xsd:simpleContent>
     </xsd:complexType>
</xsd:schema>
--------------------- XML File -----------------
<?xml version="1.0" encoding="UTF-8"?>
<ConfigRoot xsi:schemaLocation="ConfigRoot Issue.xsd" xmlns="ConfigRoot" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
     <element1 id="1">19-12-222</element1>
     <element2>19-12-555</element2>
</ConfigRoot>
Though the schema is registered as binary, oracle could not able to validate the element1. The XML gets properly validated in the XML editors.

"Issue.xsd"
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="ConfigRoot" xmlns:xdb="http://xmlns.oracle.com/xdb" targetNamespace="ConfigRoot" elementFormDefault="qualified">
<xsd:element name="ConfigRoot" xdb:defaultTable="CONFIG_TBL_ISSUE">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="element1" type="MyType"/>
<xsd:element name="element2" type="MyStringType"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:simpleType name="MyStringType">
<xsd:restriction base="xsd:string">
<xsd:pattern value="\d{2}(\W)\d{2}(\W)\d{2}"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:complexType name="MyType">
<xsd:simpleContent>
<xsd:extension base="MyStringType">
<xsd:attribute name="id" type="xsd:integer"/>
</xsd:extension>
</xsd:simpleContent>
</xsd:complexType>
</xsd:schema>
"Issue.xml"
<?xml version="1.0" encoding="UTF-8"?>
<ConfigRoot xsi:schemaLocation="ConfigRoot Issue.xsd" xmlns="ConfigRoot" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<element1 id="1">19-12-222</element1>
<element2>19-12-555</element2>
</ConfigRoot>
[oracle@srv01-18-102 20081010]$ sqlplus / as sysdba
SQL*Plus: Release 11.1.0.7.0 - Production on Fri Oct 10 14:46:09 2008
Copyright (c) 1982, 2008, Oracle.  All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> select * from v$version;
BANNER
Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - Production
PL/SQL Release 11.1.0.7.0 - Production
CORE    11.1.0.7.0      Production
TNS for Linux: Version 11.1.0.7.0 - Production
NLSRTL Version 11.1.0.7.0 - Production
SQL> create user otn identified by otn account unlock;
User created.
SQL> -- The Quick and Dirty way regarding granting privileges
SQL> grant dba, xdbadmin  to otn;
Grant succeeded.
SQL> connect otn/otn
Connected.
SQL> create directory "XMLDIR_SCHEMA" as '/home/oracle/OTN/20081010';
Directory created.
SQL> -- Issue.xsd and Issue.xml are created and copied to the directory /home/oracle/OTN/20081010, on which I have read, write access as Linux user "oracle" (the oracle software owner)
SQL> BEGIN
  2  DBMS_XMLSCHEMA.registerSchema(
  3  SCHEMAURL => 'Issue.xsd',
  4  SCHEMADOC => bfilename ('XMLDIR_SCHEMA', 'Issue.xsd'),
  5  GENTYPES => FALSE,
  6  OWNER => USER,
  7  OPTIONS => 3);
  8  end;
  9* /
PL/SQL procedure successfully completed.
SQL> select * from tab;
TNAME                          TABTYPE  CLUSTERID
CONFIG_TBL_ISSUE               TABLE
SQL> set long 100000000
SQL> desc "CONFIG_TBL_ISSUE"
Name                                      Null?    Type
TABLE of SYS.XMLTYPE(XMLSchema "Issue.xsd" Element "ConfigRoot") STORAGE BINARY
SQL> set pages 5000
SQL>  select dbms_metadata.get_ddl('TABLE','CONFIG_TBL_ISSUE',user) from dual;
DBMS_METADATA.GET_DDL('TABLE','CONFIG_TBL_ISSUE',USER)
  CREATE TABLE "OTN"."CONFIG_TBL_ISSUE" OF "SYS"."XMLTYPE"
  XMLTYPE STORE AS BASICFILE BINARY XML  (
  TABLESPACE "USERS" ENABLE STORAGE IN ROW CHUNK 8192 PCTVERSION 10  
  NOCACHE LOGGING
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS  1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT))
XMLSCHEMA "Issue.xsd" ELEMENT "ConfigRoot" ID 4768 DISALLOW NONSCHEMA PCTFREE 10
  PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
  TABLESPACE "USERS"
INSERT INTO "CONFIG_TBL_ISSUE"
VALUES
(XMLTYPE(bfilename('XMLDIR_SCHEMA','Issue.xml'),NLS_CHARSET_ID('AL32UTF8')));
SQL> INSERT INTO "CONFIG_TBL_ISSUE"
  2  VALUES
  3  (XMLTYPE(bfilename('XMLDIR_SCHEMA','Issue.xml'),NLS_CHARSET_ID('AL32UTF8')))
  4  ;
(XMLTYPE(bfilename('XMLDIR_SCHEMA','Issue.xml'),NLS_CHARSET_ID('AL32UTF8')))
ERROR at line 3:
ORA-31011: XML parsing failed
ORA-19202: Error occurred in XML processing
LSX-00333: literal "19-12-555" is not valid with respect to the pattern
SQL> -- TESTING EXCEPTIONS
SQL> INSERT INTO "CONFIG_TBL_ISSUE"
  2  VALUES
  3  (XMLTYPE(
  4   '<?xml version="1.0" encoding="UTF-8"?>
  5   <ConfigRoot xsi:schemaLocation="ConfigRoot Issue.xsd" xmlns="ConfigRoot" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  6   <element1 id="1">01-11-11</element1>
  7   <element2>02-11-11</element2>
  8   </ConfigRoot>
  9  '));
1 row created.
SQL> rollback;
Rollback complete.
SQL> -- ELEMENT 1 and 2 ARE WRONG (correct response)
SQL> INSERT INTO "CONFIG_TBL_ISSUE"
  2  VALUES
  3  (XMLTYPE(
  4   '<?xml version="1.0" encoding="UTF-8"?>
  5   <ConfigRoot xsi:schemaLocation="ConfigRoot Issue.xsd" xmlns="ConfigRoot" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  6   <element1 id="1">01-11-111</element1>
  7   <element2>02-11-111</element2>
  8   </ConfigRoot>
  9  '));
(XMLTYPE(
ERROR at line 3:
ORA-31011: XML parsing failed
ORA-19202: Error occurred in XML processing
LSX-00333: literal "02-11-111" is not valid with respect to the pattern
SQL> -- ELEMENT 1 is WRONG (OOPS)
SQL> INSERT INTO "CONFIG_TBL_ISSUE"
  2  VALUES
  3  (XMLTYPE(
  4   '<?xml version="1.0" encoding="UTF-8"?>
  5   <ConfigRoot xsi:schemaLocation="ConfigRoot Issue.xsd" xmlns="ConfigRoot" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  6   <element1 id="1">01-11-111</element1>
  7   <element2>02-11-11</element2>
  8   </ConfigRoot>
  9  '));
1 row created.
SQL> rollback;
Rollback complete.
SQL> -- ELEMENT 2 is WRONG (correct response)
SQL> SQL> INSERT INTO "CONFIG_TBL_ISSUE"
  2  VALUES
  3  (XMLTYPE(
  4   '<?xml version="1.0" encoding="UTF-8"?>
  5   <ConfigRoot xsi:schemaLocation="ConfigRoot Issue.xsd" xmlns="ConfigRoot" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  6   <element1 id="1">01-11-11</element1>
  7   <element2>02-11-111</element2>
  8   </ConfigRoot>
  9  '));
INSERT INTO "CONFIG_TBL_ISSUE"
ERROR at line 1:
ORA-31011: XML parsing failed
ORA-19202: Error occurred in XML processing
LSX-00333: literal "02-11-111" is not valid with respect to the patternIt looks like if, if I interpret the XML schema correctly, that it doesn't comply to the extension "myStringType" of the restriction base "MyType". I am not absolutely sure if this is correct behavior or not, because of the nesting. If it should comply to the extend and therefore also should comply to the restriction pattern then this would mean that you discovered a bug.
If it is a bug or not, I think you should create a service request for this, asking Oracle Support for help.
Grz
Marco

Similar Messages

  • Xml schema validation problem

    Hi All
    How to tackle this xml schema validation problem
    i am using the sample code provided by ORacle technet for xml
    schema validation in the Oracle database(817).
    The sample code works perfectly fine.
    Sample as provided by http://otn.oracle.com/tech/xml/xdk_sample/archive/xdksample_093001.zip.
    It works fine for normal xml files validated against
    xml schema (xsd)
    but in this case my validation is failing . Can you let me know why
    I have this main schema
    Comany.xsd
    ===========
    <?xml version="1.0"?>
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    targetNamespace="http://www.company.org"
    xmlns="http://www.company.org"
    elementFormDefault="qualified">
    <xsd:include schemaLocation="Person.xsd"/>
    <xsd:include schemaLocation="Product.xsd"/>
    <xsd:element name="Company">
    <xsd:complexType>
    <xsd:sequence>
    <xsd:element name="Person" type="PersonType" maxOccurs="unbounded"/>
    <xsd:element name="Product" type="ProductType" maxOccurs="unbounded"/>
    </xsd:sequence>
    </xsd:complexType>
    </xsd:element>
    </xsd:schema>
    ================
    which includes the following 2 schemas
    Product.xsd
    ============
    <?xml version="1.0"?>
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    elementFormDefault="qualified">
    <xsd:complexType name="ProductType">
    <xsd:sequence>
    <xsd:element name="Type" type="xsd:string"/>
    </xsd:sequence>
    </xsd:complexType>
    </xsd:schema>
    ==============
    Person.xsd
    ===========
    <?xml version="1.0"?>
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    elementFormDefault="qualified">
    <xsd:complexType name="PersonType">
    <xsd:sequence>
    <xsd:element name="Name" type="xsd:string"/>
    <xsd:element name="SSN" type="xsd:string"/>
    </xsd:sequence>
    </xsd:complexType>
    </xsd:schema>
    =================
    now when i try to validate a xml file against Company.xsd
    it throws an error saying unable to find Person.xsd.
    no protocol error
    Now where do i place these 2 schemas(.xsd files) Person & product
    so that the java schemavalidation program running inside Oracle
    database can locate these files
    Rgrds
    Sushant

    Hi Jinyu
    This is the java code loaded in the database using loadjava called by a wrapper oracle stored procedure
    import oracle.xml.parser.schema.*;
    import oracle.xml.parser.v2.*;
    import java.net.*;
    import java.io.*;
    import org.w3c.dom.*;
    import java.util.*;
    import oracle.sql.CHAR;
    import java.sql.SQLException;
    public class SchemaUtil
    public static String validation(CHAR xml, CHAR xsd)
    throws Exception
    //Build Schema Object
    XSDBuilder builder = new XSDBuilder();
    byte [] docbytes = xsd.getBytes();
    ByteArrayInputStream in = new ByteArrayInputStream(docbytes);
    XMLSchema schemadoc = (XMLSchema)builder.build(in,null);
    //Parse the input XML document with Schema Validation
    docbytes = xml.getBytes();
    in = new ByteArrayInputStream(docbytes);
    DOMParser dp = new DOMParser();
    // Set Schema Object for Validation
    dp.setXMLSchema(schemadoc);
    dp.setValidationMode(XMLParser.SCHEMA_VALIDATION);
    dp.setPreserveWhitespace (true);
    StringWriter sw = new StringWriter();
    dp.setErrorStream (new PrintWriter(sw));
    try
    dp.parse (in);
    sw.write("The input XML parsed without errors.\n");
    catch (XMLParseException pe)
    sw.write("Parser Exception: " + pe.getMessage());
    catch (Exception e)
    sw.write("NonParserException: " + e.getMessage());
    return sw.toString();
    This is the code i used initially for validating a xml file against single xml schema (.xsd) file
    In the above code could u tell how to specify the second schema validation code for the incoming xml.
    say i create another Schemadoc for the 2nd xml schema.
    something like this with another parameter(CHAR xsd1) passing to the method
    byte [] docbytes1 = xsd1.getBytes();
    ByteArrayInputStream in1 = new ByteArrayInputStream(docbytes1);
    XMLSchema schemadoc1 = (XMLSchema)builder.build(in1,null);
    DOMParser dp = new DOMParser();
    How to set for the 2nd xml schema validation in the above code or can i combine 2 xml schemas.
    How to go about it
    Rgrds
    Sushant

  • Problem with Oracle 11g(32 bit) installation on windows 7 ultimate edition

    Hello all,
    I have a problem with Oracle 11g(32 bit) installation on windows 7 ultimate edition (32 bit).
    I have successfully installed it immediately after OS installation. But today, i have decided to deinstall it and go for Oracle 10g version for 32 bit.
    Everything went normal during installation, but i can see the services is not present in services.msc. Also its throwing some exception for dbca, netca
    Now i tried to deinstall it and again go for 11g. But even the same story here..
    Can anybody give me a solution for this..
    -Regards
    Rajesh Menon

    Saqib Alam wrote:
    i recently install Oracle 11g R1 on windows 7 ultimate, i installed it and working perfectly.
    ur problem is that u install latest version and now u trying to installing old version.
    now u need to uninstall 10g and delete oracle from services, if the probleme presist then u should
    install fresh windows 7.
    Regards
    SaqibNo need to install a fresh OS. That's like tearing your house down just because you wired a lamp wrong and blew a circuit breaker.
    There are MeaLink notes on how to eradicate an Oracle install from Windows, but it boils down to this:
    Stop all Oracle services
    In the registery:
    - Delete all oracle services from the register (HKLM\SYSTEM\CurrentControlSet
    - Delete the entire Oralce folder from HKLM\Software
    reboot
    Delete the ORACLE_HOME directory and any other Oracle related directories/files. Offhand, it seems like there is an Oracle directory under Program Files.
    reboot

  • Uninstallation problem in oracle 11g

    i have uninstall ed oracle 11g from my computer but still the folder app exists when i delete the folder it is giving me message that cannot delete oci.dll file
    Access Denied Make sure disk is not full, or write - protected and that file is not currently in use
    iam not understanding what is actually happening
    please somebody help

    uninstallation problem in oracle 11g
    Please refrain from posting in multiple forums like this. It's tantamount to abuse of the forums.
    Please mark this thread as answered and continue on in your other thread, where this question belongs.

  • Tns problem with Oracle 11g ODAC 11.1.0.6.21 with Oracle Developer Tools

    I installed the full
    Oracle 11g ODAC 11.1.0.6.21 with Oracle Developer Tools for Visual Studio
    now I am at the good old "[ORA-12154: TNS:could not resolve the connect identifier specified]" error.
    I copied the same tnsnames.ora as used on the db server
    onto the client "C:\Oracle\product\11.1.0\client_2\Network\Admin".
    The host name is right since a normal ping works. TNSping is not available.
    but I get the [ORA-12154: TNS:could not resolve the connect identifier specified] error.
    The listener is running and the instance as well since it all works on the source server.
    I tried it with
    SET path=c:\oracle\product\11.1.0\client_2\bin
    but tnsping is still not recognized.
    sqlplus works on the other hand when I set it to
    SET path=c:\oracle\product\11.1.0\client_2\
    what is going on...

    hey
    u can post your query here, and i think everyone here is to share opinion so do not hesitate to do so and please try to google before posting here,
    and we know no one is expert like some people saying 'boring questions' you just try to overcome your problem and you will definitly get your problem solved .
    some mpeople ar still there who answeres hopeless questions and say nothing about them but when a fresher askin a qustion is not tolarated by them they think everyone is born DBA here
    they always tend to discouraging people here on forums,and i think they are vvolunteers to reduce crowd here on forums, inspite of there experience and people respect them they can not control their anger
    so please post you tns here, i think there are ways to ask people to google and search docs first, but not like this
    thanks and regards
    VD
    Edited by: vikrant dixit on Jun 29, 2009 4:33 AM

  • How to generate TPC-E schema/data sets in Oracle 11g

    Hi,
    I want to use TPC-E schema in my Oracle 11g database (Standard) and also want to use DATA SETS from this benchmark for some kind of testing.
    I've download EGen v1.8.0 from this TPC website:
    http://www.tpc.org/tpce/default.asp
    but don't know who to implement this benchmark database into my computer's database. I'll appreciate if someone please suggest me how to do this...
    Thanks alot.
    Best Regards,
    Kamran

    kamran safdar malik wrote:
    I want to find Optimal size of a data block size as this is the one parameter which can increase the performance of a database or decrease it.If there is a single optimal size, that would surely be the default Oracle block size - as Oracle should know perhaps better than any of us, just what block size differences do as it is their code that uses it?
    Can I ask why you said that you would not have chosen this topic as a thesis?My leaning has always been to expert systems and A.I. Even designed and written my own expert system language years ago. One thing that is critical in such systems is how you structure data - and that has a nice database angle to it. One that I believe can still be exploited for research purposes.
    Don't you think that it'll benefit DBA's or database developer after I reach a successful conclusion?To be honest, in the real world of database systems, the least of my concerns are data block sizes. For example, we're busy putting together a storage array that should have a maximum I/O pipe size of 40Gb. In comparison, we currently use dual 2Gb fibre channels on most of our servers for our I/O.
    Technology moves fast. And perhaps there is an ideal block size for the standard storage array and Oracle instance today - but that could invalidated by new technology next year. Would I want to spend time and effort studying and analysing and researching a very specific technical subject, that perhaps is not considered as of that critical importance by DBAs and perhaps can be outdated with new technology and techniques?
    I honestly do not want to put you off studying db block sizes. Perhaps there's still some critical issues to uncover in that respect. But personally.. there are many other subject areas in database technology that peak my interest a lot more. But then you have your personal preferences and likes and dislikes - and data blocks could be your muse. :-)

  • Potentialy serious problem with Oracle 11g R1

    Today i have download to try Oracle 11g , my system supports database system
    requirerments and into installation progress my antivirus software find some troyan horses and my antivirus software is ordinary not powerfull .Do someone have the same problem?

    Yes, Trojan found in ott.exe. I believe this may be a false alarm because of its filename, which is the name of a known malware. Only some antivirus detected it.
    Since it's just one file, use whatever your antivirus has for isolating it, or just delete it.

  • Problem regarding oracle 11g

    sir/mam
    i am facing a problem in installing the oracle 11g.. after installing the software. when i am going on command prompt then it is asking for user name and password. after then it is showing that connected to oracle. then when i am clicking on the desktop icon get started with oracle database 11g, it is opening a web page. i am not getting what to do after that..?????
    sir/mam please give me some advice.. its very urgent.
    thanks a lot..

    Hi,
    Reading Database Express Edition Getting Started Guide might help
    http://docs.oracle.com/cd/E17781_01/admin.112/e18585/toc.htm
    Regards,
    Jari
    My Blog: http://dbswh.webhop.net/htmldb/f?p=BLOG:HOME:0
    Twitter: http://www.twitter.com/jariolai

  • Problem Installing Oracle 11g. Please Help!

    Hello All,
    I need to install Oracle 11g Release 2  database on my machine:
    Windows 7 Enterprise
    64 bit Operating System
    Service Pack 1
    I ran into problems right before  I reach the Installation Options Screen
    The error message is:
    Unable to establish a network connection to proxy server. Specify the correct proxy details.
    I have tried entering the correct Proxy server information but it gives me the same error.
    Please Help
    Thanks

    HI,
    If you are not using proxy or if you want to continue without connecting to internet, you can just continue without providing these details
    Regards
    Yoonas

  • Problem Installing oracle 11g in Fedora 8

    Hi,
    I am trying to install oracle 11g in Fedore 8. The problem I am facing is that it is not starting the universal oracle installer. It is giving that DISPLAY is not set properly. I tried to do the following:
    DISPLAY=<machine-name>.0.0;export DISPLAY
    but it is not working.
    Can any one advise regarding installing 11g in linux.
    Thanks,
    Mahboob

    Details! What is the exact message, if any, that you get?

  • Date problem in oracle 11g

    iam New to oracle 11g but familiar with SQL 2005
    i have a table Patient which has a column Date_Of_Birth has datatype Date
    and iam writing a query in which if Date_Of_Birth column has a value
    *01/01/1900* then i should be replaced by *' ' or balnk*
    otherwise show date value for that i have made use of
    case
    query
    select case(Date_Of_Birth)-------------this is my column
    when '01/01/1900'
    then ''
    ELSE TO_CHAR( Patient.Date_Of_Birth, 'DD/MM/YYYY')
    END Date_Of_Birth
    from Patient -------------my table
    but error is comming
    Error starting at line 1 in command:
    select case(Date_Of_Birth)
    when '01/01/1900'
    then ''
    ELSE TO_CHAR( Patient.Date_Of_Birth, 'DD/MM/YYYY')
    END Date_Of_Birth
    from Patient
    Error at Command Line:2 Column:5
    Error report:
    SQL Error: ORA-00932: inconsistent datatypes: expected DATE got CHAR
    00932. 00000 - "inconsistent datatypes: expected %s got %s"
    *Cause:   
    *Action:
    Edited by: user13066438 on Jan 24, 2011 9:38 PM

    Hi there
    you have date data type in Date_Of_Birth you have to use to_date function
    try this
    select case((Date_Of_Birth)when to_date('01/01/1900', 'DD/MM/YYYY')
    then ''
    ELSE TO_CHAR(Patient.Date_Of_Birth, 'DD/MM/YYYY')
    END Date_Of_Birth
    from table_name;regards
    Hitesh

  • Sort Order problem in Oracle 11g

    Hi,
    While executing the below query in 10g and 11g, I got different results.
    SELECT loan.Ins_Id,
    ARev.revision,
    ADet.Acc_Id,
    loan.Loan_Id
    FROM
    Account_Det ADet
    join Acc_REV ARev
    on ADet.Acc_Id = ARev.Acc_Id
    join LoanAcc loan
    on loan.Loan_Id = ARev.Loan_Id
    join Interest_Det Ins
    on Ins.Ins_Id = loan.Ins_Id
    where Ins.Ins_Id in ('691','707')
    and ARev.revision=
    (select max(revision) from Acc_REV where Loan_Id =
    (select max(Loan_Id) from LoanAcc where Ins_Id =Ins.Ins_Id
    ) AND ADet.Acc_Id = '312'
    ORDER BY TO_NUMBER(ARev.revision) ASC;
    Result in Oracle 11g
    INS_ID  REVISION  Acc_ID   Loan_Id
    707      2      312    238
    691      1      312    234
    Result in Oracle 10g
    INS_ID  REVISION  Acc_ID   Loan_Id
    691      1      312    234
    707      2      312    238
    The order in both the cases were different.The order in 11g was not in ascending order.Though the data in both the databases
    is same. Could anyone please tell me why is this happening?. Is there any diffeence in the architecure of ORDER BY (sort) in
    10g and 11g. If I modify the above query by avoiding the subquery I get the correct result(i.e in ascending order).
    SELECT loan.Ins_Id,
    ADet.Acc_Id,
    loan.Loan_Id
    FROM
    Account_Det ADet
    join Acc_REV ARev
    on ADet.Acc_Id = ARev.Acc_Id
    join LoanAcc loan
    on loan.Loan_Id = ARev.Loan_Id
    join Interest_Det Ins
    on Ins.Ins_Id = loan.Ins_Id
    where Ins.Ins_Id in ('691','707')
    and ARev.revision in ('100','101')
    AND ADet.Acc_Id = '312'
    ORDER BY TO_NUMBER(ARev.revision) ASC;
    Edited by: KZON on Apr 7, 2011 4:46 AM

    Hi all,
    I have modified the query by giving To_Number(ARev.revision) before sub query. Now Oracle 11g returns results in ascending order. But 10g returns results in ascending order with out using To_Number()
    NOte:- Type of ARev.revision is VARCHAR
    SELECT loan.Ins_Id,
    ARev.revision,
    ADet.Acc_Id,
    loan.Loan_Id
    FROM
    Account_Det ADet
    join Acc_REV ARev
    on ADet.Acc_Id = ARev.Acc_Id
    join LoanAcc loan
    on loan.Loan_Id = ARev.Loan_Id
    join Interest_Det Ins
    on Ins.Ins_Id = loan.Ins_Id
    where Ins.Ins_Id in ('691','707')
    and To_Number(ARev.revision)=
    (select max(revision) from Acc_REV where Loan_Id =
    (select max(Loan_Id) from LoanAcc where Ins_Id =Ins.Ins_Id
    ) AND ADet.Acc_Id = '312'
    ORDER BY TO_NUMBER(ARev.revision) ASC;
    Result
    INS_ID  REVISION  Acc_ID   Loan_Id
    691      1      312    234
    707      2      312    238
    Is there any difference in ORDER BY clause in Oracle11g and 10g ?
    Edited by: KZON on Apr 7, 2011 4:45 AM

  • Problems with Oracle 11g XE R2

    Hi guys,
    I've got a problem and try'n to solve it for abt a week now and tried many solutions.
    My enviroment:
    Windows 7 Professional SP 1 64-Bit
    AMD Phenom II x4 940 @3.0 GH
    4 GB RAM (In Usage while installing 40%)
    Windows-Firewall is activated (but oracle.exe and lstnr.exe are configured as exception)
    avast! Free Antivirus Version 2014.9.0.2018
    Installation (both times with same outcome):
    Installed O 11g XE 64-Bit in two different ways:
    User I was logged in with is in Admingroup
    Started installation via rightclick with administrationprivileges
    I activated the administrators account and logged in with adminprivileges.
    After that I've installed the 11g XE 64 bit
    between both steps I cleaned everything up and restarted my system, registry was empty too and folder was deleted manually
    at first I get this problem: Windows cannot find "http://127.0.0.1:%HTTPPORT%/apex/f?p=4950"
    -> Manually changing %HTTPORT% to 8080
    --> now I could doubleclick the shortcut, Firefox/IE/Chrome opens but 404 not Found-Error is returned
    - OracleServiceXE, XracleXETNListener both are running
    [code]
    C:\Windows\system32>lsnrctl status
    LSNRCTL for 64-bit Windows: Version 11.2.0.2.0 - Production on 04-NOV-2014 18:02
    :56
    Copyright (c) 1991, 2014, Oracle.  All rights reserved.
    Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
    TNS-12541: TNS:no listener
    TNS-12560: TNS:protocol adapter error
      TNS-00511: No listener
       64-bit Windows Error: 2: No such file or directory
    Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=D³rsinKurt-PC)(PORT=1521
    STATUS of the LISTENER
    Alias                     LISTENER
    Version                   TNSLSNR for 64-bit Windows: Version 11.2.0.2.0 - Produ
    ction
    Start Date                04-NOV-2014 13:53:50
    Uptime                    0 days 4 hr. 9 min. 9 sec
    Trace Level               off
    Security                  ON: Local OS Authentication
    SNMP                      OFF
    Listener Log File         C:\oraclexe\app\oracle\diag\tnslsnr\D³rsinKurt-PC\list
    ener\alert\log.xml
    Listening Endpoints Summary...
      (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=D³rsinKurt-PC)(PORT=1521)))
    The listener supports no services
    The command completed successfully
    [/code]
    so Listenerservice is up and running but I cant find the http 8080-Service with netstat -a
    so I started investigating a bit more:
    Registryfolder: HK_LOCAL_MACHINE\SOFTWARE\ORACLE is installed
    following subdirectories are installed: KEY_XE, ODP.NET, OracleMTSRecoveryService
    What I tried (both ways, starting with and without adminstrationprivileges):
    I created two new DWORD-Values in KEY_XE ORACLE_SID_AUTOSTART and -SHUTDOWN both with the value True and stopped and started the services, nothing changes.
    Inserted both users (Administrator and normal User) in ORA_DBA-Group, nothing changes, even tried to turn it off and on again
    wanted to connect to sqlplus via console:
    C:\Windows\system32>sqlplus system
    SQL*Plus: Release 11.2.0.2.0 Production on Di Nov 4 18:09:21 2014
    Copyright (c) 1982, 2014, Oracle.  All rights reserved.
    Enter password:
    ERROR:
    ORA-01034: ORACLE not available
    ORA-27101: shared memory realm does not exist
    Process ID: 0
    Session ID: 0 Serial number: 0
    Enter user-name:
    when I start the sqlplus-prompt directly and write the command startup I get the following msg: ORA-01031: insufficient privileges
    I looked into the ORA_BASE-Folder and looked at the oradat folder, it contains a XE-Folder which is empty, the admin-folder contains: XE/ and adump, dpdump and pfile, all three are empty (what does this mean? No DB at all created?)
    I watched the ORA_HOME-Folder and found initXE.ora, oradba.exe, oradim and PWDXE.ora
    I looked into the oradim.txt-Log:
    Tue Nov 04 11:21:17 2014
    C:\oraclexe\app\oracle\product\11.2.0\server\bin\oradim.exe -shutdown -sid xe -usrpwd * -shutmode immediate -log oradim.log
    Tue Nov 04 11:21:55 2014
    ORA-01012: not logged on
    Tue Nov 04 11:23:01 2014
    C:\oraclexe\app\oracle\product\11.2.0\server\bin\oradim.exe -startup -sid xe -usrpwd *  -log oradim.log -nocheck 0
    Tue Nov 04 11:23:38 2014
    ORA-01078: failure in processing system parameters
    ORA-01565: error in identifying file 'C:\oraclexe\app\oracle\product\11.2.0\server\dbs/spfileXE.ora'
    ORA-27041: unable to open file
    OSD-04002: unable to open file
    O/S-Error: (OS 2) Das System kann die angegebene Datei nicht finden.
    --> bingo, 1st Issue: there is no spfileXE.ora, how can I create this? plus in the dbs-folder there is only a init.ora and no initXE.ora?
    Looked into the log-Folder 5 files starting with clscX.txt (probably after every systemreboot? containing the following:
    Oracle Database 11g Clusterware Release 11.2.0.2.0 - Production Copyright 1996, 2010 Oracle. All rights reserved.
    2014-11-04 13:53:52.197: [ default][5576]ut_read_reg:2:ocr registry key SOFTWARE\Oracle\olr cannot be opened. error 2
    [    CLSE][5576]clse_get_crs_home: Error retrieving OLR configuration [0] [Error opening olr registry key. The system couldn't find the file.
    -> Systemlanguage is german, so I've translated the german parts, maybe there was smth lost in translation
    --> 2nd Issue: Is there any regkey missing?
    further I watched the folder ORACLE_HOME /server/config/home cloesly:
    cloneDBCreation:
    SQL> Create controlfile reuse set database "XE"
      2  MAXINSTANCES 8
      3  MAXLOGHISTORY 1
      4  MAXLOGFILES 16
      5  MAXLOGMEMBERS 3
      6  MAXDATAFILES 100
      7  Datafile
      8  'C:\oraclexe\app\oracle\oradata\XE\system.dbf',
      9  'C:\oraclexe\app\oracle\oradata\XE\undotbs1.dbf',
    10  'C:\oraclexe\app\oracle\oradata\XE\sysaux.dbf',
    11  'C:\oraclexe\app\oracle\oradata\XE\users.dbf'
    12  LOGFILE
    13  GROUP 1 SIZE 51200K,
    14  GROUP 2 SIZE 51200K,
    15  RESETLOGS;
    SP2-0640: Not connected
    SQL> exec dbms_backup_restore.zerodbid(0);
    SP2-0640: Not connected
    SP2-0641: "EXECUTE" requires connection to server
    SQL> shutdown immediate;
    ORA-01012: not logged on
    SQL> startup nomount pfile="C:\oraclexe\app\oracle\product\11.2.0\server\config\scripts\initXETemp.ora";
    ORA-01031: insufficient privileges
    CloneRmanRestore:
    SQL> startup nomount pfile="C:\oraclexe\app\oracle\product\11.2.0\server\config\scripts\init.ora";
    ORA-01031: insufficient privileges
    SQL> @C:\oraclexe\app\oracle\product\11.2.0\server\config\scripts\rmanRestoreDatafiles.sql;
    SQL> set echo off;
    SP2-0640: Not connected
    SP2-0640: Not connected
    SP2-0640: Not connected
    ERROR:
    ORA-01031: insufficient privileges
    SQL> spool C:\oraclexe\app\oracle\product\11.2.0\server\config\log\cloneDBCreation.log
    PostDBCreation:
    QL> connect "SYS"/"********" as SYSDBA
    ERROR:
    ORA-01031: insufficient privileges
    SQL> set echo on
    SQL> //create or replace directory DB_BACKUPS as 'C:\oraclexe\app\oracle\fast_recovery_area';
    SP2-0103: Nothing in SQL buffer to run.
    SQL> begin
      2      dbms_xdb.sethttpport('8080');
      3      dbms_xdb.setftpport('0');
      4  end;
      5  /
    SP2-0640: Not connected
    SQL> create spfile='C:\oraclexe\app\oracle\product\11.2.0\server\dbs/spfileXE.ora' FROM pfile='C:\oraclexe\app\oracle\product\11.2.0\server\config\scripts\init.ora';
    SP2-0640: Not connected
    SQL> shutdown immediate;
    ORA-01012: not logged on
    SQL> connect "SYS"/"&&sysPassword" as SYSDBA
    ERROR:
    ORA-01031: insufficient privileges
    SQL> @C:\oraclexe\app\oracle\product\11.2.0\server\rdbms\admin\dbmssml.sql;
    SP2-0310: unable to open file "C:\oraclexe\app\oracle\product\11.2.0\server\rdbms\admin\dbmssml.sql"
    SQL> @C:\oraclexe\app\oracle\product\11.2.0\server\rdbms\admin\dbmsclr.plb;
    SQL> DROP PUBLIC DATABASE LINK DBMS_CLRDBLINK;
    SP2-0640: Not connected
    SQL> CREATE PUBLIC DATABASE LINK DBMS_CLRDBLINK USING 'ORACLR_CONNECTION_DATA';
    SP2-0640: Not connected
    SQL> CREATE OR REPLACE LIBRARY ORACLECLR_LIB wrapped
      2  a000000
      3  1
      4  abcd
      5  abcd
      6  abcd
      7  abcd
      8  abcd
      9  abcd
    10  abcd
    11  abcd
    12  abcd
    13  abcd
    14  abcd
    15  abcd
    16  abcd
    17  abcd
    18  abcd
    19  16
    20  51 8d
    21  L/XXXXXXXXXX...
    22  XXXXXXX...
    23 
    24  /
    SP2-0640: Not connected
    SQL> DROP TYPE DBMS_CLRParamTable;
    SP2-0640: Not connected
    SQL> DROP TYPE DBMS_CLRType;
    SP2-0640: Not connected
    SQL> CREATE OR REPLACE TYPE DBMS_CLRType wrapped
    XE :
    Instance created.
    So hopefully thats enough Information
    thank you in advance
    Dürsin Kurt

    OK guys I've found it out:
    Problem was, the XE.bat-Script couldn't add me to the ORA_DBA-Group.
    Reason: my Computername and my username, both had a vowel mutation "ü".
    Reason it didn't work at my business-laptop too, both have my "Ü" in the username
    solved!

  • Schema validation problem

    I am validating an XML document using an XML Schema.
    I tested my valadation program out on my computer (Window 2000) and everything seem to be going well.
    When i deploy my application (stand-alone) onto another desktop (through Terminal Service...I receive the following error message:
    SAXException: cvc-elt.1: Cannot find the declaration of element 'Book'.
    I also display the xml string to see what's wrong with th exml string....but couldn't find anything.:
    <Book><Title>Hello World</Title><AUTHOR>Anom.</AUTHOR></Book>
    The error states that the xml document does not start with (or does not contains th e) Book element..which it does. I'm confused at what could have cause this error message. Since this error cannot be reproduce at my computer.

    fixed the problem. i should have listen to you in the first place.
    the schema file was not found on the other machine..there was some relative path issues (where the application was started [working directory]). apparently..the application started in a different directory..so th epath relative to the current directory is different than the where i start the app on my computer.

  • Register XML schema using dbms_xmlschema in Oracle 11g

    I have a xsd file located at C:\temp\test.xsd
    I need to register this schema to create a XMLType table for Object Relational XML Storage.
    How do I register the schema for relational storage?
    I do not seem to find any example on internet for registering the schema for relational storage.
    Any help would be highly appreciated.

    Thanks for help. The table is created now. But it created a CLOB table whereas I want a relational table with rows and columns. Is it because the schema was registered with SCHEMADOC as bfilename? How do I get the relational storage?
    BEGIN
       DBMS_XMLSCHEMA.registerSchema(
        SCHEMAURL=> 'TESTDEPT.XSD',
        SCHEMADOC=> bfilename('XML_DIR','TESTDEPT.XSD'),
        LOCAL=> TRUE,
        GENTYPES=> TRUE,
        GENTABLES=> FALSE,
        CSID=> nls_charset_id('AL32UTF8'));
    END;
    CREATE TABLE TESTDEPT OF XMLType
      XMLTYPE store AS OBJECT RELATIONAL
      XMLSCHEMA "TESTDEPT.XSD" ELEMENT "root";
    desc TESTDEPT;
      Name                           Null     Type                                                                                                                                                                                         
    SYS_NC_ROWINFO$                         XMLTYPE()        
    SELECT dbms_metadata.get_ddl('TABLE','TESTDEPT') from dual;
      DBMS_METADATA.GET_DDL('TABLE','TESTDEPT')                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       
    ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------(CLOB)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
      CREATE TABLE "DMUSER"."TESTDEPT" OF XMLTYPE                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   
      XMLSCHEMA "TESTDEPT.XSD" ELEMENT "root" ID 4090 PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              
      STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         
      PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 
      TABLESPACE "USERS" 
    My database version:
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production    
    PL/SQL Release 11.2.0.1.0 - Production                                          
    CORE 11.2.0.1.0 Production                                                        
    TNS for 64-bit Windows: Version 11.2.0.1.0 - Production                         
    NLSRTL Version 11.2.0.1.0 - Production

Maybe you are looking for

  • Web Service (SOAP) From Oracle Forms

    From the exaples of calling web services (soap) from pl/sql, it seems very poor and troublesome. I've seen a few articles with good points about why not to do this from pl/sql. So, I was hoping someone in the forums could share their opinions and app

  • Error facing while printing a hard text in a form ...

    hi i am facing a error while debugging a f orm the text is not being printed for second page onwards as shown below the first char 3pl comes whille debugging and then the window goes to next as shown below and dont cmplete the remaining text and neit

  • OIM 9.1.0.1 Approval Workflow Selection

    Hello, I need some help on how to configure process determination rules for OIM 9.1.0.1 I have an object form and two approval processes (one requires only one approval and the second one requires two approvals). I would like to be able to decide at

  • Changing the 'system' password, and now the service is denied to start??? (WLS 6.0)

    I have been looking for awhile,.. and I haven't found this one yet.. I reinstalled weblogic.. (for reasons unmentionable, like deleting things accidentally, etc.. ) I had the chance to specify a new system password. After realizing that it likes to s

  • How to get iTunes to recognize iPod

    My iPod shows up in windows but not in iTunes. How can i get my iPod to show up in iTunes?