--THIS FILE IS NEEDED ONLY FOR THE ONLINE UPDATE!!!

CREATE OR REPLACE PROCEDURE V8_UPD_MAINTENANCENOTES IS
  cursor maintenance is select wact_id, wact_description from wact,waty,watg where wact_waty_id=waty_id and waty_watg_id=watg_id and watg_role=6 and  wact_description is not null and wact_want_id is null;
  maintenance_row maintenance%rowtype;
BEGIN
  for maintenance_row in maintenance loop
    insert into WANT (want_id, want_notes) values (seq_want.nextval, maintenance_row.wact_description);
    update wact set wact_want_id=seq_want.currval where wact_id = maintenance_row.wact_id;
  end loop;
   EXCEPTION
     WHEN NO_DATA_FOUND THEN
       NULL;
     WHEN OTHERS THEN
       -- Consider logging the error and then re-raise
       RAISE;
END V8_UPD_MAINTENANCENOTES;
/
