Unexpected table created after schema registration

I registered the following xsd. Even though I did not specify any tables to be created, I see a table in "user_xml_tables". Could someone explain what's going on? Thank you.
1. This is the xsd file.
<xsd:schema version="1.0" xdb:storeVarrayAsTable="false" xdb:mapUnboundedStringToLob="false" xmlns:xdb="http://xmlns.oracle.com/xdb" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:complexType name="val_type">
<xsd:sequence>
<xsd:element name="e1" type="xsd:integer" />
<xsd:element name="e2" type="xsd:integer" />
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="coll5_type" xdb:SQLType="coll5_sqltype">
<xsd:sequence >
<xsd:element name="val" type="val_type" maxOccurs="200"
xdb:SQLInline="false"/>
<xsd:element name="val2" type="xsd:integer" xdb:SQLType=
"INTEGER" />
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
2.Register the schema
BEGIN
DBMS_XMLSCHEMA.registerSchema(
SCHEMAURL => 'http://oracle.com/xdb/coll2.xsd',
SCHEMADOC => bfilename('TICKERDIR','coll2.xsd'),
LOCAL =>TRUE,
GENTYPES => TRUE,
GENTABLES => TRUE,
CSID => nls_charset_id('AL32UTF8'));
END;
3. ************ Why is this table created? ******************************************
SQL> select table_name from user_xml_tables;
TABLE_NAME
val777_TAB
SQL> desc "val777_TAB"
Name Null? Type
TABLE of SYS.XMLTYPE(XMLSchema "http://bloomberg.com/xdb/coll2.xsd" Element "val") STORAGE Object-relational TYPE "val_type776_T"
SQL> desc "val_type776_T"
"val_type776_T" is NOT FINAL
Name Null? Type
SYS_XDBPD$ XDB.XDB$RAW_LIST_T
e1 NUMBER(38)
e2 NUMBER(38)

I do not think this is because GENTABLES=> TRUE is set.
1. Note that for the posted schema, a table is created only for coll5_type, but not val_type.
2. I modifed the schema as follows (see below): Its the same as the original except that we have two additional complex types, we still have ONE table that is generated. We should expect THREE tables to be generated if the expected behaviour of GENTABLES=> TRUE is to create tables for every complexType.
3. If you remove coll5_type from the modified schema, there are NO tables generated.
Conclusion: the table is generated only if the complexType has a collection with SQLInline="false" : i.e. we require a varray of REF storage.
What's the reason for this behaviour?
1. Here's the modified xsd:
This schema has:
a) has 3 complex types defined
b). no global elements (tables are supposed to be generated only for global elements)
3. no tables have been specified in the xsd.
<?xml version="1.0" encoding="windows-1252"?>
<xsd:schema version="1.0" xdb:storeVarrayAsTable="false" xdb:mapUnboundedStringT
oLob="false" xmlns:xdb="http://xmlns.oracle.com/xdb" xmlns:xsd="http://www.w3.or
g/2001/XMLSchema">
<xsd:complexType name="val_type">
<xsd:sequence>
<xsd:element name="e1" type="xsd:integer" />
<xsd:element name="e2" type="xsd:integer" />
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="coll3_type" xdb:SQLType="coll3_sqltype">
<xsd:sequence >
<xsd:element name="val" type="val_type" xdb:SQLCollType=
"coll3_sqlcolltype" maxOccurs="200"/>
<xsd:element name="val2" type="xsd:integer" xdb:SQLType=
"INTEGER" />
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="coll4_type" xdb:SQLType="coll4_sqltype">
<xsd:sequence >
<xsd:element name="val" type="val_type" maxOccurs="200"
xdb:SQLCollType="CLOB" />
<xsd:element name="val2" type="xsd:integer" xdb:SQLType=
"INTEGER" />
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="coll5_type" xdb:SQLType="coll5_sqltype">
<xsd:sequence >
<xsd:element name="val" type="val_type" maxOccurs="200"
xdb:SQLInline="false"/>
<xsd:element name="val2" type="xsd:integer" xdb:SQLType=
"INTEGER" />
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
2.
BEGIN
DBMS_XMLSCHEMA.registerSchema(
SCHEMAURL => 'http://bloomberg.com/xdb/coll2.xsd',
SCHEMADOC => bfilename('TICKERDIR','coll2.xsd'),
LOCAL =>TRUE,
GENTYPES => TRUE,
GENTABLES => TRUE,
CSID => nls_charset_id('AL32UTF8'));
END;
3.
SQL> select table_name from user_xml_tables;
TABLE_NAME
val779_TAB

Similar Messages

  • How many copa tables created after creation operating concern?

    Hi gurus
    How many copa tables will be created after just creation of  OPERATING CONCERN?
    This is question being asked in interview.
    Regards
    Hari P
    Edited by: Hari Peddi on Feb 15, 2009 11:22 AM

    Hi,
    As the previous comment says, CE1XXXX, CE2XXXX, CE3XXXX and CE4XXXX are created. But this is if you are using Costing-based profitability analysis, However, if you're using account-base PA then no tables are created and CPEP, COSP, COSS and other standard CO tables are used.
    Regards,
    Kenneth

  • ORA-00600 problem when create XMLType table with registerd schema

    Hi,
    I am using Oracle9i Enterprise Edition Release 9.2.0.4.0 on RedHat Linux 7.2
    I found a problem when I create table with registered schema with follow content:
         <xs:element name="body">
              <xs:complexType>
                   <xs:sequence>
                   </xs:sequence>
                   <xs:attribute name="id" type="xs:ID"/>
                   <xs:attribute name="class" type="xs:NMTOKENS"/>
                   <xs:attribute name="style" type="xs:string"/>
              </xs:complexType>
         </xs:element>
         <xs:element name="body.content">
              <xs:complexType>
                   <xs:choice minOccurs="0" maxOccurs="unbounded">
                        <xs:element ref="p"/>
                        <xs:element ref="hl2"/>
                        <xs:element ref="nitf-table"/>
                        <xs:element ref="ol"/>
                   </xs:choice>
                   <xs:attribute name="id" type="xs:ID"/>
              </xs:complexType>
         </xs:element>
    Does Oracle not support element reference to other element with dot?
    For instance, body -> body.content
    Thanks for your attention.

    Sorry, amendment on the schema
         <xs:element name="body">
              <xs:complexType>
                   <xs:sequence>
                        <xs:element ref="body.head" minOccurs="0"/>
                        <xs:element ref="body.content" minOccurs="0" maxOccurs="unbounded"/>
                        <xs:element ref="body.end" minOccurs="0"/>
                   </xs:sequence>
                   <xs:attribute name="id" type="xs:ID"/>
                   <xs:attribute name="class" type="xs:NMTOKENS"/>
                   <xs:attribute name="style" type="xs:string"/>
              </xs:complexType>
         </xs:element>

  • Management Studio 2008 does not refresh after table create / alter

    hello
    Management Studio 2008 does not refresh after table create / alter, why?
    f5 / refresh button does not work in "Object Explorer".... i always need the restart the whole application to see any changes, this is strange...
    regards, jan

    Hi jm,
    I’m writing to follow up with you on this post. Was the problem resolved after performing Vishal ‘s steps? If you are satisfied with our solution, I’d like to mark this issue as "Answered". Please also feel free to unmark the issue, with any new findings
    or concerns you may have.
    Thanks,
    Sofiya Li
    Sofiya Li
    TechNet Community Support

  • Trouble Creating View on External Table in Diff Schema

    I am unable to create a view in a different schema on an external table in a different schema, even when I am connected to my database as SYS as SYSDBA.
    CREATE VIEW WH1.EXT1VIEW AS SELECT * FROM WH1.EXT1VIEW;
    returns the error:
    ORA-06564: object ER_ADMIN_DIR does not exist
    I created a directory:
    CREATE DIRECTORY ER_ADMIN_DIR AS 'C:\ER_Init';
    Granted privs:
    grant read,write on directory ER_ADMIN_DIR to public;
    Created the external table EXT1 in a different schema WH1:
    CREATE TABLE WH1.EXT1 (TABLE_NAME VARCHAR2(100), COLUMN_NAME VARCHAR2(100))
    ORGANIZATION EXTERNAL (TYPE ORACLE_LOADER DEFAULT DIRECTORY SYS.ER_ADMIN_DIR
    ACCESS PARAMETERS
    (RECORDS DELIMITED BY NEWLINE
    FIELDS TERMINATED BY ','
    MISSING FIELD VALUES ARE NULL
    LOCATION ('FILE1.TXT')
    REJECT LIMIT UNLIMITED;
    I can query from the table successfully connected as SYS:
    SQL> select count(*) from wh1.ext1;
    1008
    1 row selected.
    However when I try to create a view on that table connected as SYS:
    CREATE VIEW WH1.EXT1VIEW AS SELECT * FROM WH1.EXT1VIEW;
    I get the following error:
    ORA-06564: object ER_ADMIN_DIR does not exist
    I can connect over to the WH1 schema and create the view successfully, however due to a specific situation I need to be able to create the view from the SYS schema. I can create the view FORCE and it creates with compilation errors, however the view cannot be compiled successfully from SYS.
    Is there a known bug on creating views on external tables remotely?
    Thanks for any help!
    Tina

    I have been able to reproduce your error, using scott instead of sys, and resolve it, as demonstrated below. The combination that I found that worked consisted of having wh1 grant select on ext1 to scott explicitly and using set current_schema to wh1, so that ext1view did not require the wh1 qualifier.
    scott@ORA92> CREATE USER wh1 IDENTIFIED BY wh1
      2  /
    User created.
    scott@ORA92> GRANT CONNECT, RESOURCE TO wh1
      2  /
    Grant succeeded.
    scott@ORA92> CREATE OR REPLACE DIRECTORY er_admin_dir AS 'c:\er_init'
      2  /
    Directory created.
    scott@ORA92> CREATE TABLE wh1.ext1
      2    (table_name  VARCHAR2(100),
      3       column_name VARCHAR2(100))
      4  ORGANIZATION EXTERNAL
      5    (TYPE ORACLE_LOADER
      6       DEFAULT DIRECTORY er_admin_dir
      7       ACCESS PARAMETERS
      8         (RECORDS DELIMITED BY NEWLINE
      9          FIELDS TERMINATED BY ','
    10          MISSING FIELD VALUES ARE NULL)
    11       LOCATION ('file1.txt'))
    12  REJECT LIMIT UNLIMITED
    13  /
    Table created.
    scott@ORA92> CREATE OR REPLACE VIEW wh1.ext1view AS SELECT * FROM wh1.ext1
      2  /
    CREATE OR REPLACE VIEW wh1.ext1view AS SELECT * FROM wh1.ext1
    ERROR at line 1:
    ORA-06564: object ER_ADMIN_DIR does not exist
    scott@ORA92> CONNECT wh1/wh1
    Connected.
    scott@ORA92> @ LOGIN
    scott@ORA92> SET ECHO OFF
    GLOBAL_NAME
    [email protected]2
    wh1@ORA92> GRANT SELECT ON ext1 TO scott
      2  /
    Grant succeeded.
    wh1@ORA92> CONNECT scott/tiger
    Connected.
    wh1@ORA92> @ LOGIN
    wh1@ORA92> SET ECHO OFF
    GLOBAL_NAME
    [email protected]A92
    scott@ORA92> ALTER SESSION SET CURRENT_SCHEMA = wh1
      2  /
    Session altered.
    scott@ORA92> CREATE OR REPLACE VIEW ext1view AS SELECT * FROM wh1.ext1
      2  /
    View created.
    scott@ORA92> ALTER SESSION SET CURRENT_SCHEMA = scott
      2  /
    Session altered.
    scott@ORA92> SELECT * FROM wh1.ext1view
      2  /
    TABLE_NAME
    ---------------------------------------------------------COLUMN_NAME
    ---------------------------------------------------------tab1
    col1
    tab2
    col2
    scott@ORA92>

  • Create a View from tables of different schemas

    hi all,
    can u pls give solution to create a View from tables of different schemas.
    i have to bring data from one DB Server A,
    which contains different schemas and tables in the schemas...
    i need to insert that data in another DBServer B.
    i made a procedure for this...
    but when the connection fails from A, then i could not get data...
    please suggest some solution..
    thanks,
    neelima

    I don't know what database system you use, but in the most I know it is done that way:
    SELECT
    A.COL1,A.COL2.....
    FROM
    SCHEMA_NAME.TABLENAME A,
    SCHEMA_NAME.TABLE_NAME B
    WHERE
    A.COL1 = B.COL2
    ...

  • Create user/schema is script, then tables for that user/schema

    Hi;
    First off, if I phrase this a little wrong - I'm from the Sql Server world and still trying to totally understand Oracle.
    I have a schema (.sql file) that creates my database fine. But what I would liek to add to the .sql schema is for it to create a user and then place all the tables, indexes, sequences, and triggers in as belonging to that created user.
    This way we can tell people to log in as sysop and run the script to create the schema rather than create the user, log in as the user, then run the script.
    What do I need to add?
    thanks - dave

    Hi;
    I have tried:
    CREATE USER DAVE IDENTIFIED BY password;
    CONNECT DAVE/password AS SYSDBA
    I have also tried:
    CONNECT DAVE/password AS SYSTEM
    CONNECT DAVE AS SYSDBA
    CONNECT DAVE
    In all cases ApplicationExpress says it does not recognize the CONNECT command. Should I do something different? What I want to accomplish is that all subsequent commands in the script creating tables, indexes, etc are assigned to the user/schema DAVE.
    thanks - dave

  • How to create table in another schema of same database

    Hi..
    I've a database DB1
    and has 2 schemas / USers in that..
    Usr1 and Usr2...
    And i created a TEMP table in Usr1 schema... and created
    Then tried the following statement in Usr2 schema...
    CREATE TABLE TEMP AS SELECT * FROM Usr1.TEMP;
    Then it's giving error that ...
    :00942 TABLE OR VIEW DOESN'T EXIST..
    What is the reason for that...
    Thank you

    josh1612 wrote:
    What other grants do i need to give so as to replicate the Primary Keys also...????That's not a matter of grants. It's the way the CREATE TABLE AS SELECT statement works. It does not copy over indexes, primary key constraints, unique constraints, foreign key constraints, etc.
    If you want to copy all that over, you would probably want to get the DDL from the original table (using the DBMS_METADATA package if you're in a recent version), modify the DDL with the new schema name, create the table, indexes, and constraints, and then do an INSERT ... SELECT to populate the data. Or do an export & import of the table from one schema to another.
    Justin

  • BEFORE/AFTER CREATE ON SCHEMA

    All,
    I have a schema ORA and i have 60 tables and i have a audit table(stats_log)... but i have to eliminate 8 tables
    from audit (DDL,DML) operations...
    CREATE TABLE stats_log (
    operation VARCHAR2(30),
    obj_owner VARCHAR2(30),
    object_name VARCHAR2(30),
    sql_text VARCHAR2(64),
    attempt_by VARCHAR2(30),
    attempt_dt DATE);
    I have used BEFORE CREATE OR ALTER OR DROP ON SCHEMA(working fine), but the trigger action includes all the tables in the ORA Schema..
    Do i need to create individual trigger for each table?
    Regards,
    ~ORA

    Hi all,
    CREATE OR REPLACE TRIGGER ddl_log_trigger
    BEFORE CREATE
    ON SCHEMA
    DECLARE
    sql_text ora_name_list_t;
    i PLS_INTEGER;
    BEGIN
    i := ora_sql_txt(sql_text);
    IF NOT IN('EMP') THEN
    INSERT INTO stats
    SELECT sys_context('USERENV','SESSIONID'),
    sys_context('USERENV','HOST'),
    ora_sysevent,
    ora_dict_obj_owner,
    ora_dict_obj_name,
    sql_text(1),
    USER,
    SYSDATE
    FROM dual;
    END IF;
    END ddl_log_trigger;
    Warning: Trigger created with compilation errors.
    SQL> sho errors;
    Errors for TRIGGER DDL_LOG_TRIGGER:
    LINE/COL ERROR
    6/14 PLS-00103: Encountered the symbol "IN" when expecting one of the
    following:
    ( - + case mod new null <an identifier>
    <a double-quoted delimited-identifier> <a bind variable> avg
    count current exists max min prior sql stddev sum variance
    execute forall merge time timestamp interval date
    <a string literal with character set specification>
    <a number> <a single-quoted SQL string> pipe
    <an alternatively-quoted string literal with character set
    specification>
    <an alternatively-quoted SQL
    LINE/COL ERROR
    Any IDeas?

  • Create and access a table OUTSIDE SAPR3 schema

    Hi Gurus,
    Can you please help me how do I create a table outside SAPR3 schema in the same database, I have a user schema TEST in the sap database (Using SAPR3 4.6C). If any tcode does that? Or I need to use oracle sqlplus.
    HOW an ABAP progroam can access and manipulate the data available in this TEST schema?
    Reference to some SAP NOTE will be highly helpfull.
    Regards,
    Soumen.

    >
    Soumen Chattopadhyay wrote:
    > Dear Fiedel and Eric,
    Fiedel, Who?
    >
    > Thank you both for your suggestion,
    > me and my team are are checking up according to your idea....
    >
    > Actually, I do need to integrate one plant machinery equipment which has the backend database in MS SQL server and our SAP is using the backend Oracle and running on Linux.
    Very good, now we are getting more information.
    The data is NOT on the oracle database but outside.
    In this case DBCON (from DB+CONnection) can help
    >
    > As per the need of  business data need to be exchanged between these two.
    >
    > If you have may I request you to share some more information e.g. snotes on DBCO?
    >
    Very easy, follow my mantra (Top right box-Search functionality is very useful, also sap notes search)
    Lets chew this a little:
    117261     Multiconnect and DB procedure enhancements for 4.0B
    323151     Several DB connections with Native SQL
    738371     Creating DBCON multiconnect entries for SQL Server
    178949     MSSQL: Database MultiConnect with EXEC SQL
    >
    > But , why DBCON is not the right choice, Fiedel can U thow some more light?
    Lets see, in your first request you wanted to access to a different schema in the same database.
    you have the licence issues and DBCON is "overkill" (even when it can work) You would be connecting to yourself with a different usser.
    Probably it is easier to create synonyms at DB level and provide proper authorizations.
    In your second request the DBCON makes much more sense.
    You want to access to a different (external) DB. That is the reason DBCON exist.
    Now we have a little "issue". I'm not Windows/SQL expert, but, in order to connect to an external DB you need the SAP library "dbslib" (I think dbsmsslib is the correct name for the SQL server)
    Unfortunately, SQLServer is a Windows only program and this library is only available for Windows.
    To use it (use DBCON) you will have to install an AS on a windows machine and configure the DBCON on this server and execute the program to exchange data from this AS alone (if you execute it from another one it will fail because it does not find the dbslib)
    As mentioned, not much experience with non "real" Operating Systems, so perhaps someone else has more information.

  • [b]How to create this Custom Table on Custom Schema with foreign key [/b]

    This Custom Table is create in Custom Schema and Refers to Seeded Table in APPS schema
    1 create table test_dff (test_id number(15) primary key,
    2* invoice_id number(15) constraint ap_test_fk REFERENCES ap_invoices_all(invoice_id) ON DELETE CASCADE)
    SQL> /
    invoice_id number(15) constraint ap_test_fk REFERENCES ap_invoices_all(invoice_id) ON DELETE CASCADE
    ERROR at line 2:
    ORA-02270: no matching unique or primary key for this column-list
    How to create this Custom Table on Custom Schema
    thanks in advance

    hi prashant
    sorry for replying late, i have checked your query and it gives me no rows, but if i check for user_cons_columns it gives me no rows either in APPS Schema, but in AP schema it gives me
    SQL> SELECT * FROM user_cons_columns WHERE table_name = 'AP_INVOICES_ALL';
    OWNER CONSTRAINT_NAME TABLE_NAME
    COLUMN_NAME
    POSITION
    AP SYS_C008177 AP_INVOICES_ALL
    INVOICE_ID
    SQL> SELECT constraint_name, constraint_type FROM user_constraints WHERE table_name = 'AP_INVOICES_A
    LL';
    CONSTRAINT_NAME C
    SYS_C008177 C
    SYS_C008178 C
    SYS_C008179 C
    SYS_C008180 C
    SYS_C008181 C
    SYS_C008182 C
    SYS_C008183 C
    SYS_C008184 C
    SYS_C008185 C
    SYS_C008187 C
    SYS_C008189 C
    SYS_C008191 C
    and since this is a combination of Unique and Not Null Constraints , i am getting the same issue. do u have any solution to make the Detail table records to delete without using Alerts/DB Triggers?
    thanks for your time .
    abdul rahman

  • APEX  How do I create a Form based on a Database Table from other schema

    My APEX schema is WISEXP. I have a database table that resides in WISDW schema on the same database. I want to create Tabular form based on this table.
    I am not able to create a FORM based on the table from WISDW schema. I am able to create a FORM based on SQL though from this table in WISDW schema - but it does not do any action on Update/Insert rows.
    Appropriate Synonyms and grants are created. Is there a limitation or am I missing something? Please advise.
    thanks
    Rupen

    If Rupen is using 2.2 or 2.2.1, it is likely he is running into the bug described here: Re: Workspace to Schema Assignments
    In that case, it may be a necessary and sufficient workaround to assign the foreign schema to the workspace.
    Scott
    Message was edited by:
    sspadafo

  • Creating table under SOAINFRA schema

    hi all,
    As iam a fresher in oracle fmw i need to know about how to create a table under SOAINFRA schema.

    You can't, directories are database wide objects, see:
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_5007.htm#i2061958
    ...+All directories are created in a single namespace and are not owned by an individual schema+...
    HTH
    Enrique

  • ORA-12054:while trying to create mview based on table in other schema

    HI all
    show user
    user is "NAAMA"
    CREATE TABLE USERS
      user_id               NUMBER,
       user_name             VARCHAR2(15 CHAR),
      user_password         VARCHAR2(50 CHAR),
    CONSTRAINT user_pk PRIMARY KEY (user_id));
    TABLE created.
    show user
    user is "TEST"
    create materialized view log on NAAMA.USERS WITH ROWID
    create materialized view users_mv
    build immediate
    refresh fast on commit with rowid
    as
    select  user_name  ,
              user_password        
    from naama.users;
    ORA-12054: cannot set the ON COMMIT refresh attribute for the materialized view
      I suspect this problem is all about priviliges .
    please you help
    Thanks In advanced
    Naama

    Hi Ranit ,
    thanks for your response , i disagree with you lets take a look at those scenarios :
    scenario 1 :
    show user
    user is "NAAMA"
    create materialized view log on users with primary key;
    show user
    user is "TEST"
    CREATE MATERIALIZED VIEW users_mv
    BUILD immediate
    REFRESH FAST ON COMMIT  
    AS
    SELECT
    user_id,
    user_name  ,
    user_password , 
    naama.get_name(user_id) FIRST_name
    FROM naama.users
    ORA-12054: cannot set the ON COMMIT refresh attribute for the materialized view.
    according to this there is nothing to do to the primary key,scenarion 2:
    show user
    user is "NAAMA"
    create MATERIALIZED VIEW LOG ON USERS WITH rowid.
    create or replace function get_name (user_name_in IN varchar2) return varchar2
    is
    begin
    return 'NAAMA';
    end  get_name;
    show user
    user is "TEST"
    CREATE MATERIALIZED VIEW users_mv
    BUILD immediate
    REFRESH FAST ON COMMIT with primary key
    AS
    SELECT
    user_name  ,
    user_password , 
    naama.get_name(user_name) FIRST_name
    FROM naama.users;
    ORA-12054: cannot set the ON COMMIT refresh attribute for the materialized view.scenarion 3:
    show user
    user is "NAAMA"
    create MATERIALIZED VIEW LOG ON USERS WITH rowid.
    show user
    user is "TEST"
    CREATE MATERIALIZED VIEW users_mv
    BUILD immediate
    REFRESH FAST ON COMMIT   WITH rowid
    AS
    SELECT
    user_name  ,
    user_password , 
    SUBSTR(user_name,1,5)
    FROM naama.USERS;
    materialized view created.so we cannot say that the mview has problem using functions.
    What seems to be the problem ?
    Thanks In Advanced
    Naama

  • Indices and constraints on XML Tables/Columns (with Schema)

    Hi,
    I've read a lot of documents by know, but the more I read the more I got confused. So I hope you can help me.
    Frist my Oracle Server Version: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit
    I've manages to create a table with a column with the type SYS.XMLTYPE and the storage modle "Object Relational" with an XML Schema.
    I can insert data and I can execute XQuery statements.
    I can also create an XMLTYPE table with my Schema, althoug the tool SQL Developer keeps telling me, that the one column wich is generated within the table is of the type CLOB instead of object realtional (which is what I defined).
    The query for that is:
    CREATE TABLE ENTRY_XML OF XMLTYPE
    XMLTYPE STORE AS OBJECT RELATIONAL
    XMLSCHEMA "BBMRI_Entry.xsd" ELEMENT "Entry";
    That's where I am, now my questions:
    1. What's the difference? I'm aware of the obviouse difference, that with the first way I can add relational columns as well, but apart from that? If I only want to store the xml data, is the second approach always better (especially in regard to my next question)?
    2. My schema contains elements with attributes (which contain IDs), which have to be unique. So I tried to add a UNIQUE constraint, but failed. I found this (http://www.oracle.com/technology/sample_code/tech/java/codesnippet/xmldb/constraints/Specify_Constraints.html), but it just doesn't work.
    Query: "ALTER TABLE ENTRY_XML CONSTRAINT ENTRY_XML_SUBID_UNQIUE UNIQUE (xmldata."SubId");"
    Error: "ORA-01735: invalid ALTER TABLE option"
    3. I didn't try yet, but I need to specifiy foreign keys within the XML as well (which is explained in the link at question 2). I guess the solution to question 2 will make this possible as well.
    4. Since I can create a UNIQUE constaint for attributes (well, I can't yet, but I hope that this will change soon) I woundered if it would be possible to realize something like auto_increment. Although I see the problem with validating the xml input if the Ids are empty. Any suggestions on that problem? Do I have to query for the highest (free) id before I can insert the new documents?
    Well, that's enough for today, I hope someone can help me!
    Greetings, Florian

    I've read through all the literature (again) and found out, that I did most of the stuff right in the first place. I just missinterpreted the generated tables for the types and wondered why they only contained one column. Well, at least one mistery solved.
    But know to make it easier just one question, which might solve all problems I have:
    How can I create UNIQUE constraints and FOREIGN KEYS when I have a table or column of the type XmlType with a schema using the object relational storage method?
    I found a solution http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14259/xdb05sto.htm#i1042421 (Example 5-12), but it just does not work for me.
    I removed the FOREIGN KEY and tried it again and the UNIQUE Key works.
    So basically the question is how to retrieve the "AId" Attribute. "XMLDATA"."AId", "XMLDATA"."Attribute"."AId" and "XMLDATA"."Subject"."Attribute"."AId" all do not work.
    I've added my schema declarations at the bottom (which I've already successfully registred and used without foreign keys and constraints, so they work).
    After I've registered the two schema files 3 types and 11 tables where created. One type for the attribute, one for the study type and one probably to link the attributes to the study types. The tables are one for the attribute, 4 for the content*-elements, 2 for the study type (I don't really know why two) and 4 with strange names starting with "SYS_NT" and then some random numbers and letters (looks alot like some base64 encoded string).
    The Query I try to use to create the table is: (The table "Attribute" already exists and contains a field "ID", which is it's PK.)
    CREATE TABLE STUDYTYPE_XML
    OF XMLType (UNIQUE ("XMLDATA"."STId"),
    FOREIGN KEY ("XMLDATA"."AId") REFERENCES ATTRIBUTE(ID))
    XMLTYPE STORE AS OBJECT RELATIONAL
    ELEMENT "StudyType.xsd#StudyType";
    The error I get is:
    Error starting at line 1 in command:
    CREATE TABLE STUDYTYPE_XML
    OF XMLType (UNIQUE ("XMLDATA"."STId"),
    FOREIGN KEY ("XMLDATA"."AId") REFERENCES ATTRIBUTE(ID))
    ELEMENT "StudyType.xsd#StudyType"
    Error at Command Line:3 Column:37
    Error report:
    SQL Error: ORA-22809: nonexistent attribute
    22809. 00000 - "nonexistent attribute"
    Cause: An attempt was made to access a non-existent attribute of an
    object type.
    Action: Check the attribute reference to see if it is valid. Then retry
    the operation.
    Attribute-Schema (Attribute.xsd):
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
         <xs:attribute name="AId">
              <xs:simpleType>
                   <xs:restriction base="xs:integer">
                        <xs:minInclusive value="0" />
                   </xs:restriction>
              </xs:simpleType>
         </xs:attribute>
         <xs:attribute name="Name" type="xs:string" />
         <xs:element name="ContentString" type="xs:string" />
         <xs:element name="ContentInteger" type="xs:integer" />
         <xs:element name="ContentDouble" type="xs:decimal" />
         <xs:element name="ContentDate" type="xs:date" />
         <xs:element name="Attribute">
              <xs:complexType>
                   <xs:choice minOccurs="0" maxOccurs="1">
                        <xs:element ref="ContentString" />
                        <xs:element ref="ContentInteger" />
                        <xs:element ref="ContentDouble" />
                        <xs:element ref="ContentDate" />
                   </xs:choice>
                   <xs:attribute ref="AId" use="required" />
                   <xs:attribute ref="Name" use="optional" />
              </xs:complexType>
         </xs:element>
    </xs:schema>
    Study Type Schema (StudyType.xsd):
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
         <xs:include schemaLocation="Attribute.xsd" />
         <xs:attribute name="STId">
              <xs:simpleType>
                   <xs:restriction base="xs:integer">
                        <xs:minInclusive value="0" />
                   </xs:restriction>
              </xs:simpleType>
         </xs:attribute>
         <xs:element name="StudyType">
              <xs:complexType>
                   <xs:sequence>
                        <xs:element ref="Attribute" minOccurs="1" maxOccurs="unbounded" />
                        <xs:element ref="StudyType" minOccurs="0" maxOccurs="unbounded" />
                   </xs:sequence>
                   <xs:attribute ref="STId" use="required"/>
              </xs:complexType>
         </xs:element>
    </xs:schema>
    Edited by: alwaysspam on Sep 8, 2010 5:35 PM

Maybe you are looking for

  • Multiple APEX instances sharing the same Oracle Home?

    Can someone tell me if it is possible to have multiple APEX installations where the database instances are sharing the same Oracle Home? If so, how would this be set up? So, if I have development and test running on the same home, I want a separate A

  • Network Connection Timeout when "Chkng for available downloads" from iTunes

    I have been struggling with this problem for weeks and have spent a significant amount of time trying to diagnose and fix without success. When I select “Check for Available Downloads” through iTunes, I receive a “Network Connection Timeout” message

  • Non-admin RDP support

    hi all, is it possible to allow non-admin RDP support in Windows 2012 such that a "super-user" can RDP into a box, and view "Task Manager" tabs, processes, services, network of ALL USERS, including "Resource Monitor" info such as DISK files access (r

  • Macbook Pro not reading DVDs

    My Macbook Pro will read CDs but not DVDs or executable DVDs. Is it a setting or hardware problem?

  • Help! I just trashed my hard drive

    There are 2 hard drives in my G4. One is for my applications and the other is a 300 GB drive that had 4 partitions and lots of data: digital photos, iphoto, imusic, and other. I just downloaded some photos from a card. Normally, after downloading, th