I am using eclipse SQLQueryParserManager to extract table name and column names from a sql query. I am getting correct details if I use normal query. But when I use subquery within a query, I am not able to get details of subquery.
Here is what I have done :
SQLQueryParserManager parserManager = SQLQueryParserManagerProvider.getInstance()
.getParserManager("oracle", "10g");
SQLQueryParseResult parseResult = parserManager.parseQuery("select distinct xyz
from t_abc where type = 7 and transmiss_id in (select wxy from t_abc where
transmi_name like 'us_'");
QueryStatement resultObject = parseResult.getQueryStatement();
String parsedSQL = resultObject.getSQL();
List tableList = StatementHelper.getTablesForStatement(resultObject);
for (Object obj : tableList) {
TableInDatabase t = (TableInDatabase) obj;
System.out.println(" Tables : " + t.getName());
for (Object column : t.getValueExprColumns()) {
System.out.println(" Columns : " + ((ValueExpressionColumn)column).getName());
}
}
Can anyone suggest what I have to use , in order to get subquery result?