Hi friends,
I need to use a computed date value repeatedly in my query, which is quite large. Is it possible to use it through WITH clause without making JOIN.
Or, is there any other way to use a runtime computed value repeatedly in query? I cannot go for PL/SQL or bind variable. Only a single query to be used.
My DB version is Oracle 12.2.
--Normal working scenario
WITH
with_result AS
(SELECT trunc(sysdate-365) AS val_from_with FROM dual)
SELECT e.ename,e.JOB
FROM emp e
INNER JOIN with_result w
ON (e.hiredate >= w.val_from_with);
--Is it possible to use it like this (without join)?
WITH
with_result AS
(SELECT trunc(sysdate-365) AS val_from_with FROM dual)
SELECT e.ename,e.JOB
FROM emp e
where e.hiredate >= with_result.val_from_with;