I'm trying to use both an inline function and a CTE in a SQL query, and I can't seem to figure out how to do it. I can do one or the other, but not both.
For example (boiled down to the bare minimum of useless queries), I can do:
WITH
FUNCTION f_test RETURN NUMBER IS
BEGIN
RETURN 1;
END;
SELECT
f_test()
FROM
dual;
and I can do this:
WITH cte_test AS (
SELECT
1
FROM
dual
)
SELECT
*
FROM
cte_test
How can I have both the function as well as the CTE defined for the select statement? Basically I want to end up with something like:
SELECT f_test(), cte_test.* FROM cte_test