diff --git a/32_7.sql b/32_7.sql index cee0cbe..84309af 100644 --- a/32_7.sql +++ b/32_7.sql @@ -155,7 +155,19 @@ begin NEW_APP_NOTE_STATUS = cast(:EXEC_BLOCK_32_NEG_1_OUT_VAL as D_INTEGER); else if (:EXEC_BLOCK_32_NEG_1_OUT_KEY = 'ID_APP_TASK') then - NEW_APP_NOTE_ID_APP_TASK = cast(:EXEC_BLOCK_32_NEG_1_OUT_VAL as D_BIGINT); + begin + if (exists(select 1 + from APP_TASK T + where T.ID_APP_TASK = cast(:EXEC_BLOCK_32_NEG_1_OUT_VAL as D_BIGINT))) then + NEW_APP_NOTE_ID_APP_TASK = cast(:EXEC_BLOCK_32_NEG_1_OUT_VAL as D_BIGINT); + else + begin + output = -3;/*Не найден APP_TASK*/ + suspend; + exit; + end + + end end