 
 -- Test9: Tests null level
 INSERT INTO LOGDATA.LOGS (LEVEL_ID, MESSAGE) VALUES (4, 'Test9: Tests null level');
-INSERT INTO LOGDATA.CONF_LOGGERS (NAME, PARENT_ID, LEVEL_ID)
-  VALUES ('test9', 0, NULL);
+SET EXPECTED_LOGGER = PREVIOUS VALUE FOR LOGDATA.LOGGER_ID_SEQ + 1;
+SET EXPECTED_PARENT = 0;
+SET EXPECTED_LEVEL = NULL;
+SET ACTUAL_PARENT = 0;
+SET ACTUAL_LEVEL = NULL;
+INSERT INTO LOGDATA.CONF_LOGGERS (NAME, PARENT_ID, LEVEL_ID)
+  VALUES ('test9', ACTUAL_PARENT, ACTUAL_LEVEL);
+SELECT LOGGER_ID, PARENT_ID, LEVEL_ID INTO ACTUAL_LOGGER, ACTUAL_PARENT, ACTUAL_LEVEL
+  FROM LOGDATA.CONF_LOGGERS
+  WHERE LOGGER_ID = PREVIOUS VALUE FOR LOGDATA.LOGGER_ID_SEQ;
+IF (EXPECTED_LOGGER <> ACTUAL_LOGGER) THEN
+ INSERT INTO LOGDATA.LOGS (LEVEL_ID, MESSAGE) VALUES (2, 'Different LOGGER_ID ' || EXPECTED_LOGGER || ' - ' || ACTUAL_LOGGER);
+END IF;
+IF (EXPECTED_PARENT <> ACTUAL_PARENT) THEN
+ INSERT INTO LOGDATA.LOGS (LEVEL_ID, MESSAGE) VALUES (2, 'Different PARENT_ID ' || EXPECTED_PARENT || ' - ' || ACTUAL_PARENT);
+END IF;
+IF (EXPECTED_LEVEL <> ACTUAL_LEVEL) THEN
+ INSERT INTO LOGDATA.LOGS (LEVEL_ID, MESSAGE) VALUES (2, 'Different LEVEL_ID ' || EXPECTED_LEVEL || ' - ' || ACTUAL_LEVEL);
+END IF;
 COMMIT;
 
 -- Test10: Tests negative level


-- Test24: Tests to update the level from null.
INSERT INTO LOGDATA.LOGS (LEVEL_ID, MESSAGE) VALUES (4, 'Test24: Tests to update the level from null');
DELETE FROM LOGDATA.CONF_LOGGERS;
INSERT INTO LOGDATA.CONF_LOGGERS (LOGGER_ID, NAME, PARENT_ID, LEVEL_ID)
  VALUES (0, 'ROOT', NULL, NULL);
INSERT INTO LOGDATA.CONF_LOGGERS (NAME, PARENT_ID, LEVEL_ID)
  VALUES ('Test24', 0, NULL);
UPDATE LOGDATA.CONF_LOGGERS
  SET LEVEL_ID = 2
  WHERE LOGGER_ID = PREVIOUS VALUE FOR LOGDATA.LOGGER_ID_SEQ;

-- Test25: Tests to update the level.
INSERT INTO LOGDATA.LOGS (LEVEL_ID, MESSAGE) VALUES (4, 'Test25: Tests to update the level');
DELETE FROM LOGDATA.CONF_LOGGERS;
INSERT INTO LOGDATA.CONF_LOGGERS (LOGGER_ID, NAME, PARENT_ID, LEVEL_ID)
  VALUES (0, 'ROOT', NULL, NULL);
INSERT INTO LOGDATA.CONF_LOGGERS (NAME, PARENT_ID, LEVEL_ID)
  VALUES ('Test25', 0, 3);
UPDATE LOGDATA.CONF_LOGGERS
  SET LEVEL_ID = 2
  WHERE LOGGER_ID = PREVIOUS VALUE FOR LOGDATA.LOGGER_ID_SEQ;

-- Test26: Tests to update the level to null.
INSERT INTO LOGDATA.LOGS (LEVEL_ID, MESSAGE) VALUES (4, 'Test26: Tests to update the level to null');
DELETE FROM LOGDATA.CONF_LOGGERS;
INSERT INTO LOGDATA.CONF_LOGGERS (LOGGER_ID, NAME, PARENT_ID, LEVEL_ID)
  VALUES (0, 'ROOT', NULL, NULL);
INSERT INTO LOGDATA.CONF_LOGGERS (NAME, PARENT_ID, LEVEL_ID)
  VALUES ('Test26', 0, 3);
UPDATE LOGDATA.CONF_LOGGERS
  SET LEVEL_ID = NULL
  WHERE LOGGER_ID = PREVIOUS VALUE FOR LOGDATA.LOGGER_ID_SEQ;

-- Test25: Tests to update root's level.
INSERT INTO LOGDATA.LOGS (LEVEL_ID, MESSAGE) VALUES (4, 'Test25: Tests to update root''s level');
DELETE FROM LOGDATA.CONF_LOGGERS;
INSERT INTO LOGDATA.CONF_LOGGERS (LOGGER_ID, NAME, PARENT_ID, LEVEL_ID)
  VALUES (0, 'ROOT', NULL, NULL);
UPDATE LOGDATA.CONF_LOGGERS
  SET LEVEL_ID = 2
  WHERE LOGGER_ID = 1;

-- Cleans the environment.
INSERT INTO LOGDATA.LOGS (LEVEL_ID, MESSAGE) VALUES (3, 'TestsConfLogger: Finished succesfully');


-- Test4: Tests null id
INSERT INTO LOGDATA.LOGS (LEVEL_ID, MESSAGE) VALUES (4, 'Test4: Tests null id');
SET EXPECTED_LOGGER = PREVIOUS VALUE FOR LOGDATA.LOGGER_ID_SEQ + 1;
SET EXPECTED_PARENT = 0;
SET EXPECTED_LEVEL = 4;
SET ACTUAL_PARENT = 0;
SET ACTUAL_LEVEL = 4;
INSERT INTO LOGDATA.CONF_LOGGERS (LOGGER_ID, NAME, PARENT_ID, LEVEL_ID)
  VALUES (NULL, 'test4', ACTUAL_PARENT, ACTUAL_LEVEL);
SELECT LOGGER_ID, PARENT_ID, LEVEL_ID INTO ACTUAL_LOGGER, ACTUAL_PARENT, ACTUAL_LEVEL
  FROM LOGDATA.CONF_LOGGERS
  WHERE LOGGER_ID = PREVIOUS VALUE FOR LOGDATA.LOGGER_ID_SEQ;
IF (EXPECTED_LOGGER <> ACTUAL_LOGGER) THEN
 INSERT INTO LOGDATA.LOGS (LEVEL_ID, MESSAGE) VALUES (2, 'Different LOGGER_ID ' || EXPECTED_LOGGER || ' - ' || ACTUAL_LOGGER);
END IF;
IF (EXPECTED_PARENT <> ACTUAL_PARENT) THEN
 INSERT INTO LOGDATA.LOGS (LEVEL_ID, MESSAGE) VALUES (2, 'Different PARENT_ID ' || EXPECTED_PARENT || ' - ' || ACTUAL_PARENT);
END IF;
IF (EXPECTED_LEVEL <> ACTUAL_LEVEL) THEN
 INSERT INTO LOGDATA.LOGS (LEVEL_ID, MESSAGE) VALUES (2, 'Different LEVEL_ID ' || EXPECTED_LEVEL || ' - ' || ACTUAL_LEVEL);
END IF;
COMMIT;

-- Test5: Tests negative id
INSERT INTO LOGDATA.LOGS (LEVEL_ID, MESSAGE) VALUES (4, 'Test5: Tests negative id');
SET EXPECTED_LOGGER = PREVIOUS VALUE FOR LOGDATA.LOGGER_ID_SEQ + 1;
SET EXPECTED_PARENT = 0;
SET EXPECTED_LEVEL = 5;
SET ACTUAL_PARENT = 0;
SET ACTUAL_LEVEL = 5;
INSERT INTO LOGDATA.CONF_LOGGERS (LOGGER_ID, NAME, PARENT_ID, LEVEL_ID)
  VALUES (-1, 'test5', ACTUAL_PARENT, ACTUAL_LEVEL);
SELECT LOGGER_ID, PARENT_ID, LEVEL_ID INTO ACTUAL_LOGGER, ACTUAL_PARENT, ACTUAL_LEVEL
  FROM LOGDATA.CONF_LOGGERS
  WHERE LOGGER_ID = PREVIOUS VALUE FOR LOGDATA.LOGGER_ID_SEQ;
IF (EXPECTED_LOGGER <> ACTUAL_LOGGER) THEN
 INSERT INTO LOGDATA.LOGS (LEVEL_ID, MESSAGE) VALUES (2, 'Different LOGGER_ID ' || EXPECTED_LOGGER || ' - ' || ACTUAL_LOGGER);
END IF;
IF (EXPECTED_PARENT <> ACTUAL_PARENT) THEN
 INSERT INTO LOGDATA.LOGS (LEVEL_ID, MESSAGE) VALUES (2, 'Different PARENT_ID ' || EXPECTED_PARENT || ' - ' || ACTUAL_PARENT);
END IF;
IF (EXPECTED_LEVEL <> ACTUAL_LEVEL) THEN
 INSERT INTO LOGDATA.LOGS (LEVEL_ID, MESSAGE) VALUES (2, 'Different LEVEL_ID ' || EXPECTED_LEVEL || ' - ' || ACTUAL_LEVEL);
END IF;
COMMIT;

-- Test6: Tests null name
