Monday, 14 November 2016

Deleting a XML template from back end


/* Formatted on 11/14/2016 1:48:14 PM (QP5 v5.114.809.3010) */
DECLARE
   l_templateCode   varchar2 (100) := 'XX_AR_XXXREPORT';      -- Template Code
BEGIN
   FOR r
   IN (SELECT   t1.application_short_name template_app_name,
                t1.data_source_code,
                t1.application_short_name def_app_name
         FROM   xdo_templates_b t1
        WHERE   t1.template_code = l_templateCode)
   LOOP
      xdo_templates_pkg.delete_row (r.template_app_name, l_templateCode);

      DELETE FROM   xdo_lobs
            WHERE       lob_code = l_templateCode
                    AND application_short_name = r.template_app_name
                    AND lob_type IN ('TEMPLATE_SOURCE', 'TEMPLATE');

      DELETE FROM   xdo_config_values
            WHERE       application_short_name = r.template_app_name
                    AND template_code = l_templateCode
                    AND data_source_code = r.data_source_code
                    AND config_level = 50;
   END LOOP;
END;

No comments:

Post a Comment