首页 > 代码库 > 看到个有趣的方法批量下载rtf模板

看到个有趣的方法批量下载rtf模板

一般想要批量下载rtf模板我们都是用fndload来实现或者 perl download.pl来实现,今天看到一个比较有趣的方法

Hi,

Blob column ‘template file data‘ below is just what you want, open it in PLSQL-DEVELOPER and save it as a rtf file or you can write programs that work with ‘BLOB‘ objects to export them.



select fa.application_name concurrent_program_appl_name
      ,fcp.user_concurrent_program_name
      ,fcp.concurrent_program_name
      ,(select decode(fe.execution_method_code
                     ,'K'
                     ,fl.meaning
                     ,'P'
                     ,fl.meaning || ' : ' || '$' || fa.basepath ||
                      '/reports/US/' || fe.execution_file_name || '.rdf')
          from fnd_application fa
         where fa.application_id = fe.application_id) execution_method
       
      ,xdd.data_source_name
      ,xdd.data_source_code
      ,xl_xdd.file_name     data_source_file_name
      ,xl_xdd.file_data     data_source_file_data
       
      ,xt.template_name
      ,xt.template_code
      ,xl_xt.file_name  template_file_name
      ,xl_xt.file_data  template_file_data

  from fnd_concurrent_programs_vl fcp
      ,fnd_application_vl         fa
      ,fnd_executables_vl         fe
      ,fnd_lookups                fl
       
      ,fnd_application       fa2
      ,xdo_ds_definitions_vl xdd
      ,xdo.xdo_lobs          xl_xdd
       
      ,xdo_templates_vl xt
      ,xdo.xdo_lobs     xl_xt

where fcp.application_id = fa.application_id
   and fcp.executable_application_id = fe.application_id
   and fcp.executable_id = fe.executable_id
   and fe.execution_method_code = fl.lookup_code
   and fl.lookup_type = 'CP_EXECUTION_METHOD_CODE'
   and fcp.output_file_type = 'XML'
      
   and fcp.application_id = fa2.application_id
   and fa.application_short_name = xdd.application_short_name
   and fcp.concurrent_program_name = xdd.data_source_code
      
   and xdd.application_short_name = xl_xdd.application_short_name(+)
   and xdd.data_source_code = xl_xdd.lob_code(+)
   and trunc(sysdate) between trunc(nvl(xdd.start_date
                                       ,sysdate)) and
       trunc(nvl(xdd.end_date
                ,sysdate))
   and xl_xdd.xdo_file_type(+) = 'XML-DATA-TEMPLATE'
      
   and xdd.application_short_name = xt.ds_app_short_name
   and xdd.data_source_code = xt.data_source_code
      
   and xt.application_short_name = xl_xt.application_short_name(+)
   and xt.template_code = xl_xt.lob_code(+)
   and trunc(sysdate) between trunc(nvl(xt.start_date
                                       ,sysdate)) and
       trunc(nvl(xt.end_date
                ,sysdate))
   and xl_xt.xdo_file_type(+) = 'RTF'
      
   and fcp.concurrent_program_name = 'XLAAARPT' --Concurrent Program Name

order by fcp.user_concurrent_program_name
         ,xdd.data_source_name
         ,xt.template_name;

或者

写个SQL,批量生成下面的语句,执行就可以自动在指定的路径下生成了。

本帖最后由 yxplove 于 2014-8-11 09:14 编辑


java oracle.apps.xdo.oa.util.XDOLoader DOWNLOAD -DB_USERNAME apps -DB_PASSWORD xxxxxx -JDBC_CONNECTION 192.168.66.xxx:1523:TEST -LOB_TYPE TEMPLATE_SOURCE -APPS_SHORT_NAME CUX -LOB_CODE CUXxxxx -LANGUAGE zh -XDO_FILE_TYPE RTF -FILES_DIR /home/appltest/patch_rtf/xxxx.rtf;