To validate a select statement