{"id":933,"date":"2013-01-04T17:41:24","date_gmt":"2013-01-04T17:41:24","guid":{"rendered":"http:\/\/www.juniovitor.com\/?p=933"},"modified":"2013-01-04T18:02:13","modified_gmt":"2013-01-04T18:02:13","slug":"delete-dt-e-ds-xml-publisher","status":"publish","type":"post","link":"https:\/\/www.juniovitor.com\/?p=933","title":{"rendered":"Delete DT e DS &#8211; Oracle XML Publisher"},"content":{"rendered":"<p>Pessoal,<\/p>\n<p>T\u00f4 passando somente pra deixar um exemplo de como deletar seus DataTemplates e DataSources (Objetos XML Publisher) quando precisar! As vezes criamos errado ou n\u00e3o est\u00e1 sendo utilizado mais, etc&#8230;<\/p>\n<p>Segue:<\/p>\n<pre class=\"brush:sql\">\r\n\r\n-- Inicio\r\nSET SERVEROUTPUT ON\r\n \r\nDECLARE\r\n   -- Altere os parametros abaixo conforme sua necessidade\r\n   VAR_TEMPLATECODE  VARCHAR2(100) := 'NAME_TEMPLATE_CODE'; -- Template Code.\r\n   BOO_DELETEDATADEF BOOLEAN := TRUE; -- True\/False para excluir Data Def. associado.\r\nBEGIN\r\n\r\n FOR RS IN (SELECT T1.APPLICATION_SHORT_NAME TEMPLATE_APP_NAME,\r\n                   T1.DATA_SOURCE_CODE,\r\n                   T2.APPLICATION_SHORT_NAME DEF_APP_NAME\r\n              FROM XDO_TEMPLATES_B T1, XDO_DS_DEFINITIONS_B T2\r\n             WHERE T1.TEMPLATE_CODE = VAR_TEMPLATECODE\r\n               AND T1.DATA_SOURCE_CODE = T2.DATA_SOURCE_CODE) LOOP\r\n \r\n  XDO_TEMPLATES_PKG.DELETE_ROW(RS.TEMPLATE_APP_NAME, VAR_TEMPLATECODE);\r\n \r\n  DBMS_OUTPUT.PUT_LINE('Template ' || VAR_TEMPLATECODE || ' exclu\u00eddo.');\r\n \r\n  IF BOO_DELETEDATADEF THEN\r\n   XDO_DS_DEFINITIONS_PKG.DELETE_ROW(RS.DEF_APP_NAME, RS.DATA_SOURCE_CODE);\r\n  \r\n   DBMS_OUTPUT.PUT_LINE('Data Definition ' || RS.DATA_SOURCE_CODE ||\r\n                        ' excluido.');\r\n  END IF;\r\n END LOOP;\r\n\r\n DBMS_OUTPUT.PUT_LINE('Fa\u00e7a um COMMIT ou um ROLLBACK para finalizar a execu\u00e7\u00e3o!');\r\n\r\nEXCEPTION\r\n WHEN OTHERS THEN\r\n  -- ROLLBACK;\r\n  DBMS_OUTPUT.PUT_LINE('N\u00e3o \u00e9 poss\u00edvel excluir Template XML Publisher' ||\r\n                       VAR_TEMPLATECODE);\r\n  DBMS_OUTPUT.PUT_LINE(SUBSTR(SQLERRM, 1, 200));\r\nEND;\r\n-- Fim\r\n\r\n<\/pre>\n<p>Abs,<br \/>\nJunio Vitor<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Pessoal, T\u00f4 passando somente pra deixar um exemplo de como deletar seus DataTemplates e DataSources (Objetos XML Publisher) quando precisar! As vezes [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[157,156,622,98,155],"class_list":["post-933","post","type-post","status-publish","format-standard","hentry","category-oracle","tag-datasource","tag-datatemplate","tag-oracle","tag-xml","tag-xml-publisher"],"_links":{"self":[{"href":"https:\/\/www.juniovitor.com\/index.php?rest_route=\/wp\/v2\/posts\/933"}],"collection":[{"href":"https:\/\/www.juniovitor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.juniovitor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.juniovitor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.juniovitor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=933"}],"version-history":[{"count":15,"href":"https:\/\/www.juniovitor.com\/index.php?rest_route=\/wp\/v2\/posts\/933\/revisions"}],"predecessor-version":[{"id":1193,"href":"https:\/\/www.juniovitor.com\/index.php?rest_route=\/wp\/v2\/posts\/933\/revisions\/1193"}],"wp:attachment":[{"href":"https:\/\/www.juniovitor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=933"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.juniovitor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=933"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.juniovitor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=933"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}