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);;                                   <======= cause error if no record return from the query
       recordExist = SessionRS.getString(1);
Who is Participating?
objectsConnect With a Mentor Commented:
if (
       recordExist = SessionRS.getString(1);
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.