Correct error in sql execution