In our database system (11gR2) , we have various tables which has common columns and each time we need to make sure that the common columns across different tables have exact same
data_type and data_length. I am checking it using below SQL script.
For example:
SELECT table_name,
column_name,
data_type,
data_length
FROM all_tab_columns
WHERE owner = 'SCOTT'
AND column_name IN ( SELECT column_name
FROM dba_tab_columns
WHERE owner = 'SCOTT'
GROUP BY column_name
HAVING COUNT (column_name) > 1)
It gives some output as
| EMP1 | SAL | NUMBER | 21 |
| EMP | SAL | NUMBER | 22 |
| BONUS | SAL | NUMBER | 22 |
I want to scroll these SQL using some plsql block to verify the same automatically
It should just tell me that SAL column is not in sync and should list tables in which this column exists
Can you please provider some pointers how to achieve this? do I need to use any multi-dimensional array