MDL-34072: Adjust SQL for Oracle

Adjust the ad hoc SQL in course/lib.php routines average_number_of_participants() and average_number_of_course_modules() for Oracle.