In a COTS system, I am able to enter a SQL WHERE clause.
Example of WHERE clauses that work:
worktype = 'Corrective Maintenance'
or
1 = (
with
cte as (select 1 as calc from dual)
select
calc
from
cte
)
Similarly, I'm wondering if it's possible to use an inline function in a subquery in a WHERE clause.
This inline function works on it's own in an SQL client:
with
function inline_f(p_num number) return number is
begin
return p_num + 0;
end;
select
inline_f(1) as calc
from
dual
Calc
----
1
But if I were to wrap it in a subquery in a WHERE clause, then I'd get an error (in the COTS system and even in an SQL client):
--select * from a_tbl where
1 = (
with
function inline_f(p_num number) return number is
begin
return p_num + 0;
end;
select
inline_f(1) as calc
from
dual
)
ORA-00921: unexpected end of SQL command
Invalid statement
ORA-00933: SQL command not properly ended
Question:
Is there a way to use an inline function in subquery (in a WHERE clause)?