how can i get the column names of a table
1 posts in topic
Flat View  Flat View

Posted By:   zhebin_cong
Posted On:   Wednesday, November 19, 2003 08:30 PM

in my projects,i need to get the column names of a unknown table,i have tried the ResultSetMetaData and DatabaseMetaData objects,it seems that both of them don't work,who can give me a code snippet?
such as retrieve the column names of the emp table(the oracle sample database---scott/tiger).

thank you very much!

Re: how can i get the column names of a table

Posted By:   Amir_Pashazadeh  
Posted On:   Thursday, November 20, 2003 02:19 AM


By using ResultSetMetaData, for example:

ResultSet rs =
statement.executeQuery("select * from tbl1");
ResultSetMetaData rsmd = rs.getMetaData();

now by rsmd you can get information about fields of tbl1.

Amir Pashazadeh

About | Sitemap | Contact