$ 0 0 So, what is your actual requirement? Why not sort by ((CMTMT_DT - Date '1900-01-01') Mod 7) + 1 ?