I want to compare table OLD with table NEW . If two fields of table NEW are equal to table OLD then i need to update the remaining fields of table OLD with table NEW values.OTHER WISE I NEED TO INSERT I am trying to do this by this code . It is updating but while inserting it giving error as

error:

oldname must be declared so how i can call 2nd cursor in this , is there any other solution for this.
-------========= CODE===========

DECLARE
CURSOR OLDCUR IS SELECT * FROM OLD;
CURSOR NEWCUR IS SELECT * FROM NEW;
UPD NUMBER:= 0 ;
INS NUMBER:=0;
BEGIN

FOR NEWREC IN NEWCUR loop
UPDATE OLD SET

OLD_NAME = NEWREC.NEW_NAME,
OLD_CITY = NEWREC.NEW_CITY,
OLD_NO = NEWREC.NEW_NO


WHERE OLD_NO = NEWREC.NEW_NO
AND OLD_NAME = NEWREC.NEW_NAME;


--HERE I WANT TO COMPARE AS

IF ((OLD_NAME !=NEWREC.NEW_NAME AND OLD_NAME = NEWREC.NEW_NAME)


OR

((OLD_NAME =NEWREC.NEW_NAME AND OLD_NAME != NEWREC.NEW_NAME) THEN

--it is giving error as OLD_NAME MUST BE DECLARED. BUT HOW CAN -----WE GET ANOTHER CURSOR HERE


INSERT INTO OLD (OLD_NO,OLD_NAME,OLD_CITY)
VALUES (NEWREC.NEW_NO,NEWREC.NEW_NAME,NEWREC.NEW_CITY);
INS := INS + 1 ;

END IF;
end if;

commit;
END LOOP;


dbms_output.put_line('INSERTS '||INS);
EXCEPTION
WHEN OTHERS THEN
dbms_output.put_line('Procedure Error '||sqlerrm(sqlcode));

END;
/

Thanks.