findout the data
684487Feb 26 2009 — edited Mar 4 2009Hi all experts,
My below query gives me 1200 tables that have colum name PIDM. The PIDM column name is like A_PIDM, B_PIDM , C_PIDM and so on(suppose A,B and C is the tables name). For example if the PIDM id is in A_PIDM = 1, it maybe or may be not other tables(B,C). Now i want to find out those tabels(i mean within 1215 tables) that has column _PIDM=138973. Please give me some suggestions.
SELECT dba_tables.owner, dba_tables.table_name, num_rows, column_name
FROM dba_tables, dba_tab_columns
WHERE
dba_tables.table_name = dba_tab_columns.table_name
AND dba_tables.owner = dba_tab_columns.owner -- Added join condition
AND dba_tables.owner NOT IN
('SYS',
'SySTEM',
'SYSMAN',
'OUTLN',
'DBSNMP',
'WMSYS',
'TSMSYS',
'EXFSYS',
'DMSYS',
'CTXSYS',
'XDB',
'OLAPSYS',
'ORDSYS',
'MDSYS')
AND iot_name IS NULL
AND column_name LIKE('%_PIDM')
/