diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1f95dfdf1ad575495ce40d05cc4faa47f3414566..64a0884f8f622824bb20d2711134e4a4a99e46f7 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -48,11 +48,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 ### Fixed ###
 
 * Fixed the `>=` and `<=` operators for comparisons in POV query filters with
-  stored DATE values. The fix makes the implementation consistent 
+  stored DATE values. The fix makes the implementation consistent
   However, the current definition and implementation of the
   `>=` and `<=` operators for date and datetime is unintuitive and the operators
   should have another name. Something like "overlap with or smaller/greater
-  than". 
+  than".
 * Semi-fix in `retrieveEntityParents`. The old implementation was buggy and
   would return no parent name or even a wrong one for old entity versions in
   some cases. The semi-fix will allways return the current name of the parent
diff --git a/procedures/query/getDateTimeWhereClause.sql b/procedures/query/getDateTimeWhereClause.sql
index 7fb9c7708b7689b8ad83c77c5f901f5bc20da4e9..8947e04a6640db0f7950d8475304e5f654921584 100644
--- a/procedures/query/getDateTimeWhereClause.sql
+++ b/procedures/query/getDateTimeWhereClause.sql
@@ -176,21 +176,25 @@ BEGIN
     ELSEIF operator = "<=" THEN
         IF mon != 0 and dom != 0 THEN
             -- Full date YYYY-MM-DD
-            RETURN CONCAT(" subdata.value<=",vILB_Date, " or (subdata.value<=", yea*10000 + mon*100, " and subdata.value%100=0)");
+            RETURN CONCAT(" subdata.value<=", vILB_Date,
+                          " or (subdata.value<=", yea*10000 + mon*100, " and subdata.value%100=0)");
         ELSEIF mon != 0 THEN
             -- Date is fragment YYYY-MM
-            RETURN CONCAT(" subdata.value<",vEUB_Date);
+            RETURN CONCAT(" subdata.value<", vEUB_Date);
         ELSE
             -- Date is fragment YYYY
-            RETURN CONCAT(" subdata.value<",vEUB_Date);
+            RETURN CONCAT(" subdata.value<", vEUB_Date);
         END IF;
     ELSEIF operator = ">=" THEN
         IF mon != 0 and dom != 0 THEN
             -- Full date YYYY-MM-DD
-            RETURN CONCAT(" subdata.value>=",vILB_Date, " or (subdata.value>=", yea*10000 + mon*100, " and subdata.value%100=0) or (subdata.value>=", yea*10000, " and subdata.value%10000=0)");
+            RETURN CONCAT(" subdata.value>=", vILB_Date,
+                          " or (subdata.value>=", yea*10000 + mon*100, " and subdata.value%100=0)" +
+                          " or (subdata.value>=", yea*10000, " and subdata.value%10000=0)");
         ELSEIF mon != 0 THEN
             -- Date is fragment YYYY-MM
-            RETURN CONCAT(" subdata.value>=", yea*10000 + mon*100, " or (subdata.value>=", yea*10000, " and subdata.value%10000=0)");
+            RETURN CONCAT(" subdata.value>=", yea*10000 + mon*100,
+                          " or (subdata.value>=", yea*10000, " and subdata.value%10000=0)");
         ELSE
             -- Date is fragment YYYY
             RETURN CONCAT(" subdata.value>=", yea*10000);