在模糊查询的过程中:where (g_xmbm.code_xm like ('%'+:a + '%')) or (g_xmbm.code_name like ('%'+:b + '%'))是这样实现的,可是怎么才能查询日期类型的数据呢??比如说是2004/10/04,2004/10/03,等等,怎么定义检索参数呢??
...全文
955打赏收藏
模糊查询中怎么查询日期类型的数据????
在模糊查询的过程中:where (g_xmbm.code_xm like ('%'+:a + '%')) or (g_xmbm.code_name like ('%'+:b + '%'))是这样实现的,可是怎么才能查询日期类型的数据呢??比如说是2004/10/04,2004/10/03,等等,怎么定义检索参数呢??
可以先将日期型的数据转成字符型的,再用like等.
1.oracle中
select code_mean from table_name where date_field like to_char(query_date,'yyyymmdd')
2.PB中
如定义检索参数:query_date
date_filed like string(:query_date,'yyyymmdd')