IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Two tables of same structure need to be compared


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
ashokakash

New User


Joined: 15 Nov 2006
Posts: 21
Location: Chennai

PostPosted: Thu Dec 13, 2007 4:47 pm
Reply with quote

Hi,

I have two tables. Both the table structures are exactly one and same. Now I need to compare the values of each column of each row against the other. Do we have any utility to do that using batch jobs.

If any other suggestion to accomplish this would be appreciated

Thanks in advance

Akash
Back to top
View user's profile Send private message
arivazhagan_k

New User


Joined: 05 Dec 2007
Posts: 57
Location: chennai

PostPosted: Thu Dec 13, 2007 6:00 pm
Reply with quote

compare two tables difference


T1 EXCEPT T2
UNION ALL
T2 EXCEXT T1[/color]

EXCEPT ALL is better if your tables have no keys.

and don't forget the brackets otherwise you will be doing
(((T1 EXCEPT ALL T2) UNION ALL T2) EXCEPT ALL T1) !


with a(a) as (values (1), (1),(2))
, b(b) as (values(1),(2),(2))
(select * from a
except ALL
select * from b)
union all
(select * from b
except ALL
select * from a)
;
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Fri Dec 14, 2007 1:43 am
Reply with quote

Hello,

You might simply unload both tables and then use SUPERC to compare. Part of this decision would be how large the volume of data.
Back to top
View user's profile Send private message
PeD

Active User


Joined: 26 Nov 2005
Posts: 459
Location: Belgium

PostPosted: Fri Dec 14, 2007 2:07 am
Reply with quote

Why double post?
Back to top
View user's profile Send private message
ashokakash

New User


Joined: 15 Nov 2006
Posts: 21
Location: Chennai

PostPosted: Fri Dec 14, 2007 8:40 pm
Reply with quote

@PeD: Sorry I did not get what I expected. So I wanted to make my question clear. Posting my question as a continuation in stead I posted it as a separate entry.

Ny way Thanks for all those who helped me.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Need to fetch data from so many DB2 t... DB2 9
No new posts How to: PK does not exist in several ... DB2 6
No new posts Discrepancy b/w SYSIBM tables and BMC... DB2 0
No new posts SYSIBM Tables Query DB2 8
No new posts Column names in SYSIBM tables DB2 5
Search our Forums:

Back to Top