Query works in SQL Developer but not in APEX
ti3rMar 20 2013 — edited Mar 20 2013The query below runs fine in SQL Developer. I have tried entering it both as a Report Region based on SQL Query and in a Dynamic PL/SQL Region. I get different error messages in each. In the Dynamic PL/SQL Region I get the error that an INTO clause is expected in the select
statement. When I place it in a Report based on SQL query I get an error that there is an invalid column and to use column alias. What I am attempting to do is add the first query result to the second query result.
Select (select count(lead_id) from t3_leads
WHERE
t3_leads.market_id = 'Gurnee'
AND (T3_Leads.Last_Campaign = 'Hand Addressed' OR T3_Leads.Last_Campaign is null)
AND
((TRUNC(sysdate) - TRUNC(T3_Leads.LAST_MAILED_DATE)) > 60
OR T3_Leads.Last_Mailed_Date is null))
+
(select count(lead_id)from t3_leads where zip in (select zip from t3_overlap where t3_leads.zip = t3_overlap.zip)
and
market_id <> 'Gurnee'
and ((TRUNC(sysdate) - TRUNC(T3_Leads.LAST_MAILED_DATE)) > 60
OR T3_Leads.Last_Mailed_Date is null))
from dual