if (subSelect == null) {
return getSetStatementsColumns(pStatement);
} else {
List result = new ArrayList();
for (Iterator iter = subSelect.getResultColumns(); iter.hasNext(); ) {
ColumnReference cRef = (ColumnReference) iter.next();
Column.Name name;
if (cRef.getAlias() == null) {
name = cRef.getColumn().getName();
} else {
name = cRef.getAlias();
}
Column col = pStatement.getTableReference().getTable().getColumn(name);
if (col == null) {
throw new IllegalStateException("A result column " + name
+ " is used in the subselect, which is not present in the insert statements table.");