在JDBC查询中查询错误的months_between之间没有得到任何输出甚至错误

时间:2017-03-08 04:34:03

标签: java sql oracle jdbc

public class AgeCheck {


    static String url = "jdbc:oracle:thin:@localhost:1521:ORCL" ; 
    public static void main(String[] args) {
        // TODO Auto-generated method stub
         PreparedStatement p;

            try {
                Class.forName("oracle.jdbc.driver.OracleDriver");
                Connection con=DriverManager.getConnection(url,"surya","surya");
                System.out.println("Connection success");
                p = con.prepareStatement("select months_between(doj,dob) from agecheck");


                ResultSet r =  p.executeQuery();
                while(r.next()){
                    System.out.println(r.getInt(1));
                }


                con.close();

            }catch (Exception e) {
                // TODO: handle exception
                e.printStackTrace();
            }

    }
}

帮助我,我没有得到任何输出

在结果集中检索数据有什么错误

SQL表详细信息

SQL Table Data

0 个答案:

没有答案