-1

Oracle DBMS で spagobi を使用していますが、2010 年から 2014 年の間の値を取得したいときにエラーが発生しました: 右括弧がありません

select (sum(d.taux_depot *100)/count(r.trimestre) ) as taux , trimestre as trimestre 
from datamart_cnss d , ref_temps r 
where d.ID_TEMPS = r.ID_TEMPS 
and (case when $P{anneecnss}=123 then (r.annee between 2010 and 2014 )  else $P{anneecnss} end) = r.annee   
and (case when To_CHAR($P{regimecnss})=123 then To_CHAR(d.id_regime) else To_CHAR($P{regimecnss}) end) = To_CHAR(d.id_regime) 
and (case when To_CHAR($P{bureau_cnss})=123 then To_CHAR(d.id_bureau) else To_CHAR($P{bureau_cnss}) end) = To_CHAR(d.id_bureau)
group by trimestre 
order by trimestre asc

ありがとうございました

4

1 に答える 1

0

これは有効な構文ではありません:

case when $P{anneecnss}=123 then (r.annee between 2010 and 2014 )  else $P{anneecnss} end

パーツ内に条件を含めることはできませthenん。他のものと比較できる値または式だけです。

そのフィルターを選択的に適用するには、case ステートメントを使用する必要はありませandor。これは同等だと思います:

where d.ID_TEMPS = r.ID_TEMPS 
and (($P{anneecnss} = 123 and r.annee between 2010 and 2014)
  or ($P{anneecnss} != 123 and $P{anneecnss} = r.annee))
and ($P{regimecnss} = 123 or To_CHAR($P{regimecnss}) = To_CHAR(d.id_regime))
and ($P{bureau_cnss} = 123 or To_CHAR($P{bureau_cnss}) = To_CHAR(d.id_bureau))
...
于 2015-03-04T17:44:26.210 に答える