Skip to Main Content

Java Database Connectivity (JDBC)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

ResultSet, Does Column exist

843859Sep 24 2007 — edited Sep 25 2007
Hi, I have a ResultSet and I need to know if a certain column exists. I can't find any way to do this except using this try/catch statement.

try
{
col = Integer.valueOf(resultSet.getInt("col2"));
}catch(Exception e)
{
col = Integer.valueOf(resultSet.getInt("col1"));
}

There has got to be a better way to do this, can someone please help. Thanks,
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 23 2007
Added on Sep 24 2007
6 comments
964 views