Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use a calculated column in where condition?

How to use a calculated column in the where condition in Oracle 9i?

I want to use something like

select decode (:pValue,1,
               select sysdate from dual,
               select activation_date from account where AcNo = 1234) as calDate
where caldate between startDate and endDate;
like image 632
Sachin Chourasiya Avatar asked Dec 17 '22 02:12

Sachin Chourasiya


1 Answers

You can use an in-line view:

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;
like image 124
Tony Andrews Avatar answered Jan 01 '23 18:01

Tony Andrews