views:

16

answers:

1
   ResultSet rs;
   rs = this.orderedProduct.select(" sum(unitstoproduce) "," soNo = "+ soNo);

   int sum = Integer.parseInt(rs.getString(1));

When i try to execute the above query inside the java class i'm getting an exception as below. Here the orderedProduct(orderedZnAlProduct) is the table

   SELECT  sum(unitstoproduce)  FROM orderedZnAlProduct WHERE  soNo = '15005'

   java.sql.SQLException: Before start of result set
A: 

I don't see where your query is executed (like statement.executeQuery()) but, this kind of errors generally happens when your cursor is not well positioned. You need to call something likers.next() or rs.first() to move your cursor and then to get the result.

oyo