This discussion is archived
9 Replies Latest reply: Nov 14, 2012 1:44 PM by trent RSS

Why will a query work in SQL Developer but not in Apex?

Kim2012 Newbie
Currently Being Moderated
Here's a good one. I created a dynamic LOV with the following query.

select
e.DESCR d,
ee.ENTRD_EVNT_SK r
from
PT_EVNT_IN_DIV eid,
PT_ENTRD_EVNT ee,
PT_EVNT e
where ee.PGNT_SK = :PGNT_SK
and ee.CNTSNT_SK = :CNTSNT_SK
and ee.EVNT_IN_DIV_SK = eid.EVNT_IN_DIV_SK
and eid.EVNT_SK = e.EVNT_SK
and ee.ENTRD_EVNT_SK not in
(select js.ENTRD_EVNT_SK
from PT_JDG_SCR js
where js.JDG_SK = :JDG_SK
and js.PGNT_SK = :ai_pgnt_sk
and js.CNTSNT_SK = :CNTSNT_SK)
order by 1

The query works fine in SQL Developer, but Apex gives the following error when compiling it in the LOV editor.

"1 error has occurred

- 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 tried rearranging the entries in the From clause, but that didn't do any good.

Do you see what I can do to make Apex accept it?

Thanks,
Kim

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points