SELECT
xtt.template_name "Template Name", xtb.template_code "Template
Code",
       fat.application_name "Application
Name",
       xddt.data_source_name "Data
Definition",
       xtb.template_type_code "Template
Type",
       xtb.default_language
"Language", xtb.default_territory "Territory",
       xl.file_name "File Name",
xl.file_data "File"
  FROM xdo_templates_tl xtt,
       xdo_templates_b xtb,
       fnd_application_tl fat,
       xdo_ds_definitions_tl xddt,
       xdo_lobs xl
WHERE
(xtt.template_name LIKE '%Template Name%')
   AND xtt.LANGUAGE = 'US'
   AND xtb.template_code = xtt.template_code
   AND fat.application_id = xtb.application_id
   AND fat.LANGUAGE = 'US'
   AND xddt.data_source_code = xtb.data_source_code
   AND xddt.LANGUAGE = 'US'
   AND xl.lob_code = xtb.template_code
   AND NVL (xl.program, 'X') <>
'RTF2XSLParser 5.6.3'
   AND xl.LANGUAGE = xtb.default_language
   AND xl.territory =
xtb.default_territory   
 
 
