questionlib: MDL-21828 Fix database query that does not work in Oracle.
questionlib: MDL-21828 Fix database query that does not work in Oracle.

Bug report and fix thanks to David Binney.

dilawar/moodle