---restore content starts---
People want to see what data tables in the database, which fields have "HelloWorld" the string, now the database all the tables, views are not directly available, all must go through the loop to access all the data table, all the field columns, and then go to access all the field names. SQL is as follows:
Declare
V_sql VARCHAR2 (2000);
V_count number;
Begin
For xx in (select T.table_name, T.column_name
From user_tab_cols t) loop
Begin
V_sql: = ' SELECT count (*) from ' | | Xx.table_name | |
' WHERE ' | | Xx.column_name | | ' Like '%helloworld% ';
Execute immediate v_sql into V_count;
if (v_count >= 1) Then
Dbms_output.put_line (' results found ' | | Xx.table_name | | ': ' | | xx.column_name| | ' Total ' | | v_count| | ' Article ');
End If;
exception
When others then
Null
End
End Loop;
Dbms_output.put_line (' OK ');
End
Ok.
Oracle queries the database with a value