Link to home
Start Free TrialLog in
Avatar of LeanMoreTryMore
LeanMoreTryMore

asked on

detect no return record (Simple quetion. but need help)

Very simple question as I have forgotten to bring my java book.
My question is how to i detect no record return from the query.
See my code below


       String IsReqNoExistSQL = "SELECT 'Y' FROM system_conf    " +
                                " WHERE req_no = " + "'" + reqNo + "'" ;
       System.out.println("IsReqNoExistSQL:" + IsReqNoExistSQL);                        
       Statement SessionStatement = dbConn.createStatement();
       ResultSet SessionRS = SessionStatement.executeQuery(IsReqNoExistSQL);
       SessionRS.next();                                   <======= cause error if no record return from the query
       recordExist = SessionRS.getString(1);
       SessionStatement.close();
ASKER CERTIFIED SOLUTION
Avatar of Mick Barry
Mick Barry
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial