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表详细信息