简体   繁体   English

Oracle CASE WHEN 'null' 用于 SSRS 报告的 Int

[英]Oracle CASE WHEN 'null' to work with an Int for a SSRS report

I have a query that is being filtered by res_id .我有一个正在被res_id过滤的查询。 This query is being used to fetch the data for a SSRS report.此查询用于获取 SSRS 报告的数据。 This is doing the job however I would like to be able to select the 'allow null' tick box on the parameter properties, rather than entering a 0. My res_id is an Int.这是在做这项工作,但是我希望能够 select 参数属性上的“允许空”复选框,而不是输入 0。我的 res_id 是一个 Int。

SELECT Employee
FROM Employees  
WHERE res_id = case when :ResID = 0 THEN res_id ELSE :ResID END 

I have tried the following but I get a, 'Expected Number, got a CHAR' error.我尝试了以下操作,但出现“预期数字,出现字符”错误。

WHERE res_id = case when :ResID = 'null' THEN res_id ELSE :ResID END 

WHERE res_id = case when :ResID IS NULL THEN res_id ELSE :ResID END

I believe the issue is within my report builder for which I am using Visual Studio 2008. I am aware the code translation between Oracle and the report can be a bit hit and miss sometimes so that's why I am asking for help on another approach.我相信问题出在我正在使用 Visual Studio 2008 的报表生成器中。我知道 Oracle 和报表之间的代码转换有时可能会有点碰运气,所以这就是我寻求另一种方法帮助的原因。

Thanks all for your help in advance:)提前感谢大家的帮助:)

You could also try你也可以试试

where res_id=nvl(:ResID,res_id)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM