String sql="SELECT room_no, suite_type, bed_type, suite_cost FROM room_detail "
+ "where room_no NOT IN "+
+ "(SELECT room_no FROM booking_table WHERE DATE(date_out) >= '"
+ strdtver1
+ "' AND DATE(date_in) <= '"
+ strdtver2
+ "')";
答案 0 :(得分:0)
在比较之前,您需要将变量strdtver1
格式化为日期类型。
因此,您的查询需要像以下内容一样进行更改:
String sql="SELECT room_no, suite_type, bed_type, suite_cost FROM room_detail "
+ "where room_no NOT IN "+
+ "(SELECT room_no FROM booking_table WHERE TO_DATE(date_out,'DD-MON-YY') >= to_date('"
+ strdtver1
+ "','DD-MON-YY') AND TO_DATE(date_in,'DD-MON-YY') <= to_date('"
+ strdtver2
+ "','DD-MON-YY') )";
此外,您不需要在查询字符串中使用分号。