如何在哪里条件下使用计算列?

Sac*_*iya 4 sql oracle calculated-columns oracle9i

如何where在Oracle 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;
Run Code Online (Sandbox Code Playgroud)

Ton*_*ews 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;
Run Code Online (Sandbox Code Playgroud)

  • @SachinChorasiya - 如果你看过Tony的样本,你会注意到它包含一个拼写错误(我现在已经更正了).在没有正确审核的情况下从互联网上运行代码是一个非常糟糕的主意. (2认同)