www .Just SQL. com  

Script Name :

Description :

a site for the SQL*Plus specialist

Site Map


To compare two tables with the same definition, but possibly differemt values in one or more column attributes.

There are various ways of comparing the contents of two tables with the same structure but (potentially) different data contents. Two alternatives will be presented.

The most simple way requires no special script, and is as follows:
          select * from Table_1
     select * from Table_2;

and then the converse:
          select * from Table_2
     select * from Table_1;

This compares every field in one table against every equivalent field in the other table.

The comparison against the contents of fields may require that one or more data types are explicitly excluded from the comparison. This facility is available in the field-by-field comparison script.

A more sophisticated way to compare tables is on the basis of their Primary Keys alone, or all fields. These examples will work on one instance only. A subsequent release may appear to compare tables on remote instances.

Primary Key comparison

Field-by-Field comparison

[Home] [Inspiration] [About this Site] [Scripts Intro] [Publications]

e-Mail Connection