Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Converting NUMBER, DATE and VARCHAR2 database fields from Resultset to variables?

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

From: Sven Mayer <hamiltonx_at_lycos.com>
Date: Wed, 26 Jan 2005 23:11:20 +0100
Message-ID: <ct94i8$ti3$01$1@news.t-online.com>


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)
e) DATE

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 ?

Sven Received on Wed Jan 26 2005 - 16:11:20 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US