Question Locked

how to compare structure of two tables in oracle

0 helpful
3 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

hi

i need help to develop a tool in vb 6.0 to compare structure of two tables of two oracle database. can any body help me out in this.....
or any links where i can find some source code to develop the tool.......

3 replies

by tony hopkinson

Describe MyTable

Not too sure whther you can read the outputof that as a query

If not use the system meta tables DBA_TAB_TABLES and DBA_TAB_COLUMNS

This should give you start
http://download-west.oracle.com/docs/cd/B14117_01/server.101/b10755/toc.htm

Another way is to use ADO

Select Top 1 From MyTable
to get a recordset and then you can compare the columns property which includes the names and types (not sure about things like sizes in varchars for instance though...

A few clues anyway, HtHs

by theju.143

i have done it like this to compare the tables in different users.
in this i am getting the columnnames and datatypes not present in table of user2, but after this i want know how to alter the table of user2 using dif table.........
CREATE TABLE DIF AS
(
select
column_name , data_type, data_length, data_scale, data_precision, column_id
from
all_tab_columns
where
table_name = 'tablename'
and owner = 'user1'
minus
select
column_name , data_type, data_length, data_scale, data_precision, column_id
from
all_tab_columns
where
table_name = 'tablename'
and owner = 'user2');

This discussion is closed to new replies.