Saturday, February 8, 2014

Valid Windows folder structure with only allowed characters


To create valid Windows Folder structure from the below table, we can escape non valid characters
and create the directory structure


SEQ_NUMBER
DOCUMENT_RSID
ANCESTOR_RSID
1
258346
Closing \ Funding
2
258346
Legal Documents*
3
258346
258269
4
258346
258346
1
258347
258219
2
258347
258269
3
258347
258347
4
258347
258338


Query:
select LISTAGG(regexp_replace(ANCESTOR_RSID, '\\|\/|/|\:|\*|\<|\>|\||\"|\?'), '/') WITHIN GROUP (ORDER BY SEQ_NUMBER) AS PATH from doc_path group by document_rsid
PATH
Closing  Funding/258269/Legal Documents/258346
258219/258338/258269/258347