in reply to Code flow not going to while loop
Try explicitly converting the character string to a date with the to_date(...)
Good idea. TO_DATE() is a synonym for the TIMESTAMP_FORMAT. Being clearer, i would use the latter.
Judging from the documentation, he could just go all the way with TIMESTAMP_FORMAT(?, 'YYYY-MM-DD HH24:MI:SS').