Im updating a trigger. I am trying to create an exception such that if v_pv_count > 0 then do not go into the loop.
It is not working. Help appreciated.
SELECT COUNT(*) INTO V_PV_COUNT
FROM C_ACTION
WHERE C_CNO = :NEW.CSM_CNO
AND C_TYPE = 'BLD'
AND A_MENU_ID = 'B'
AND A_CODE = 'B021';
IF NEW.C_TYPE IN('BLD') AND :NEW.A_MENU_ID in ('I','J') AND :NEW.CS_ASSI_TO IS NULL) THEN
IF (V_PV_COUNT >0) THEN
:NEW.CS_ASSI_TO :='XX';
END IF;
ELSE IF (V_PV_COUNT <=0) THEN
for rw in c_act_par_with_b_inp loop
:new.cs_assi_to := rw.prc_b_combo_area;
end loop;
END IF;
END IF;
It is not working. Help appreciated.
SELECT COUNT(*) INTO V_PV_COUNT
FROM C_ACTION
WHERE C_CNO = :NEW.CSM_CNO
AND C_TYPE = 'BLD'
AND A_MENU_ID = 'B'
AND A_CODE = 'B021';
IF NEW.C_TYPE IN('BLD') AND :NEW.A_MENU_ID in ('I','J') AND :NEW.CS_ASSI_TO IS NULL) THEN
IF (V_PV_COUNT >0) THEN
:NEW.CS_ASSI_TO :='XX';
END IF;
ELSE IF (V_PV_COUNT <=0) THEN
for rw in c_act_par_with_b_inp loop
:new.cs_assi_to := rw.prc_b_combo_area;
end loop;
END IF;
END IF;