4

whereOracle 9iの条件で計算列を使用する方法は ?

のようなものを使いたい

select decode (:pValue,1,
               select sysdate from dual,
               select activation_date from account where AcNo = 1234) as calDate
where caldate between startDate and endDate;
4

2 に答える 2

9

インライン ビューを使用できます。

select calcdate from
(
select startDate, endDate,
       decode (:pValue,1,
               select sysdate from dual,
               select activation_date from account where AcNo = 1234) as calcdate
)
where calcdate between startDate and endDate;
于 2010-03-10T11:42:33.607 に答える
3

デュアルから日付を選択して、結果を結合できます。

select * 
from   <<your table with startDate and endDate columns>> -- Since you ommited the main "from" clause from your statement
,      (
         select decode( :pValue
                      , 1, sysdate
                      , ( select activation_date from account where AcNo = 1234 )
                      ) as calDate
         from   dual
       ) c
where  c.calDate between startDate and endDate
... -- any other conditions you may need
于 2010-03-10T12:45:37.733 に答える