By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,934 Members | 1,527 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,934 IT Pros & Developers. It's quick & easy.

Converting NUMBER, DATE and VARCHAR2 database fields from Resultset to variables?

P: n/a
Assume a database (e.g. Oracle) field is declared as
a) NUMBER (length=10)
b) NUMBER (length=26)
c) VARCHAR2 (length=1)
d) VARCHAR2 (length=50)

How do I retrieve the contents from these resultset fields and put it into a (numeric) java resp Date field?

For other field types it is already clear e.g.):

ResultSet rs = executeQuery(....);

int i = rs.getInt(1); // for INTEGER database fields
String s = rs.getString(2) // for VARCHAR database fields (not VARCHAR2 !!)
double d = rs.getDouble(3) // for DECIMAL database fields

How are the corresponding assign statements for NUMBER, VARCHAR2 and DATE ?


Jul 19 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.