已知输入日期参数‘p_date’,时间格式为YYYY-mm-dd
现在需要季初日期,然后用between。。。and。。。联接当天日期统计季报数目,在report studio里添加查询项“季初日期”
代码如下:
case when (substr(?p_date?,6,2) in ('01','02','03') then cast ((cast (substr(?p_date?,1,4 ) as nvarchar(4))||'-01-01') as date))
when (substr(?p_date?,6,2) in ('04','05','06') then cast ((cast (substr(?p_date?,1,4 ) as nvarchar(4))||'-04-01') as date))
when (substr(?p_date?,6,2) in ('07','08','09') then cast ((cast (substr(?p_date?,1,4 ) as nvarchar(4))||'-07-01') as date))
when (substr(?p_date?,6,2) in ('10','11','12') then cast ((cast (substr(?p_date?,1,4 ) as nvarchar(4))||'-10-01') as date))
end
报错如下:
QE-DEF-0459 CCLException
QE-DEF-0260"case when (substr(?p_date?,6,2) in ('01','02','03') then "的位置57之前或者附近存在解析错误
QE-DEF-0261 QFWP - 正在解析文本 :
case when (substr(?p_date?,6,2) in ('01','02','03') then cast ((cast (substr(?p_date?,1,4 ) as nvarchar(4))||'-01-01') as date))
when (substr(?p_date?,6,2) in ('04','05','06') then cast ((cast (substr(?p_date?,1,4 ) as nvarchar(4))||'-04-01') as date))
when (substr(?p_date?,6,2) in ('07','08','09') then cast ((cast (substr(?p_date?,1,4 ) as nvarchar(4))||'-07-01') as date))
when (substr(?p_date?,6,2) in ('10','11','12') then cast ((cast (substr(?p_date?,1,4 ) as nvarchar(4))||'-10-01') as date))
end
求各位大神给个解决方法,快疯掉了
收起