检索参数?该怎么解决
检索参数?
参数类型有多种,
date,long,string 等,
如果该参数为空的话就是检萦全部,就相当于没有这个参数,
string类型的让它等于“%”就可以了。
date,long类型的怎么写?
------解决方案--------------------
date ld
long ll
setnull(ld)
setnull(ll)
dw_1.retrieve(ld, ll)
参数 rq date
参数 ts number
select * from tb
where (rq = :rq or rq is null) and (ts = :ts or ts is null)
------解决方案--------------------
我只是给你演示为空的情况
参数类型有多种,
date,long,string 等,
如果该参数为空的话就是检萦全部,就相当于没有这个参数,
string类型的让它等于“%”就可以了。
date,long类型的怎么写?
------解决方案--------------------
date ld
long ll
setnull(ld)
setnull(ll)
dw_1.retrieve(ld, ll)
参数 rq date
参数 ts number
select * from tb
where (rq = :rq or rq is null) and (ts = :ts or ts is null)
------解决方案--------------------
我只是给你演示为空的情况
- C/C++ code
date ld long ll ld = ... ll = ... if ld = 1900-01-01 then setnull(ld) end if if ll < 0 then //假设ll小于0时为空 setnull(ll) end if dw_1.retrieve(ld, ll)
------解决方案--------------------
不行的話就動態組查詢條件,用getsqlselect(),setsqlselect()
------解决方案--------------------
1楼的方案不太准确,建议使用以下方案
- C# code
参数 rq date 参数 ts number select * from tb where (rq = :rq or :rq is null) and (ts = :ts or :ts is null)