Is it oracle, java or me?? [message #1342] |
Tue, 23 April 2002 05:09 |
Jules
Messages: 4 Registered: February 2002
|
Junior Member |
|
|
Im trying to retrieve one value from my database, and
print it to screen, but the value is always
incorrect: here is the code snipit:
rs = stmt.executeQuery("SELECT COUNT (*) FROM rooms" ;
while ( rs.next() ) // move to first row
{
j = rs.getInt(1);
System.out.println("rooms currently in hotel: " + j);
}
-----
now i know the query is correct cos when i'm in
oracle and use that query it returns the correct
value. j shouuld be the number of rooms, yet it
always outputs it as 0. Does any1 know where this
error is coming from?
cheers
J
|
|
|
Re: Is it oracle, java or me?? [message #1359 is a reply to message #1342] |
Wed, 24 April 2002 06:51 |
motiram
Messages: 21 Registered: January 2001
|
Junior Member |
|
|
Its you,oracle, and java which make a perfect blend.
JK.
A missing end brace in
stmt.executeQuery("SELECT COUNT (*) FROM rooms" ;
Other than that, everything is fine. It should work fine, let me know if it doesnot work.
Cheers.
|
|
|
|