Compare same tables from different databases but exclude user_id and date in comparison

  Kiến thức lập trình

I am trying to compare same tables from two different database to achieve the difference rows based on table. For that I have written query:

[select table_name
   from all_tables
  where owner = 'MDWMP']
|
[select @table_name tbl,
        count(*)
   from((select *
        from mdwmp. @table_name:raw 
          minus
          select *
            from mdwmd. @table_name:raw)
         union
         (select *
            from mdwmd. @table_name:raw
          minus
          select *
            from mdwmp. @table_name:raw))] catch(-1403);

where mdwmp is my 1st database and mdwmd is my 2nd database.

This query is giving me an error:

ORA-00932: inconsistent datatypes: expected – got CLOB.

Tables may contain modified_user_id, date&time column. I want to exclude such columns from the comparison and get the unique values.

1

LEAVE A COMMENT