Found that counting is automatically called before the query execute, for example:
1: select count(*) from ( QUERY_TO_BE_CALL);
2: QUERY_TO_BE_CALL
error captured during running 1:
[SELECT - 0 row(s), 0.000 secs] [Error Code: 0, SQL State: 50000] Remote org.teiid.api.exception.query.QueryParserException: Parsing error: Encountered "select cmbasiccc0_.CASE_ID as col_0_0_ from VDB.CM_BASIC_CC cmbasiccc0_ ) <EOF>" at line 1, column 23.
Was expecting one of:
"xmltable" ...
<ID> ...
"(" ...
"with" ...
"select" "all" ...
"select" "distinct" ...
"select" "*" ...
"select" "not" ...
"select" "translate" ...
"select" "?" ...
"select" <STRINGVAL> ...
"select" <INTEGERVAL> ...
"select" <FLOATVAL> ...
"select" "false" ...
"select" "true" ...
"select" "unknown" ...
"select" "null" ...
"select" <BOOLEANTYPE> ...
"select" <TIMESTAMPTYPE> ...
"select" <DATETYPE> ...
"select" <TIMETYPE> ...
"select" "{" ...
"select" <ID> "(" ...
"select" "xmlagg" ...
"select" "convert" ...
"select" "cast" ...
"select" "left" ...
"select" "right" ...
"select" "char" ...
"select" "user" ...
"select" "year" ...
"select" "month" ...
"select" "hour" ...
"select" "minute" ...
"select" "second" ...
"select" "xmlconcat" ...
"select" "xmlcomment" ...
"select" "insert" ...
"select" "xmlparse" ...
"select" "xmlelement" ...
"select" "xmlpi" ...
"select" "xmlforest" ...
"select" "xmlserialize" ...
"select" "xmlquery" ...
"select" <ID> "*" ...
"select" <ID> "/" ...
"select" <ID> "+" ...
"select" <ID> "-" ...
"select" <ID> "||" ...
"select" <ID> "not" ...
"select" <ID> "between" ...
"select" <ID> "like" ...
"select" <ID> "in" ...
"select" <ID> "is" ...
"select" <ID> "=" ...
"select" <ID> "<>" ...
"select" <ID> "!=" ...
"select" <ID> "<" ...
"select" <ID> "<=" ...
"select" <ID> ">" ...
"select" <ID> ">=" ...
"select" <ID> "and" ...
"select" <ID> "or" ...
"select" <ID> "as" <ID> "," ...
"select" <ID> "as" <ID> "into" ...
"select" <ID> "as" <ID> "from" "{" ...
"select" <ID> "as" <ID> "from" "xmltable" ...
"select" <ID> "as" <ID> "from" <ID> "as" ...
"select" <ID> "as" <ID> "from" <ID> <ID> "makedep" ...
"select" <ID> "as" <ID> "from" <ID> <ID> "makenotdep" ...
"select" <ID> "as" <ID> "from" <ID> <ID> "cross" ...
"select" <ID> "as" <ID> "from" <ID> <ID> "union" ...
"select" <ID> "as" <ID> "from" <ID> <ID> "right" ...
"select" <ID> "as" <ID> "from" <ID> <ID> "left" ...
"select" <ID> "as" <ID> "from" <ID> <ID> "full" ...
"select" <ID> "as" <ID> "from" <ID> <ID> "inner" ...
"select" <ID> "as" <ID> "from" <ID> <ID> "join" ...
"select" <ID> "as" <ID> "from" <ID> <ID> "," ...
"select" <ID> "as" <ID> "from" <ID> <ID> "where" ...
"select" <ID> "as" <ID> "from" <ID> <ID> "group" ...
"select" <ID> "as" <ID> "from" <ID> <ID> "having" ...
"select" <ID> "as" <ID> "from" <ID> <ID> "intersect" ...
"select" <ID> "as" <ID> "from" <ID> <ID> "except" ...
"select" <ID> "as" <ID> "from" <ID> <ID> "order" ...
"select" <ID> "as" <ID> "from" <ID> <ID> "limit" ...
"select" <ID> "as" <ID> "from" <ID> <ID> "option" ...
"select" <ID> "as" <ID> "from" <ID> <ID> ")" "as" ...
"select" <ID> "as" <ID> "from" <ID> <ID> ")" <ID> ...
"table" ...
... 1 statement(s) executed, 0 row(s) affected, exec/fetch time: 0.000/0.000 sec [0 successful, 0 warnings, 1 errors]
02:37:15 [SELECT - 0 row(s), 0.000 secs] [Error Code: 0, SQL State: 50000] Remote org.teiid.api.exception.query.QueryParserException: Parsing error: Encountered "select cmbasiccc0_.CASE_ID as col_0_0_ from VDB.Oracle58.WCSS_OWNER.CM_BASIC_CC cmbasiccc0_ ) <EOF>" at line 1, column 23.
Was expecting one of:
"xmltable" ...
<ID> ...
"(" ...
"with" ...
"select" "all" ...
"select" "distinct" ...
"select" "*" ...
"select" "not" ...
"select" "translate" ...
"select" "?" ...
"select" <STRINGVAL> ...
"select" <INTEGERVAL> ...
"select" <FLOATVAL> ...
"select" "false" ...
"select" "true" ...
"select" "unknown" ...
"select" "null" ...
"select" <BOOLEANTYPE> ...
"select" <TIMESTAMPTYPE> ...
"select" <DATETYPE> ...
"select" <TIMETYPE> ...
"select" "{" ...
"select" <ID> "(" ...
"select" "xmlagg" ...
"select" "convert" ...
"select" "cast" ...
"select" "left" ...
"select" "right" ...
"select" "char" ...
"select" "user" ...
"select" "year" ...
"select" "month" ...
"select" "hour" ...
"select" "minute" ...
"select" "second" ...
"select" "xmlconcat" ...
"select" "xmlcomment" ...
"select" "insert" ...
"select" "xmlparse" ...
"select" "xmlelement" ...
"select" "xmlpi" ...
"select" "xmlforest" ...
"select" "xmlserialize" ...
"select" "xmlquery" ...
"select" <ID> "*" ...
"select" <ID> "/" ...
"select" <ID> "+" ...
"select" <ID> "-" ...
"select" <ID> "||" ...
"select" <ID> "not" ...
"select" <ID> "between" ...
"select" <ID> "like" ...
"select" <ID> "in" ...
"select" <ID> "is" ...
"select" <ID> "=" ...
"select" <ID> "<>" ...
"select" <ID> "!=" ...
"select" <ID> "<" ...
"select" <ID> "<=" ...
"select" <ID> ">" ...
"select" <ID> ">=" ...
"select" <ID> "and" ...
"select" <ID> "or" ...
"select" <ID> "as" <ID> "," ...
"select" <ID> "as" <ID> "into" ...
"select" <ID> "as" <ID> "from" "{" ...
"select" <ID> "as" <ID> "from" "xmltable" ...
"select" <ID> "as" <ID> "from" <ID> "as" ...
"select" <ID> "as" <ID> "from" <ID> <ID> "makedep" ...
"select" <ID> "as" <ID> "from" <ID> <ID> "makenotdep" ...
"select" <ID> "as" <ID> "from" <ID> <ID> "cross" ...
"select" <ID> "as" <ID> "from" <ID> <ID> "union" ...
"select" <ID> "as" <ID> "from" <ID> <ID> "right" ...
"select" <ID> "as" <ID> "from" <ID> <ID> "left" ...
"select" <ID> "as" <ID> "from" <ID> <ID> "full" ...
"select" <ID> "as" <ID> "from" <ID> <ID> "inner" ...
"select" <ID> "as" <ID> "from" <ID> <ID> "join" ...
"select" <ID> "as" <ID> "from" <ID> <ID> "," ...
"select" <ID> "as" <ID> "from" <ID> <ID> "where" ...
"select" <ID> "as" <ID> "from" <ID> <ID> "group" ...
"select" <ID> "as" <ID> "from" <ID> <ID> "having" ...
"select" <ID> "as" <ID> "from" <ID> <ID> "intersect" ...
"select" <ID> "as" <ID> "from" <ID> <ID> "except" ...
"select" <ID> "as" <ID> "from" <ID> <ID> "order" ...
"select" <ID> "as" <ID> "from" <ID> <ID> "limit" ...
"select" <ID> "as" <ID> "from" <ID> <ID> "option" ...
"select" <ID> "as" <ID> "from" <ID> <ID> ")" "as" ...
"select" <ID> "as" <ID> "from" <ID> <ID> ")" <ID> ...
"table" ...
... 1 statement(s) executed, 0 row(s) affected, exec/fetch time: 0.000/0.000 sec [0 successful, 0 warnings, 1 errors]