The incorrect script documented is:
Select * from BC_MESSAGES where STATUS IN (
(
select STATUS from BC_TRANSACTIONS where BC_TRANS_ID = BC_MESSAGES.BC_TRANS_ID AND
ts <= TO_TIMESTAMP(<from date>, 'YYYY-MM-DD HH24:MI:SS.FF') AND
ts >= TO_TIMESTAMP(<to date>,'YYYY-MM-DD HH24:MI:SS.FF')
) IN ('COMPLETED', 'ERROR')
)
The correct script should look like the following:
Select * from BC_MESSAGES where BC_TRANS_ID IN ( select BC_TRANS_ID fromBC_TRANSACTIONS where ts >= TO_TIMESTAMP(<from_date>, 'YYYY-MM-DD') ANDts <= TO_TIMESTAMP(<to_date>,'YYYY-MM-DD')) AND status IN ('COMPLETED', 'ERROR');