check QUERY is defined or not