oracle - 如何在每个模式的所有表的所有列中搜索值?

时间:2015-06-21 15:22:19

标签: oracle plsql

我找到following script来帮助我在特定架构的所有表中的所有列中找到一个值,其中包含“dummy”一词:

variable val varchar2(10)
exec :val := 'KING'

SELECT DISTINCT SUBSTR (:val, 1, 11) "Searchword",
SUBSTR (table_name, 1, 14) "Table",
SUBSTR (column_name, 1, 14) "Column"
FROM cols,
TABLE (xmlsequence (dbms_xmlgen.getxmltype ('select '
|| column_name
|| ' from '
|| table_name
|| ' where upper('
|| column_name
|| ') like upper(''%'
|| :val
|| '%'')' ).extract ('ROWSET/ROW/*') ) ) t
ORDER BY "Table" 

它对我很有用,但在特定架构中必须有blobclob类型的结果,因为我收到以下错误:

ORA-19202: Error occurred in XML processing
ORA-00932: inconsistent datatypes: expected CHAR got BLOB
ORA-06512: at "SYS.DBMS_XMLGEN", line 288
ORA-06512: at line 1

“忽略”只是停止了所有过程,并没有给我任何结果。 我该怎么办?

由于

0 个答案:

没有答案