Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

stored procedure to compare two tables.

673809Apr 3 2009 — edited Apr 3 2009
Hi,

I would like to compare these two tables using stored procedures.

dept1
SQL> select * from dept1;

DEPTNO DNAME LOC
---------- -------------- -------------
10 ACCOUNTING NEW YORK
20 RESEARCH DALLAS
30 SALES CHICAGO
40 OPERATIONS BOSTON


dept2:
SQL>select * from dept2;

DEPTNO DNAME LOC
---------- -------------- -------------
10 ACCOUNTING NEW YORK
20 RESEARCH DALLAS
30 IT VIRGINIA
40 OPERATIONS BOSTON


I have
select * from dept1 minus select * from dept2
union all
select * from dept2 minus select * from dept1;

query but unable to convert that into stored procedure. I'm learning pl/sql and trying to compare these tables.
oracle 11, windows vista.

I wan to compare dept1 and dept2 using procedure, cursors and place the difference between two tables in log file.

any other method than minus query to compare tables?

Thanks,
kalyan

Edited by: user10676396 on Apr 3, 2009 12:27 PM
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 1 2009
Added on Apr 3 2009
7 comments
2,386 views