Forum Stats

  • 3,838,635 Users
  • 2,262,385 Discussions
  • 7,900,715 Comments

Discussions

Cannot Delete Non-Empty Folder From Resource_View

651348
651348 Member Posts: 28
edited Jul 15, 2009 10:18PM in XML DB
Good Morning.

I have over 15,000 XML files listed under a leaf-folder with RESOURCE_VIEW. I need to remove them all and replace them with corrected versions.

I found the following script in the 10.2 XDB Developers Guide which runs successfully, however the files are not removed - go figure.

Would someone who has worked with RESOURCE_VIEW and PATH_VIEW please point me in the correct direction that I may complete this task. The script is as follows.

------------------------------------------------------------------------------------------------------------------------------------------------
DECLARE
CURSOR c1 IS
SELECT ANY_PATH p FROM RESOURCE_VIEW
WHERE under_path(RES, '/public/FADS',1) = 1
AND existsNode(RES, '/Resource[Owner="FADS"= 1
ORDER BY depth(1) DESC;
del_stmt VARCHAR2(500)
:= 'DELETE FROM RESOURCE_VIEW WHERE equals_path(RES, :1)=1';
BEGIN
FOR r1 IN c1 LOOP
EXECUTE IMMEDIATE del_stmt USING r1.p;
END LOOP;
END;
COMMIT;
/

Answers

  • Marco Gralike
    Marco Gralike Member Posts: 4,491 Silver Trophy
    If possible, delete the folder instead of the files and recreate the folder.
  • 651348
    651348 Member Posts: 28
    Thank you for the suggestion. Unfortunately, you cannot delete a non-empty folder in XDB, when its contents are considered resources and are listed in RESOURCE_VIEW and PATH_VIEW.

    The automonous procedure in my initial post is supposed to do the trick as per the XDB Developers Guide, however even thouugh the procedure runs successfully - the RESOURCE_VIEW still contains the file listings.

    Note: The procedure was tested as the resource owner user, SYS and XDB. with the same results - go figure.
  • Marco Gralike
    Marco Gralike Member Posts: 4,491 Silver Trophy
    DBMS_XDB.DELETERESOURCE
    http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14258/d_xdb.htm#sthref8119

    delete_option

    The option that controls how a a resource is deleted; defined in Table 121-1:

    DELETE_RESOURCE

    DELETE_RECURSIVE

    DELETE_FORCE

    DELETE_RECURSIVE_FORCE
This discussion has been closed.