     SET VALUE = '5'
     WHERE KEY = 'defaultRootLevelId';
   CALL LOGGER.DEACTIVATE_CACHE();
+  UPDATE LOGDATA.CONF_LOGGERS
+    SET LEVEL_ID = 1
+    WHERE LOGGER_ID = 0;
+  -- 31 niveles
   CALL LOGGER.GET_LOGGER('2.3.4.5.6.7.8.9.0.1.2.3.4.5.6.7.8.9.0.1.2.3.4.5.6.7.'
     || '8.9.0.1', ACTUAL_LOGGER);
   SET EXPECTED_LOGGER = (SELECT MAX(LOGGER_ID)
       FROM LOGDATA.CONF_LOGGERS);
-  UPDATE LOGDATA.CONF_LOGGERS_EFFECTIVE
-    SET LEVEL_ID = 1
-    WHERE LOGGER_ID = 0;
-  UPDATE LOGDATA.CONF_LOGGERS
-    SET LEVEL_ID = EXPECTED_LEVEL
-    WHERE LOGGER_ID = 0;
-  SELECT LEVEL_ID INTO ACTUAL_LEVEL
-    FROM LOGDATA.CONF_LOGGERS
-    WHERE LOGGER_ID = 0;
-
-  CALL DB2UNIT.ASSERT_INT_EQUALS('Test40: 1Update after limit second update',
-    EXPECTED_LEVEL, ACTUAL_LEVEL);
-
-  SELECT LEVEL_ID INTO ACTUAL_LEVEL
-    FROM LOGDATA.CONF_LOGGERS
+  UPDATE LOGDATA.CONF_LOGGERS
+    SET LEVEL_ID = EXPECTED_LEVEL
+    WHERE LOGGER_ID = 0;
+  SELECT LEVEL_ID INTO ACTUAL_LEVEL
+    FROM LOGDATA.CONF_LOGGERS_EFFECTIVE
+    WHERE LOGGER_ID = 0;
+
+  CALL DB2UNIT.ASSERT_INT_EQUALS('Test40: 1Update after limit',
+    EXPECTED_LEVEL, ACTUAL_LEVEL);
+
+  SELECT LEVEL_ID INTO ACTUAL_LEVEL
+    FROM LOGDATA.CONF_LOGGERS_EFFECTIVE
     WHERE LOGGER_ID = EXPECTED_LOGGER;
   SET EXPECTED_LOGGER = 0;
 
-  CALL DB2UNIT.ASSERT_INT_EQUALS('Test40: 2Update after limit second update',
-    EXPECTED_LEVEL, ACTUAL_LEVEL);
-  CALL DB2UNIT.ASSERT_INT_EQUALS('Test40: 3Update after limit second update',
+  CALL DB2UNIT.ASSERT_INT_EQUALS('Test40: 2Update after limit',
+    EXPECTED_LEVEL, ACTUAL_LEVEL);
+  CALL DB2UNIT.ASSERT_INT_EQUALS('Test40: 3Update after limit',
     EXPECTED_LOGGER, ACTUAL_LOGGER);
  END @
 

    SET VALUE = '5'
    WHERE KEY = 'defaultRootLevelId';
  CALL LOGGER.DEACTIVATE_CACHE();
  CALL LOGGER.GET_LOGGER('1.2.3.4.5.6.7.8.9.0.1.2.3.4.5.6.7.8.9.0.1.2.3.4.5.6.'
    || '7.8.9.0', ACTUAL_LOGGER);
  SET EXPECTED_LOGGER = (SELECT MAX(LOGGER_ID)
      FROM LOGDATA.CONF_LOGGERS);
  UPDATE LOGDATA.CONF_LOGGERS_EFFECTIVE
    SET LEVEL_ID = 1
    WHERE LOGGER_ID = 0;
  UPDATE LOGDATA.CONF_LOGGERS
    SET LEVEL_ID = EXPECTED_LEVEL
    WHERE LOGGER_ID = 0;
  SELECT LEVEL_ID INTO ACTUAL_LEVEL
    FROM LOGDATA.CONF_LOGGERS
    WHERE LOGGER_ID = 0;

  CALL DB2UNIT.ASSERT_INT_EQUALS('Test39: 1Tests to update limit second update',
    EXPECTED_LEVEL, ACTUAL_LEVEL);

  SELECT LEVEL_ID INTO ACTUAL_LEVEL
    FROM LOGDATA.CONF_LOGGERS
    WHERE LOGGER_ID = EXPECTED_LOGGER;

  CALL DB2UNIT.ASSERT_INT_EQUALS('Test39: 2Tests to update limit second update',
    EXPECTED_LEVEL, ACTUAL_LEVEL);
  CALL DB2UNIT.ASSERT_INT_EQUALS('Test39: 3Tests to update limit second update',
    EXPECTED_LOGGER, ACTUAL_LOGGER);
 END @

-- Test40: Tests to update after limit second update.
CREATE OR REPLACE PROCEDURE TEST_40()
 BEGIN
  DECLARE EXPECTED_LOGGER ANCHOR DATA TYPE TO LOGDATA.CONF_LOGGERS.LOGGER_ID;

  DECLARE ACTUAL_LOGGER ANCHOR DATA TYPE TO LOGDATA.CONF_LOGGERS.LOGGER_ID;
  DECLARE ACTUAL_LEVEL ANCHOR DATA TYPE TO LOGDATA.LEVELS.LEVEL_ID;

  SET EXPECTED_LEVEL = 5;
  UPDATE LOGDATA.CONFIGURATION
    SET VALUE = '3'
    WHERE KEY = 'defaultRootLevelId';
  CALL LOGGER.DEACTIVATE_CACHE();
  UPDATE LOGDATA.CONF_LOGGERS
    SET LEVEL_ID = 4
    WHERE LOGGER_ID = 0;
  -- 28 niveles
  CALL LOGGER.GET_LOGGER('9.0.1.2.3.4.5.6.7.8.9.0.1.2.3.4.5.6.7.8.9.0.1.2.3.4.'
    || '5.6.7', ACTUAL_LOGGER);
  SET EXPECTED_LOGGER = (SELECT MAX(LOGGER_ID)
      FROM LOGDATA.CONF_LOGGERS);
  UPDATE LOGDATA.CONF_LOGGERS
    SET LEVEL_ID = EXPECTED_LEVEL
    WHERE LOGGER_ID = 0;
  SELECT LEVEL_ID INTO ACTUAL_LEVEL
    FROM LOGDATA.CONF_LOGGERS_EFFECTIVE
    WHERE LOGGER_ID = 0;

  CALL DB2UNIT.ASSERT_INT_EQUALS('Test37: 1Tests to update before limit',
    EXPECTED_LEVEL, ACTUAL_LEVEL);

  SELECT LEVEL_ID INTO ACTUAL_LEVEL
    FROM LOGDATA.CONF_LOGGERS_EFFECTIVE
    WHERE LOGGER_ID = EXPECTED_LOGGER;

  CALL DB2UNIT.ASSERT_INT_EQUALS('Test37: 2Tests to update before limit',
