首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > PB >

检索参数?解决方法

2013-01-07 
检索参数?参数类型有多种,date,long,string 等,如果该参数为空的话就是检萦全部,就相当于没有这个参数,str

检索参数?
参数类型有多种,
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 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楼的方案不太准确,建议使用以下方案
参数 rq date
参数 ts number
select * from tb
where (rq = :rq or :rq is null) and (ts = :ts or :ts is null) 

热点排行