Buscar este blog

domingo, 13 de agosto de 2017

Documentum - Oracle query to find file path

This is a small tweak of this useful post: https://msroth.wordpress.com/2011/09/04/finding-an-objects-content-file/

It was tested with Documentum 6.7 and Oracle database 11g.
select
    CR.parent_id AS OID,
    L.file_system_path AS Base_Path,
    CS.data_ticket AS Ticket,   
    TRIM(TO_CHAR(TO_NUMBER(CS.data_ticket) + 4294967296, 'XXXXXXXX')) AS Ticket_HEX,
    '/' ||
    SUBSTR(TRIM(TO_CHAR(TO_NUMBER(CS.data_ticket) + 4294967296, 'XXXXXXXX')), 1, 2) || '/' ||
    SUBSTR(TRIM(TO_CHAR(TO_NUMBER(CS.data_ticket) + 4294967296, 'XXXXXXXX')), 3, 2) || '/' ||
    SUBSTR(TRIM(TO_CHAR(TO_NUMBER(CS.data_ticket) + 4294967296, 'XXXXXXXX')), 5, 2) || '/'  AS DIRECTORY,       
    SUBSTR(TRIM(TO_CHAR(TO_NUMBER(CS.data_ticket) + 4294967296, 'XXXXXXXX')), 7, 2) || '.' || CS.full_format AS FILE_NAME,
    CS.full_format AS FILE_EXTENSION,
    CS.full_content_size AS FILE_SIZE   
from 
    DMR_CONTENT_S CS, 
    DMR_CONTENT_R CR, 
    DM_FILESTORE_S F, 
    DM_LOCATION_S L, 
    DM_SYSOBJECT_S S 
where 
    CS.r_object_id = CR.r_object_id 
    AND CR.parent_id = '0898968180000ada'
    AND CS.storage_id = F.r_object_id
    AND F.root = S.object_name 
    AND S.r_object_id = L.r_object_id;

Result:

Note: As the was stated in the referenced post, 4294967296 is 2^32, and is used to convert the negative number of the ticket to hexadecimal.

No hay comentarios:

Publicar un comentario