如果有一个程序是这样:(PB的源代码)
IF NOT IsNull(ld_from_date) AND NOT IsNull(ld_date) THEN
 ls_sql_where = ls_sql_where + &
 " Trunc(~"CITYNET_INTERFACE~".~"REQUESTED_PICKUP_DTM~") between TO_DATE('" + &
 String(ld_from_date, 'dd/mm/yyyy') + &
 "', 'dd/mm/yyyy') and TO_DATE('" + &
 String(ld_date, 'dd/mm/yyyy') + "', 'dd/mm/yyyy')" + " AND "
 ls_query_criteria = ls_query_criteria + " Trip Date between " + String(ld_from_date,'DD/MM/YYYY') + &
  " AND " + String(ld_date,'DD/MM/YYYY')
END IF

IF NOT IsNull(ld_from_date) AND IsNull(ld_date) THEN
 ls_sql_where = ls_sql_where + &
 " Trunc(~"CITYNET_INTERFACE~".~"REQUESTED_PICKUP_DTM~") >= TO_DATE('" + &
 String(ld_from_date, 'dd/mm/yyyy') + "', 'dd/mm/yyyy')" + " AND "
 ls_query_criteria = ls_query_criteria + " Trip Date >= " + String(ld_from_date,'DD/MM/YYYY')
END IF

IF IsNull(ld_from_date) AND NOT IsNull(ld_date) THEN
 ls_sql_where = ls_sql_where + &
 " Trunc(~"CITYNET_INTERFACE~".~"REQUESTED_PICKUP_DTM~") <= TO_DATE('" + &
 String(ld_date, 'dd/mm/yyyy') + "', 'dd/mm/yyyy')" + " AND "
 ls_query_criteria = ls_query_criteria + " Trip Date <= " + String(ld_date,'DD/MM/YYYY')
END IF
把上面的代码用SQL的查询语句来实行。
这时我用到了一个between运算符,这个运算符会包括它后的两个入参:
如:select table.A from table where table.A between 5 and 10.也就是说这时的条件A>=5 and A<= 10的记录。

posted on 2005-10-11 13:52 rodney 阅读(781) 评论(0)  编辑  收藏 所属分类: 工作中遇到的问题与解决方式Oracle

只有注册用户登录后才能发表评论。


网站导航: