Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Check column data_type and data_length in each schema

user507531Apr 15 2014 — edited Apr 15 2014

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

EMP1SALNUMBER21
EMPSALNUMBER22
BONUSSALNUMBER22

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

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 13 2014
Added on Apr 15 2014
6 comments
1,722 views