0
我有一个SSRS报告,可以选择运行两个日期范围。Oracle NVL()和SSRS/Visual Studio 2015的数据问题
如果它是从Web浏览器中的报表管理器中运行的,则用户可以在日期下拉列表中指定开始日期和结束日期。
对于报告订阅,隐藏参数指定日期应该取决于参数。这可能是今天的日期,上周等
报告数据的查询,我们使用:
between nvl(:i_start_date,:subscription_start_date) and nvl(:i_stop_date,:subscription_stop_date)
这个工作在SSRS 2012和Visual Studio 2010年。不过,我收到在SSRS以下错误2016和Visual Studio 2015:
ORA-01830:转换整个输入串
如果我们取出NVL()之前的日期格式图像结束时,或在nvl中使用非参数化值,则不会发生该问题。例如:
and cr.contact_date between :i_start_date and :i_stop_date -- works, but only for report manager web runs
and cr.contact_date between :subscription_start_date and :subscription_stop_date -- works, but only for subscriptions
and cr.contact_date between nvl(:i_start_date,sysdate) and nvl(:i_stop_date,sysdate) -- works, but obviously not using the parameter date.
为什么使用nvl()会导致此日期图片错误?就好像日期/时间类型没有从SSRS正确传递到Oracle查询中。
将所有日期参数设置为日期/时间,订阅参数返回使用CDate()转换为日期的值。
下面是订阅开始参数的代码。订阅站是相似的:
=CDate(switch(
Parameters!SubscriptionParam.Value=0, DateSerial(1990,1,1) ,
Parameters!SubscriptionParam.Value=1,today(),
Parameters!SubscriptionParam.Value=2,dateadd("d",-1,today()),
Parameters!SubscriptionParam.Value=3,dateadd("d",-7,today()),
Parameters!SubscriptionParam.Value=4,DateSerial(Year(today()), Month(today()) - 1, 1)
))
0 =免费,1 =昨天,2 =如今,3 =上周,4 =上个月。 返回的日期是正确的。