Fix query for Oracle