In APEX 4.0 there is a cool new future to fill child select list with AJAX. Lets do it..
First we create a select list item in a region and name it as DEPARTMENT (In my case P2_DEPARTMENT).
And we configure List of Values section. I just write simple SQL:
SELECT DNAME,DEPTNO FROM DEPT
This first item is the PARENT item. Lets create the child named EMPLOYEE (P2_EMPLOYEE). Our aim is to fill Employee select list depending on selected Department.
In the List Of Values section i just put the SQL which is filtered by selected Department.
SELECT ENAME D, EMPNO R FROM EMP WHERE DEPTNO = :P2_DEPARTMENT
The key point is the Cascading LOV Parameter Item(s) parameter. I just put the Parent select list item’s name to there which means when P2_DEPARTMENT item changed, fill P2_EMPLOYEES depending on Department. :)
Apex is cool to create fast applications.