I need some suggestion ( or code ) for comparing two cursors
Both cursors fetch employee id and employee name (similar data)
I need to compare the two cursors and identify the common records But I am unable to do so . I need to identify all the common employees in both loops and print them out.
Here is my code.
create or replace procedure compare_cursor as
cursor c1 is select * from employee where hire_date ='10/10/06';
cursor c2 is select * from employee where location ='LONDON';
begin
for x1 in c1
loop
for x2 in c2
loop
if x1.emp_id = x2.emp_id then
dbms_output.put_line(x1.emp_id || ' is repeating ');
end loop;
end loop;
end compare_cursor ;
Both cursors fetch employee id and employee name (similar data)
I need to compare the two cursors and identify the common records But I am unable to do so . I need to identify all the common employees in both loops and print them out.
Here is my code.
create or replace procedure compare_cursor as
cursor c1 is select * from employee where hire_date ='10/10/06';
cursor c2 is select * from employee where location ='LONDON';
begin
for x1 in c1
loop
for x2 in c2
loop
if x1.emp_id = x2.emp_id then
dbms_output.put_line(x1.emp_id || ' is repeating ');
end loop;
end loop;
end compare_cursor ;