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

Posted on 2005-05-10
Last Modified: 2010-03-31
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);
Question by:LeanMoreTryMore
    1 Comment
    LVL 92

    Accepted Solution

    if (
           recordExist = SessionRS.getString(1);

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Join & Write a Comment

    Suggested Solutions

    For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
    Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
    Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
    Video by: Michael
    Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …

    754 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now