Oracle Search all tables all columns for string(Oracle 在所有表的所有列中搜索字符串)
问题描述
我需要在我们的 oracle 数据库中搜索所有表和列中的字符串.我在网上找到了以下查询,但是当我执行它时出现以下错误
I need to search our oracle database for a string in all tables and columns. I have the below query I found online but when I execute it I get the following error
感谢任何帮助
推荐答案
至少需要查询ALL_TAB_COLUMNS,而不是ALL_TABLES
At a minimum, you need to query ALL_TAB_COLUMNS, not ALL_TABLES
然而,如果您正在寻找一个字符串,您几乎肯定希望限制自己寻找可以存储字符串的列.例如,在 DATE 列中搜索字符串是没有意义的.除非您对 BLOB 列包含的内容以及解析 BLOB 列的二进制格式的能力有大量先验知识,否则在 BLOB 列中搜索字符串是没有意义的.鉴于此,我怀疑您想要更像
If you are looking for a string, however, you would almost certainly want to restrict yourself to looking for columns that could store a string. It wouldn't make sense, for example, to search a DATE column for a string. And unless you have a great deal of a priori knowledge about what a BLOB column contains and the ability to parse the BLOB column's binary formatting, it wouldn't make sense to search a BLOB column for a string. Given that, I suspect you want something more like
当然,这会非常慢——您需要对每个表中的每个字符串列进行一次全面扫描.对于中等大的表和中等数量的字符串列,这可能需要很长时间.
Of course, this is going to be insanely slow-- you'd full scan every table once for every string column in the table. With moderately large tables and a moderate number of string columns, that is likely to take quite a while.
这篇关于Oracle 在所有表的所有列中搜索字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!