PRJ-1235 Added WHEN clause for scheduling