Skip to Main Content

Database Software

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Specifying Constraints on XMLType Columns

Chris AntogniniJan 31 2003 — edited Jan 31 2003
Hi

My test environment: 9.2.0.2.0 for Linux

I'm trying to create different type of constraints on a XMLType column. The table definition is:

CREATE TABLE invoice_or (content xmltype)
xmltype content STORE AS OBJECT RELATIONAL
XMLSCHEMA "invoice.xsd"
ELEMENT "Invoice";

I can create a check constraint like the following:

SQL> ALTER TABLE invoice_or ADD CONSTRAINT invoice_or_valid
2 CHECK (xmlisvalid(content) = 1);

But I didn't manage to create a unique key or a foreign key. Here an example:

SQL> ALTER TABLE invoice_or ADD CONTRAINT invoice_or_uk
2 UNIQUE (content.xmldata.invoice_id);
UNIQUE (content.xmldata.invoice_id)
*
ERROR at line 2:
ORA-01735: invalid ALTER TABLE option

Notice that the following select is ok:

SQL> select i.content.xmldata.invoice_id from invoice_or i;

SYS_NC00005$.INVOICE_ID
-----------------------
1001
1002

I have no problem if I use a xmltype table. Are such constraint not supported? How to define them?


Any hint is welcome... thanks!

Chris
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 28 2003
Added on Jan 31 2003
4 comments
391 views