Why is this not working?
WITH ids AS (SELECT unique id FROM table1 WHERE cd = :cd AND
yr = :yr)
SELECT NVL(person_id, NULL) FROM table2 WHERE id IN ids
In my actual code, the statement ids is used twice. I made this post to find out how to alias subquery and then use it in WHERE along with IN, as seen above.
I get the error : Warning: oci_execute(): ORA-00904: "IDS": invalid identifier