Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Searching a value into a DB

Status
Not open for further replies.

cadbilbao

Programmer
Apr 9, 2001
233
ES
Hi!

I am looking for a script to search a value into every tables of a DataBase (Unix - Oracle 8.0.4).

Regards.
 
I think this will do what you want:

SPOOL FINDER.sql
SELECT 'select '''||table_name||'.'||column_name||''', count(*) from '
||table_name||' where '||column_name||' = ''MY_TARGET'' GROUP BY
'''||table_name||'.'||column_name||''';'
from dba_tab_columns where data_type = 'VARCHAR2';
SPOOL OFF
@FINDER

You will have to replace MY_TARGET with whatever value it is you are
looking for.
Also, you will have to change VARCHAR2 to whatever datatype (DATE,
NUMBER, etc) you are looking for.

Be advised - this will probably take a long time to run.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top