Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Two tables of same structure need to be compared

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
ashokakash

New User


Joined: 15 Nov 2006
Posts: 18
Location: Chennai

PostPosted: Thu Dec 13, 2007 4:47 pm    Post subject: Two tables of same structure need to be compared
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    Post subject: may be this is usefull for you
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

Site Director


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

PostPosted: Fri Dec 14, 2007 1:43 am    Post subject:
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: 456
Location: Belgium

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

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

New User


Joined: 15 Nov 2006
Posts: 18
Location: Chennai

PostPosted: Fri Dec 14, 2007 8:40 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Data replication from multiple Db2 ta... kishpra DB2 9 Mon Mar 27, 2017 9:58 pm
No new posts SPUFI -- Joining 3 tables – data in... Sysaron DB2 2 Wed Mar 08, 2017 4:18 am
No new posts To know activities on db2 tables ashek15 DB2 4 Fri Mar 03, 2017 11:23 pm
No new posts ERM-Diagram of SysIBM-Catalog-Tables Auryn DB2 2 Fri Feb 17, 2017 6:22 pm
No new posts Copybook structure in Load module Vai123 COBOL Programming 7 Fri Sep 16, 2016 8:29 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us