Identifying tables with specific contents in Oracle SQL Developer(在Oracle SQL Developer中标识具有特定内容的表)
本文介绍了在Oracle SQL Developer中标识具有特定内容的表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试在包含数百个表的数据库中查找数据。我当前正在选择STARING&QOOT;每个表格查看其内容,这将耗费很长时间(&Q)!有没有办法可以把所有有具体内容的表都写到过滤上查询呢?例如,假设我想要在任何列中查找包含&montana";的所有表。这可能吗?
推荐答案
如果您循环遍历所有";character";-like列,您可以这样做(它还会计算在该表/列中找到搜索字符串的次数)。我没有弗吉尼亚,所以我要找金。
SQL> set serveroutput on
SQL> declare
2 l_cnt number;
3 begin
4 for cur_r in (select table_name, column_name
5 from user_tab_columns
6 where data_type like '%CHAR%'
7 )
8 loop
9 execute immediate 'select count(*) from ' || cur_r.table_name ||
10 ' where ' || cur_r.column_name ||' = ' ||
11 chr(39) || 'KING' || chr(39)
12 into l_cnt;
13 if l_cnt > 0 then
14 dbms_output.put_line(cur_r.table_name ||'.'|| cur_r.column_name ||': '|| l_cnt);
15 end if;
16 end loop;
17 end;
18 /
EMP.ENAME: 1
V_EMP.ENAME: 1
PL/SQL procedure successfully completed.
SQL>
这篇关于在Oracle SQL Developer中标识具有特定内容的表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
织梦狗教程
本文标题为:在Oracle SQL Developer中标识具有特定内容的表
基础教程推荐
猜你喜欢
- 在多列上分布任意行 2021-01-01
- 如何在 SQL 中将 Float 转换为 Varchar 2021-01-01
- oracle区分大小写的原因? 2021-01-01
- MySQL 中的类型:BigInt(20) 与 Int(20) 2021-01-01
- 如何根据该 XML 中的值更新 SQL 中的 XML 2021-01-01
- 什么是 orradiag_<user>文件夹? 2022-01-01
- 在 MySQL 中:如何将表名作为存储过程和/或函数参数传递? 2021-01-01
- mysql选择动态行值作为列名,另一列作为值 2021-01-01
- 表 './mysql/proc' 被标记为崩溃,应该修复 2022-01-01
- 二进制文件到 SQL 数据库 Apache Camel 2021-01-01
