File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes what will be return type Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "what will be return type" Watch "what will be return type" New topic

what will be return type

Arunkumar Chinnadurai
Ranch Hand

Joined: Dec 15, 2011
Posts: 56

IF i execute this query "select sum(workinghours) from signin_signout where empid='tek001' and signindate='2012-04-20' group by empid,signindate" from db
it will return 8 (as sum value)

IF i execute from java rs.getInt("totalworkinghours") returns 0.. Please help what i have done as mistake.

Wendy Gibbons

Joined: Oct 21, 2008
Posts: 1107

I know how to fix your problem, and I think i know why

so first the why
in your select you are selecting "sum(workinghours)"

then trying to use the column name "totalworkinghours", well there isn't a column called that in your select. i would expect an exception but it is being nice and returning 0.

the solution: you have 2 options

Arunkumar Chinnadurai
Ranch Hand

Joined: Dec 15, 2011
Posts: 56

Sorry guys, i did a small mistake i got clear.

"Without updating working hours values i cannot store working status"

Thanks Friends

I agree. Here's the link:
subject: what will be return type
It's not a secret anymore!