[英]Case statement in oracle
這是我的查詢,它們不起作用,但是我想在sql(oracle)中執行類似的操作
$P{parametre}
是在jasper中使用的參數;
select val1, val2 from table where
table.column1 =(case when $P{parametre} is not null then $P{parametre} end )
and
table.column1 is not null (case when $P{parametre} is null end )
但是table.column1 is not null (case when $P{parametre} is null end )
不起作用
你有主意嗎?
我想你想要這個:
...
where (column1 is null and $P{parametre} is null)
or column1 = $P{parametre}
將column1與參數匹配,但是將兩者都為null的匹配項。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.