Reputation: 840
Hi is there a possibility to resolve the real column names from a index? I use:
java.sql.DatabaseMetaData.getIndexInfo(String, String, String, boolean, boolean)
But i get somthing like this:
[table=LOG_EMAIL, name=LOG_EMAIL_USERS_ID, columns=[SYS_NC00011$ A], unique=false]
How can i resolve the: SYS_NC00011$
I use ojdbc6-11.2.0.4
Upvotes: 0
Views: 540
Reputation:
That index is a function based (expression) index.
The expression that is referenced by that name is stored in the system view user_ind_expressions
:
select column_expression
from user_ind_expressions
where index_name = 'LOG_EMAIL_USERS_ID'
and column_position = 1;
If you have more than one expression in the index you have multiple rows in user_ind_expressions
with different values for column_position
(the first expression is 1, the second is 2 and so on). The name SYS_NC00011$
will not show up in that view.
Upvotes: 2
Reputation: 1905
I would use the ResultSetMetadata -
ResultSetMetaData rsmd = rs.getMetaData();
for (int i = 1; i <= rsmd.getColumnCount(); i++) {
System.out.println(rsMetaData.getColumnName(i));
}
Upvotes: 0