Home » SQL & PL/SQL » SQL & PL/SQL » Is it oracle, java or me??
Is it oracle, java or me?? [message #1342] Tue, 23 April 2002 05:09 Go to next message
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 Go to previous messageGo to next message
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.
Re: Is it oracle, java or me?? [message #1382 is a reply to message #1342] Thu, 25 April 2002 01:38 Go to previous message
Jules
Messages: 4
Registered: February 2002
Junior Member
shit sorry. thats bad copying and pasting. the end
brace is there. no that bit works now.
lol
Previous Topic: What user created this table ?
Next Topic: SQL QUES
Goto Forum:
  


Current Time: Sun Apr 28 09:46:12 CDT 2024