Link to home
Start Free TrialLog in
Avatar of Beam
Beam

asked on

PL/SQL procedure to compare rows in two tables

Hello there,

I need to write a procedure to compare the results in two tables. Lets call them table1 and table 2.

The field I am trying to compare is called prod_id with holds integer.

For everytime the value in 'prod_id' in  table 1 matches a value in 'prod_id' in table 2, I want to set another field in table 1 called 'match (boolean) to true elseif no match false.

So for example:

      Table 1              Table 2
prod_id  match         prod_id
1            FALSE             3
2            FALSE             7
3            TRUE              8
4            FALSE             9

I guess I need two cursors and then run some sort of loop to compare the first  row of Table 1 to every row of Table 2. Then the second row of Table 1 to every row of Table 2 and so on ?

Please could someone outline a procedure as this is driving me mad.

Thanks

Ren

ASKER CERTIFIED SOLUTION
Avatar of ToddBarry
ToddBarry

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Avatar of slightwv (䄆 Netminder)
slightwv (䄆 Netminder)

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Beam
Beam

ASKER

Thanks for the quick reply.

Thats is just what I was looking for.

Thanks again