 -- Test9: Limit logging to ROOT with warn.
 INSERT INTO LOGDATA.LOGS (LEVEL_ID, MESSAGE) VALUES (3, 'Test9: Limit logging to ROOT with warn');
 SET EXPECTED = 'TRUE';
-CALL LOGGING(1, 3, 60);
-SELECT 'TRUE' INTO ACTUAL
-  FROM LOGS
-  WHERE MESSAGE = '[WARN ] ROOT - Cascade call for "LOGGING" enters with 60';
-IF (EXPECTED <> ACTUAL) THEN
- INSERT INTO LOGDATA.LOGS (LEVEL_ID, MESSAGE) VALUES (2, 'Different MESSAGE ' || EXPECTED || ' - ' || ACTUAL);
+SET CASCADE = VAL_62;
+CALL LOGGING(1, 3, CASCADE);
+SELECT 'TRUE' INTO ACTUAL
+  FROM LOGS
+  WHERE MESSAGE = 'LG001. Cascade call limit achieved, for WARN: (0) Cascade call for "LOGGING" enters with ' || CASCADE
+  AND DATE = (SELECT MAX(DATE) FROM LOGDATA.LOGS);
+IF (ACTUAL IS NULL OR EXPECTED <> ACTUAL) THEN
+ INSERT INTO LOGDATA.LOGS (LEVEL_ID, MESSAGE) VALUES (2, 'Different MESSAGE ' || EXPECTED || ' - ' || COALESCE(ACTUAL, 'NULL'));
 END IF;
 COMMIT;
 
 -- Test10: Limit achieved logging to ROOT with warn.
 INSERT INTO LOGDATA.LOGS (LEVEL_ID, MESSAGE) VALUES (3, 'Test10: Limit achieved logging to ROOT with warn');
 SET EXPECTED = 'TRUE';
-DELETE FROM LOGS
-  WHERE MESSAGE LIKE 'LG001. Cascade call limit achieve, for LOG: Cascade call for "LOGGING" enters w%';
-CALL LOGGING(1, 3, 61);
-IF (RAISED_LG001 = FALSE) THEN
- INSERT INTO LOGDATA.LOGS (LEVEL_ID, MESSAGE) VALUES (3, 'Exception not raised');
-ELSE
- INSERT INTO LOGDATA.LOGS (LEVEL_ID, MESSAGE) VALUES (5, 'Exception raised LG001');
-END IF;
-SET RAISED_LG001 = FALSE;
-SELECT 'TRUE' INTO ACTUAL
-  FROM LOGS
-  WHERE MESSAGE LIKE 'LG001. Cascade call limit achieve, for LOG: Cascade call for "LOGGING" enters w%';
+SET CASCADE = MIN_61A;
+CALL LOGGING(1, 3, CASCADE);
+IF (RAISED_LG001 = FALSE) THEN
+ INSERT INTO LOGDATA.LOGS (LEVEL_ID, MESSAGE) VALUES (3, 'Exception not raised LG001');
+ELSE
+ INSERT INTO LOGDATA.LOGS (LEVEL_ID, MESSAGE) VALUES (5, 'Exception raised LG001');
+END IF;
+SET RAISED_LG001 = FALSE;
+SELECT 'TRUE' INTO ACTUAL
+  FROM LOGS
+  WHERE MESSAGE LIKE 'LG001. Cascade call limit achieved, for LOG: Cascade call for "LOGGING" enters w%'
+  AND DATE = (SELECT MAX(DATE) FROM LOGDATA.LOGS)
+  AND LEVEL_ID = 3;
 IF (EXPECTED <> ACTUAL) THEN
  INSERT INTO LOGDATA.LOGS (LEVEL_ID, MESSAGE) VALUES (2, 'Different MESSAGE ' || EXPECTED || ' - ' || ACTUAL);
 END IF;

-- Test3: Limit passed logging to ROOT with fatal.
INSERT INTO LOGDATA.LOGS (LEVEL_ID, MESSAGE) VALUES (3, 'Test3: Limit passed logging to ROOT with fatal');
SET EXPECTED = 'TRUE';
CALL LOGGING(1, 1, 62);
IF (RAISED_LG001 = FALSE) THEN
 INSERT INTO LOGDATA.LOGS (LEVEL_ID, MESSAGE) VALUES (3, 'Exception not raised');
ELSE
 INSERT INTO LOGDATA.LOGS (LEVEL_ID, MESSAGE) VALUES (5, 'Exception raised LG001');
END IF;
SET RAISED_LG001 = FALSE;
SELECT 'TRUE' INTO ACTUAL
  FROM LOGS
  WHERE MESSAGE LIKE 'LG001. Cascade call limit achieve, for FATAL: (0) Cascade call for "LOGGING" en%';
IF (EXPECTED <> ACTUAL) THEN
 INSERT INTO LOGDATA.LOGS (LEVEL_ID, MESSAGE) VALUES (2, 'Different MESSAGE ' || EXPECTED || ' - ' || ACTUAL);
END IF;

-- Test12: Cascade call limit with warn.
INSERT INTO LOGDATA.LOGS (LEVEL_ID, MESSAGE) VALUES (3, 'Test12: Cascade call limit with warn');
SET EXPECTED = 'TRUE';
SET CASCADE = MIN_63;
CALL LOGGING(1, 3, CASCADE);
IF (RAISED_724 = FALSE) THEN
 INSERT INTO LOGDATA.LOGS (LEVEL_ID, MESSAGE) VALUES (3, 'Exception not raised LG001');
ELSE
 INSERT INTO LOGDATA.LOGS (LEVEL_ID, MESSAGE) VALUES (5, 'Exception raised 54038');
END IF;
