Can't delete from parent table if FK constraint on the out-of-line table

Using Oracle XML DB 11g
I am using out-of-line storage table to store a collection of XML elements in conjuction with storeVarrayAsTable="true". So what I have is a parent table containing a nested table of VARRAY of REFs to rows in the out-of-line table.
In addition, I have a foreign key constraint placed on a column in the out-of-line table.
My problem is that I am not able to delete rows from the parent table when the FK constraint is placed on the out-of-line table. Only when I drop the FK constraint does the deletion work - all associated rows in the nested table and out-of-line table
gets deleted correctly.
With the FK constraint, deleting the child document like this
dbms_xdb.deleteResource('/project-1.xml')
gives me this error:
ORA-31018: Error deleting XML document
ORA-03001: unimplemented feature
*Cause:  The XMLType object pointed to by the given REF could not
be deleted because either the REF was invalid or it pointed to a non-existent table.
     *Action:  Either use FORCE deletion or supply a valid REF.
I have tried deleting with the FORCE options as well with no success.
Using DBMS_XDB.DELETE_RECURSIVE_FORCE option doesn't produce an error, but doesn't perform the deletion either.
Here is the XML Schema:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xdb="http://xmlns.oracle.com/xdb" xmlns:xlink="http://www.w3.org/1999/xlink"
elementFormDefault="qualified" attributeFormDefault="unqualified" xdb:storeVarrayAsTable="true">
<xs:import namespace="http://www.w3.org/1999/xlink" schemaLocation="http://www.w3.org/1999/xlink.xsd"/>
<xs:element name="project" xdb:defaultTable="PROJECT_TAB">
<xs:complexType xdb:SQLType="PROJECT_TYP">
<xs:sequence>
<xs:element name="resourceList" minOccurs="0" xdb:SQLName="RESOURCE_LIST">
<xs:complexType xdb:SQLType="RESOURCE_LIST_TYP">
<xs:sequence>
<xs:element name="aResource" type="refType" minOccurs="0" maxOccurs="unbounded" xdb:SQLInline="false"
xdb:SQLName="A_RESOURCE_REF" xdb:defaultTable="RESOURCE_REF_TAB"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="aguid" type="xs:string" use="required" xdb:SQLName="AGUID"/>
</xs:complexType>
</xs:element>
<xs:element name="aResource" xdb:defaultTable="A_RESOURCE_TAB">
<xs:complexType xdb:SQLType="A_RESOURCE_TYP">
<xs:complexContent>
<xs:extension base="contactType">
<xs:attribute name="aguid" type="xs:string" use="required" xdb:SQLName="AGUID"/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:element>
<xs:complexType name="contactType" xdb:SQLType="CONTACT_TYP">
<xs:sequence>
<xs:element name="name" type="xs:string" xdb:SQLName="NAME"/>
<xs:element name="email" type="xs:string" minOccurs="0" xdb:SQLName="EMAIL"/>
<xs:element name="phone" type="xs:string" xdb:SQLName="PHONE"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="refType" xdb:SQLType="REF_TYP">
<xs:attribute ref="xlink:href" use="required"/>
<xs:attribute name="oref" type="xs:string" use="optional" xdb:SQLName="OREF"/>
</xs:complexType>
</xs:schema>
I registered the schema using structured storage with these options:
BEGIN
DBMS_XMLSCHEMA.registerschema(
SCHEMAURL => 'LSDProjects.xsd',
SCHEMADOC => xdbURIType('/home/LSDProject2/LSDProjects.xsd').getClob(),
LOCAL => TRUE, -- local
GENTYPES => TRUE, -- generate object types
GENBEAN => FALSE, -- no java beans
GENTABLES => TRUE -- generate object tables
END;
The PK and FK constraints were added like this:
-- Add PK constraints on aResource/@aguid attributes
ALTER TABLE A_RESOURCE_TAB ADD CONSTRAINT A_RESOURCE_AGUID_IS_UNIQUE UNIQUE (XMLDATA."AGUID");
-- Add FK constraint on out-of-line table
ALTER TABLE RESOURCE_REF_TAB
ADD (CONSTRAINT ref_resource_aguid_is_valid FOREIGN KEY (XMLDATA."OREF")
REFERENCES A_RESOURCE_TAB(XMLDATA."AGUID"));
Here are the XML instance documents:
     where resource-1.xml looks like this :
<aResource aguid="resource-1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="LSDProjects.xsd">
     <name>Jane Doe</name>
     <email>[email protected]</email>
<phone/>
</aResource>
     and project-1.xml looks like this :
     <project aguid="project-1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="LSDProjects.xsd"
               xmlns:xlink="http://www.w3.org/1999/xlink">               
          <resourceList>
               <aResource xlink:href="/resource-1.xml" oref="resource-1"/>                         
          </resourceList>     
     </project>
where <project> document contains a collection of <aResource> elements stored in the out-of-line table and
project/@oref attribute is a foreign key to the primary aResource/@aguid attribute.
Can someone shed some light on why I am unable to delete "project-1.xml" from the repository when the FK constraint is applied onto the out-of-line table.
Any advice/suggestions would be appreciated. Thanks!

Thank you for the quick reply, mdrake.
I am currently prototyping and testing out (best) ways to achieve data integrity with XML data in XML DB.
I have instance documents that makes cross references to values in other instance documents
(not of the same root nodes). What I'm trying to enforce is a referential constraint between the documents
so that a document cannot be inserted if the referenced document doesn't exists.
In this situation, a <project> document contains a collection of elements with @oref attributes.
The collection is stored in an out-of-line table.
For example:
<project>
<resourceList>
<aResource ... oref="resource-1"/>
<aResource ... oref="resource-2"/>
</resourceList>
</project>
The @oref (FK) attribute above references a @aguid (PK) attribute in <aResource> document (below):
<aResource aguid="resource-1"> .... </aResource>
Basically, I want to ensure that the value of
/project/resourceList/aResource/@oref
correspond to a valid
/aResource/@aguid
Note that I was able to add the FK constraint on the OOL table without any issues.
And the constraint did work as expected as I was not allowed to insert a <project> document
that referenced a non-existent /aResource/@aguid.
The problem was that I could not delete the <project> document from the XML DB repository
once the FK contraint was added. Deleting with the DELETE_RECURSIVE_FORCE option did not give
me any errors - is just didn't do anything.
I guess there are certain limitations with using out-of-line tables.
BTW, sorry the examples are hard to read as the indentations are removed when posting.

Similar Messages

  • I can't delete from secondary hd. error 1401.

    I can't delete from my secondary drive. No "ignore ownership" shows up on its info window.

    Yes but that had no effect.So I used a program I had downloaded a while agao called Batch mod. It offered the option to change ownership on selected volumes etc. It solved the problem Immediately. BTW Last year, after two months of getting suggestions from apple on how to fix permissions problems with no results, I downloaded this program and it worked instantly. Please check it out for yourself. And if you are permitted,please reccommend it to others.

  • Updated to iTunes 11.1 and many of my podcasts were, as far as I can tell, deleted from my account. 'This American Life' in particular, cannot be redownloaded for free and I want the unlistened podcasts I accrued to come back! Any tips or suggestions?

    Updated to iTunes 11.1 and many of my podcasts were, as far as I can tell, deleted from my account. 'This American Life' in particular, cannot be redownloaded for free and I want the unlistened podcasts I accrued to come back! I'm also afraid that if I sync my iPod now, the podcasts that I have on there but have been removed from the computer, will also be removed from the iPod.
    Any tips or suggestions?

    What really cheeses me off here is that Apple isn't allowing users enough customization.  With each update of iTunes (and the OS and iOS) we're forced to give up something that worked well for the way we want to use the app and make do with fewer (and lamer) options.  If Apple keeps this up, they're going to start losing customers fast.  I mean if this isn't fixed soon, I'm pretty sure I'm going to give up on iTunes, and then I'll probably go ahead and get a Galaxy when I need to replace my iPhone.
    What I don't understand about how they won't let users delete the list of available podcasts now is why?  How is this making it a better program?  I can understand that not all users are capable enough to right-click on a feed and select "Show all available episodes", so I can see why they want the complete list to be the default (and, surprise, it already was).  But to not give users the option to delete that list?  It's inconsiderate because it makes navigating feeds with a large back catalogue really frustrating.  I'm flabbergasted that no one at Apple considered all the podcast feeds that keep hundreds of episodes available when they removed this feature.  It smacks of rank incompetence.
    What improvement were they trying to make here anyway?  There was nothing wrong to my mind about how podcasts were managed in previous versions.  Whatever improvement they were trying to make here, they should have realized that many users would at least want the option to keep things the way they were.
    And reverting to a previous version is no solution.  I can't sync my iPhone with the new iOS without this update, and (while I do have some issues--specifically how you can't play podcasts in the Music app anymore) I do like the new iOS.

  • I have emails that I can not delete from my Junk mail folder. How do I permanently delete them?

    I have emails that I can not delete from my Junk mail folder. How do I permanently delete them?

    Weird.
    Someone might stop by who has experienced/fixed/read about this before.  In the meantime...
    By "re-indexed my email" do you mean you rebuilt the mailbox via the "Rebuild" command in the Mailbox menu?  Did you try that for all the affected mailboxes?
    Also, you might try experimenting with the settings in Mail, Preferences, Accounts having to do with whether junk mail messages are stored on the server and whether they are to be deleted.
    Does this behavior persist when you are not connected to the internet?

  • I just bought a macbook pro and I want to know how to restore pictures that were backed up on iCloud but then deleted from my phone. Isn't that the point of the backup so I can delete and make more space. Please help!

    I just bought a macbook pro and I want to know how to restore pictures that were backed up on iCloud but then deleted from my phone. Isn't that the point of the backup so I can delete and make more space. Please help!

    Log into the iCloud on your MacBook Pro and enable Photo Stream:
    Then launch iPhoto and set iPhoto's Photo Stream preferences to the following:
    Then check the Photo Stream section of iPhoto:
    This is to confirm that the photos are still in Photo Stream. If they are they will be imported into the library. 
    NOTE: not all photos in an iPhone will be in the Photo Stream. PS only keeps photos in it for 30 days.
    If you have the missing photos in your library put them in an album.  Connect your iPhone to the Mac and open iTunes.  In iTunes you can select that album in the library and sync the photos to your iPhone to get them back on the iPhone.
    OT

  • If I saved something on my external drive as a back up / time machine can I delete from laptop without losing anything?

    if I saved something on my external drive as a back up can I delete from laptop without losing anything?

    No. Eventually, Time Machine will delete it from the backup. Time Machine is not a storage concept, it's a backup concept. If you need permanent file storage, then get another drive for that.

  • What can I delete from Extensions and System folder?

    I just installed System 10.4 bundled with Classic Mode on my eMac. There seemed to be a lot of things that got installed that I won't need, such as: printer drivers, iChat, Quicken and World Book Encyclopedia. What can I safely delete from the Extensions folder that will not affect the operating system, keeping in that want to run on programs in Classic Mode? Is there anything else I can delete along these lines that will free up hard drive space? Is there anything I can safely delete from the System Folder?
    I chose the Archive and install for installation. It says it created a "Previous System Folder". Can I delete this Previous System Folder to make it run faster?  

    A standard install loads you up with a pile of unneeded printer drivers, foreign fonts and foreign language support. Did you do the optional install that allows you to omit these space-eaters? If not, as this is a new install, you might consider reinstalling and exercising the optional or custom install options.
    Back in the OS9 and earlier days when hard drives were tiny  and RAM was expensive, it was a real help to rid one's self of the extra unused extensions. They had "open" and easily understood file names making it a no-brainer to drag those extensions to an "unused extension" folder outside the System folder.
    Of all the eMacs made there were only two basic logic board architectures. The first would accommodate up to 1 GB RAM and the second could handle a total of 2GB RAM. Do "About this Mac" from your Apple menu and, in the resulting window, click the "More Info..." button to launch System Profiler.
    In Profiler's first screen you can tell which architecture you have. The second line in OS 104 is "Machine Model" followed by a code:
    code "PowerMac4,4" --the first architecture, with USB 1.1 and a max RAm of 1GB
    code "PowerMac6,4 --that later and desirable USB 2.0 logic board that can do 2GB RAM.
    If you have a 4,4 the RAM for that model is listed here:
    http://eshop.macsales.com/MyOWC/Upgrades.cfm?sort=pop&model=146&type=Memory
    "PC-133" RAM is preferred in 4,4 eMacs for best function.
    The same vendor has RAM for the 6,4 here:
    http://eshop.macsales.com/MyOWC/Upgrades.cfm?sort=pop&model=223&type=Memory
    I've bought 90 percent of my RAM from this vendor for the last decade and can vouch for their product quality and customer service.
    The point is that maxxing out your RAM is not expensive and saves you a lot of grief from deleting some file with a cryptic OSX name that the computer really needs.

  • What can I delete from what folders to A) get more space and B) speed up machine.  2009 Imac Intel based Leopard

    What can I delete from what folders to A) get more space and B) speed up machine.  2009 Imac Intel based Leopard

    If you start deleting things in hidden system folders, or in an /Library folder you may very well mess up something.
    That is why I say limit what you delete to your User folder only and only those files you've put or created there.  Start messing with anything system or application related without know exactly what you are doing and you risk fubar'ing something.
    There are in fact many places in the system areas that will appear to be redundant, but they are not so just because they have similar path or file names.
    Also, how much free space do you have with just a freshly rebooted system?  If your system does not have much RAM (given the apps your normally run on it), it may be creating quite a bit of swap space.  That will be flushed out with a reboot, but if your system is RAM limited, then it will just grow back.  In such a case, more RAM would help.
    Use Activity Monitor to look at your RAM and swap use over a few days of normal use - look particularly at the page outs, as that will tell you how much virtual memory is actually being used on the drive.  If page outs are high (thousands to 10's of thousands or more) your system is RAM limited, and your drive will be filling up with swap files.

  • Delete from remote location with where clause between the two databases

    I want to delete records from a source database using dblink. The criteria for the delete is a where clause, that
    looks for the values between a table at source and the remote location. I get an invalid sql statement error.
    When i do a count(*) instead of a delete, I get rows returned.
    Can anyone see an the problem here ? I've tried qualifying the delete
    delete from tabl1@remote a, tabl1_temp b where (a."id" =b."id") and (a."title" = b."title) and (a."key" = b."key");
    the error I get is ORA 00933 SQL command not properly ended....
    The * is between the 2 ands ...
    Edited by: sgonos on Nov 6, 2009 6:46 AM
    Sorry the * moved when I save it ...
    delete from tabl1@remote a, tabl1_temp b where (a."id" =b."id") and (a."title" = b."title) and (a."key" = b."key");
    it's flagging the middle and ... a.title = b.title ... seems to like key ....
    Edited by: sgonos on Nov 6, 2009 6:51 AM

    You have 2 tables specified in the delete clause of your statement.
    It should maybe be something like:
    delete from tabl1@remote a
    where exists (select 'x' from tabl1_temp b where (a."id" =b."id") and (a."title" = b."title) and (a."key" = b."key"));
    {code}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Hallo! How can i delete my files wich are saved not on the C: drive?

    Hallo! How can i delete my files wich are saved not on the C: drive?

    I'm guessing there must be more to this question than you are stating.
    But to answer the question you asked, if you want to delete files that are not on the C drive, select the files and then delete them (press the Delete key, and then Delete from Hard Disk or not, your choice)

  • HT4673 how can i delete an app that won't move to the trash?

    I have an app that I can't delete -- it is not an apple app.  The message said it was in the trash, so I moved it back to my desktop (it's a zip file) and I want it off of my app folder and I can't delete it.

    Open Terminal and type the following:
    sqlite3 ~/Library/Application\ Support/Dock/*.db "DELETE from apps WHERE title='APP_NAME';" && killall Dock
    Replace APP_NAME with the full name of the application.

  • This morning, my iPad screen didn't respond to my touch commands. It displays mail, but I can't move the screen, can't delete an incoming item. Nothing. All the other screens work normally -- just no response to mail.

    This morning, my iPad screen didn't respond to my touch commands. It displays mail, but I can't move the screen, can't delete an incoming item. Nothing. All the other screens work normally -- just no response to mail.

    Have you tried closing the Mail app completely ? From the home screen (i.e. not with the Mail app 'open' on-screen) double-click the home button to bring up the taskbar, then press and hold any of the apps on the taskbar for a couple of seconds or so until they start shaking, then press the '-' in the top left of the Mail app to close it, and touch any part of the screen above the taskbar so as to stop the shaking and close the taskbar.
    If that doesn't work then you could try a reset : press and hold both the sleep and home buttons for about 10 to 15 seconds (ignore the red slider), after which the Apple logo should appear - you won't lose any content, it's the iPad equivalent of a reboot.

  • Is there a way I can move movies from one itunes library to another on the same computer?

    Is there a way I can move movies from one itunes library to another on the same computer?

    Locate them in the Windows Explorer, move or copy those files as you would any other, and drag them into the open iTunes window when the second library is loaded. If you're using two iTunes libraries on one user account, you only need to locate the files; otherwise, they need to be put in a shared area.
    (63747)

  • HI, I need your help. How can I delete all data, when I do not have the special security code, which I didn´t remember ? I also think, that I never create this code before. But I cannot put my settings back.

    HI, I need your help. How can I delete all data, when I do not have the special security code, which I didn´t remember ? I also think, that I never create this code before. But I cannot put my settings back.

    You must remember the code, if you can't then take the phone and proof of purchase to an Apple Store.

  • Can I change from hard cover to soft cover after the book is designed?

    Can I change from hard cover to soft cover after the iphoto book is desgned?

    Yes,  Just go to the View all pages window and click on the Change Theme button.  There you will be able to switch size and type of cover.  HOWEVER, just to be on the safe side make a copy of the book beforehand by clicking on it and typing Command+D (duplicate).  Sometimes some of the text might be lost.  It's a possiblity but I've never had it happen. 
    OT

Maybe you are looking for

  • Adaptiva Software Distribution not working with Cisco APs in Local Mode

    A worldwide customer would like to use a new Software distribution system called Adaptiva to replace SCCM within Windows environment. As far as I understand, Adaptiva is designed to work like a snowball system. A single PC at a remote side can be "in

  • My file is read only how do i turn it off?

    the only page that appears under www.simon-gideons.com is read only how do i turn that off so i can edit that page?

  • Using variables in sql scripts

    I am trying to pass a variable into a simple sql script - but each time I run it, it still asks for the variable. Here is my example: test.sql contains: select count(*) from &tbl I try to run it by typing the following at the sqlplus prompt: @test th

  • Rename a locked folder with Terminal

    Hi, I have a folder /usr/local/php5/ and I want to rename it /usr/local/php5Apache1.3/ to install a new package. How do I do that since I don't have write access to /local/ ? Thank you much

  • Automatic posting question: differences between bsd and prd

    Hi to everyone. Although I searched for everywhere I know (including SAP help) I couldn't find a proper answer for my question "what are the differences between transactions "BSD - inventory posting" and "PRD - Cost (price) differences" ?". it seems