Do i need to write in PL/SQL or is it possible in SQL query?
yes, simple update statement does this:
UPDATE table_name1 T1 SET (id, name) = (SELECT T2.id, T2.name FROM table_name2 T2 WHERE T1.REF = T2.REF) WHERE EXISTS (SELECT 1 FROM table_name2 T2 WHERE T1.id = T2.id);