{"id":9853,"date":"2015-03-19T00:01:43","date_gmt":"2015-03-19T03:01:43","guid":{"rendered":"http:\/\/orabr.com\/?p=9853"},"modified":"2016-03-19T10:25:07","modified_gmt":"2016-03-19T13:25:07","slug":"queryconsulta-que-procura-em-todas-as-tabelas-e-colunas","status":"publish","type":"post","link":"https:\/\/orabr.virttus.com\/?p=9853","title":{"rendered":"Query\/Consulta todas as colunas de todas as tabelas"},"content":{"rendered":"<p><HTML><HTML>Query\/Consulta que procura um texto em todas as tabelas e colunas do tipo CHAR e ou VARCHAR2<\/p>\n<pre class=\"lang:plsql decode:true\" title=\"Procurar em todas a tabelas e colunas do tipo CHAR\/VARCHAR\">select table_name\r\n       ,column_name\r\n       ,query_ds\r\n       ,cnt\r\n  from( select table_name,\r\n               column_name,\r\n               to_number(\r\n                 extractvalue(\r\n                   xmltype(\r\n                     dbms_xmlgen.getxml(\r\n                       'select count(1) c from ' || table_name ||\r\n                       ' where UPPER(to_char(' || column_name || ')) = UPPER(''O QUE DESEJA BUSCAR'')'\r\n                     )\r\n                   ),\r\n                   'ROWSET\/ROW\/C'\r\n                 )\r\n               ) cnt\r\n               ,'select * from ' || table_name ||\r\n               ' where UPPER(to_char(' || column_name || ')) = UPPER(''O QUE DESEJA BUSCAR'')' query_ds               \r\n          from (select utc.*,rownum\r\n                  from user_tab_columns utc\r\n                 where utc.data_type in ('CHAR', 'VARCHAR2')\r\n                   --and utc.COLUMN_NAME not like 'ATTRIBUTE%' --RESTRINGIR COLUNAS\r\n                   --and utc.TABLE_NAME  like 'APPS_%' --APENAS TABELAS INICIADAS COM APPS\r\n                   --and utc.TABLE_NAME  not like 'TEMP%' --RESTRINGIR TABELAS\r\n                ) \r\n                )\r\n where cnt &gt;= 1<\/pre>\n<p>&nbsp;<\/HTML><\/HTML><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Query\/Consulta que procura um texto em todas as tabelas e colunas do tipo CHAR e ou VARCHAR2 select table_name ,column_name ,query_ds ,cnt from( select table_name,&hellip; <\/p>\n","protected":false},"author":1,"featured_media":10397,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[29,124,138],"tags":[],"class_list":["post-9853","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-base-de-conhecimentos","category-database","category-sql"],"_links":{"self":[{"href":"https:\/\/orabr.virttus.com\/index.php?rest_route=\/wp\/v2\/posts\/9853","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/orabr.virttus.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/orabr.virttus.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/orabr.virttus.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/orabr.virttus.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=9853"}],"version-history":[{"count":5,"href":"https:\/\/orabr.virttus.com\/index.php?rest_route=\/wp\/v2\/posts\/9853\/revisions"}],"predecessor-version":[{"id":10468,"href":"https:\/\/orabr.virttus.com\/index.php?rest_route=\/wp\/v2\/posts\/9853\/revisions\/10468"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/orabr.virttus.com\/index.php?rest_route=\/wp\/v2\/media\/10397"}],"wp:attachment":[{"href":"https:\/\/orabr.virttus.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=9853"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/orabr.virttus.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=9853"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/orabr.virttus.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=9853"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}