I am working with APEX 4.2.1.00.08 and I keep getting the validation error "LOV query is invalid, a display and a return value are needed, the column names need to be different. If your query contains an in-line query, the first FROM clause in the SQL statement must not belong to the in-line query.". I'm not sure what's causing this. My sql is:
SELECT u1.name d, susu.subunitid r
FROM basic.subunitsuperunit susu
INNER JOIN basic.unit u1 ON susu.subunitid = u1.unitid
INNER JOIN basic.unit u2 ON susu.superunitid = u2.unitid
WHERE level = 3
AND u1.name != 'XYZ'
CONNECT BY PRIOR subunitid = superunitid
START WITH u1.name = (SELECT u3.name FROM basic.unit u3 WHERE u3.unitid = (SELECT TO_NUMBER(gp.value) FROM basic.global_parameters gp WHERE gp.name = 'A_UNIT'))
ORDER BY u1.name
I have made sure there was no semicolon, and I have checked this query in SQL Developer and it runs fine. I already realize those subqueries aren't optimal, but what am I doing wrong here?