Итак, я выяснил, почему мой запрос не удался: фактический запрос был таким:
SELECT
CASE WHEN (suc.transaction_time IS NOT NULL) THEN suc.transaction_time ELSE err.transaction_time END as transaction_time,
CASE WHEN (suc.success_count IS NOT NULL) THEN suc.success_count ELSE 0 END as success_count,
CASE WHEN (err.error_count IS NOT NULL) THEN err.error_count ELSE 0 END as error_count
FROM
(
SELECT
COUNT(et.status) error_count,
DATEADD(MINUTE, FLOOR(DATEDIFF(MINUTE, 0, et.time_in) / :periodInterval) * :periodInterval, 0) AS transaction_time
FROM
ESB_TRANSACTION et
WHERE
(et.status='ERROR') AND (et.time_in BETWEEN :startTime AND :endTime)
GROUP BY DATEADD(MINUTE, FLOOR(DATEDIFF(MINUTE, 0, et.time_in) / :periodInterval) * :periodInterval, 0)
) err
RIGHT OUTER JOIN (
SELECT
COUNT(et.status) success_count,
DATEADD(MINUTE, FLOOR(DATEDIFF(MINUTE, 0, et.time_in) / :periodInterval) * :periodInterval, 0) AS transaction_time
FROM
ESB_TRANSACTION et
WHERE
(et.status='SUCCESS') AND (et.time_in BETWEEN :startTime AND :endTime)
GROUP BY DATEADD(MINUTE, FLOOR(DATEDIFF(MINUTE, 0, et.time_in) / :periodInterval) * :periodInterval, 0)
) suc ON err.transaction_time = suc.transaction_time
ORDER BY transaction_time ASC
параметры: periodInterval, startTime и endTime, добавленные во время выполнения, это было единственное различие между SQLзапрос во время выполнения и другие, которые я выполнял ... поэтому я решил манипулировать запросом sql перед его выполнением:
SELECT
CASE WHEN (suc.transaction_time IS NOT NULL) THEN suc.transaction_time ELSE err.transaction_time END as transaction_time,
CASE WHEN (suc.success_count IS NOT NULL) THEN suc.success_count ELSE 0 END as success_count,
CASE WHEN (err.error_count IS NOT NULL) THEN err.error_count ELSE 0 END as error_count
FROM
(
SELECT
COUNT(et.status) error_count,
DATEADD(MINUTE, FLOOR(DATEDIFF(MINUTE, 0, et.time_in) / {periodInterval}) * :periodInterval, 0) AS transaction_time
FROM
ESB_TRANSACTION et
WHERE
(et.status='ERROR') AND (et.time_in BETWEEN :startTime AND :endTime)
GROUP BY DATEADD(MINUTE, FLOOR(DATEDIFF(MINUTE, 0, et.time_in) / {periodInterval}) * {periodInterval}, 0)
) err
RIGHT OUTER JOIN (
SELECT
COUNT(et.status) success_count,
DATEADD(MINUTE, FLOOR(DATEDIFF(MINUTE, 0, et.time_in) / {periodInterval}) * {periodInterval}, 0) AS transaction_time
FROM
ESB_TRANSACTION et
WHERE
(et.status='SUCCESS') AND (et.time_in BETWEEN :startTime AND :endTime)
GROUP BY DATEADD(MINUTE, FLOOR(DATEDIFF(MINUTE, 0, et.time_in) / {periodInterval}) * {periodInterval}, 0)
) suc ON err.transaction_time = suc.transaction_time
ORDER BY transaction_time ASC
, затем я заменил прямую строку Java для {periodInterval} фактическимминут, полученный SQL-файл содержит только параметры: startTime и: endTime. Я использовал его в режиме гибернации, и все было хорошо.