30 gennaio 2008

DQL Tips

Alcuni esempi e tips di query DQL per Documentum

Query DQL per aggiornare il valore di un attributo di uno specifico object type:
In questo esempio viene aggiornato l'attributo title e l'attributo di tipo rpeating keywords

DQL> update dm_document object set title = 'File created via DQL' ,
set keywords = 'first' where object_name = 'TestDocumentCreated_via_DQL'

Query DQL per eliminare tutte le versioni di un documento ad eccezione della CURRENT:

Questo esempio è specifico di un mio cliente
delete acr_fattura_passiva(all) objects where barcode = 'AACRAFP0000000006090' AND NOT ANY (r_version_label LIKE 'CURRENT%')
oppure si può scrivere anche in questa forma:
delete acr_fattura_passiva(all) objects where barcode in ('AACRAFP0000000001122','AACRAFP0000000001122','AACRAFP0000000001122','...','...') AND NOT ANY (r_version_label LIKE 'CURRENT%')

Se si vogliono semplicemente visualizzare tutte le versioni tranne la current usare:
Select r_object_id, barcode, r_version_label from acr_fattura_passiva(all) where barcode = 'AACRAFP0000000006090' AND NOT ANY (r_version_label LIKE 'CURRENT%')

Nessun commento: