In addition to some of the other answers provided, if you want to look at the differences in the structure of a table with a table that may have a similar but different structure, you can do this in several ways:
The first one. If you are using Oracle SQL Developer, you can run a description of both tables to compare them:
descr TABLE_NAME1 descr TABLE_NAME2
The second one . The first solution may not be suitable for large tables with a large number of columns. If you want to see only differences in data between two tables, then, as mentioned by several others, you should use the SQL Minus statement.
The third. If you are using Oracle SQL Developer and want to compare the table structure of two tables using different schemas, you can do the following:
- Select "Tools"
- Select "Diff Database"
- Select "Connect to Source"
- Select Destination Connection
- Select the "Standard Object Types" you want to compare.
- Enter "Table Name"
- Click Next until you reach Done.
- Click Finish
- NOTE. In steps 3 and 4, you must select various schemes in which there are objects that you want to compare.
Fourth, if the tables of two tables that you want to compare have more columns, are in the same schema, there is no need to compare more than two tables and are not attractive for visual comparison using the DESCR command, you can use the following to compare differences in table structure:
select a.column_name || ' | ' || b.column_name, a.data_type || ' | ' || b.data_type, a.data_length || ' | ' || b.data_length, a.data_scale || ' | ' || b.data_scale, a.data_precision || ' | ' || b.data_precision from user_tab_columns a, user_tab_columns b where a.table_name = 'TABLE_NAME1' and b.table_name = 'TABLE_NAME2' and ( a.data_type <> b.data_type or a.data_length <> b.data_length or a.data_scale <> b.data_scale or a.data_precision <> b.data_precision ) and a.column_name = b.column_name;
Rex CoolCode Charles Jun 21 '18 at 19:01 2018-06-21 19:01
source share