Wednesday, November 12, 2014

Do you want to delete mds files easily?

Hi all,

You can delete file (document) or folder (package) by calling mds_internal_common package procedures;

declare
p1 number;
p2 number;
p3 number;
p4 number;
p5 varchar2(200):='/apps/dvm/NYS';  -- thing you want to delete
pathtype varchar2(20);
o1 number;
begin 
select p.path_partition_id,p.path_docid,p.path_low_cn,p.path_version,p.path_name,p.path_type into p1,p2,p3,p4,p5,pathtype from mds_paths p where p.path_fullname=p5 and p.path_high_cn is null;

if(pathtype='DOCUMENT')
then
mds_internal_common.deleteDocument(partitionID =>p1, docID =>p2 , lowCN => p3, version =>p4 , docName => p5, force => 1);
end if;

if(pathtype='PACKAGE')
then
mds_internal_common.deletePackage(result => o1, partitionID => p1, pathID => p2 );
dbms_output.put_line(o1);
end if;

end;