Dear friends,
I create a calculation view with this SQL statement, but when I execute the follow SQL statement, it will have this exception:1299
I know because it have no record to return, but this is the normal situation, When there is no record I want to return 0.
WHILE :v_round <= 38 DO
SELECT COUNT(*) INTO v_c_1
FROM :var_sub
WHERE "LEAGUE" = I_LEAGUE
AND "SEASON" = I_SEASON
AND "A_ROUND" = v_round
AND "RESULT" = 'F'
GROUP BY "LEAGUE","SEASON","A_ROUND","RESULT";
END WHILE
I try EXIT HANDLER AS this, but it still have the exception, how do I handle this exception, I just want it return 0.
BEGIN
DECLARE EXIT HANDLER FOR SQL_ERROR_CODE 1299 v_c_1 := 0;
SELECT COUNT(*) INTO v_c_1
FROM :var_sub
WHERE "LEAGUE" = I_LEAGUE
AND "SEASON" = I_SEASON
AND "A_ROUND" = v_round
AND "RESULT" = 'F'
GROUP BY "LEAGUE","SEASON","A_ROUND","RESULT";
END;
Best Regards
Zhang
