Fix Oracle query issue