pre-insert trigger [message #677595] |
Sun, 29 September 2019 14:20 |
|
tayshaun
Messages: 5 Registered: September 2019
|
Junior Member |
|
|
have a problem in a form, which is that I have a pre-insert trigger for when I exceed the quantity, it shows me a message, but when I exceed it, it does not show me any message and it allows me to save the record, and if the amount is exceeded you should not save and show me the message, which help would be appreciated.
DECLARE
v_cant_e NUMBER (5);
v_cant_s NUMBER (5);
v_total NUMBER (5);
BEGIN
BEGIN
SELECT SUM (quantity)
INTO v_cant_e
FROM mov
WHERE cod_mov = :mov.cod_mov
AND date_mov <= :mov.date_mov
AND signo = '+';
EXCEPTION
WHEN OTHERS
THEN
v_cant_e := 0;
END;
BEGIN
SELECT SUM (quantity)
INTO v_cant_s
FROM mov
WHERE cod_mov = :mov.cod_mov
AND date_mov <= :mov.date_mov
AND signo = '-';
EXCEPTION
WHEN OTHERS
THEN
v_cant_s := 0;
END;
v_total := v_cant_e - v_cant_s;
IF v_total < 0
THEN
MESSAGE ('quantity exceeded on Article ' || :mov.cod_mov);
MESSAGE ('quantity exceeded on Article ' || :mov.cod_mov);
RAISE form_trigger_failure;
END IF;
END;
[EDITED by LF: fixed code formatting]
[Updated on: Mon, 30 September 2019 05:40] by Moderator Report message to a moderator
|
|
|