Fixed SQL syntax for Oracle compatibility