Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

"Cascading LOV Parent Item(s)" for Select Lists Not Working in 4.1?

956009Nov 9 2012 — edited Nov 14 2012
Hi,

Has anybody experienced problems with select lists's "Cascading LOV Parent Item(s)"?

I have 2 select lists, P2_Parent_selectlist and P2_Children_selectlist. When P2_Parent_selectlist drop down is selected by the user, it should change the contents of P2_Children_selectlist.

P2_Children_selectlist has:
Display Null Value: No
Cascading LOV Parent Item(s): P2_Parent_selectlist
Page Items to Submit: P2_Parent_selectlist
List of values definition: a query that contains :P2_Parent_selectlist

**However P2_Children_selectlist is not changed at all, it's always at null** even though :P2_Parent_selectlist is changed!
Yes I have on the side, in SQL Commands, tried P2_Children_selectlist's query with all values of P2_Parent_selectlist, the query does return values!

I have tried to have P2_Parent_selectlist have different "Page Action when Value Changed" ("None", "Submit Page", "Redirect and Set Value"), none of them can make P2_Children_selectlist get populated.

(I have other fields in the page so I should avoid refreshing the page to not wipe out other fields.)

Thanks.

Comments

Frank Kulash

Hi,

This query gets the results you want:

WITH    got_area_num    AS

(

    SELECT    name, area

    ,         ROW_NUMBER () OVER ( PARTITION BY  area

                                   ORDER BY       name

                                 )   AS area_num

    FROM      person

    ORDER BY  area_num, area

)

SELECT    name, area

,         ROWNUM     AS r_num

FROM      got_area_num

WHERE     ROWNUM  <= 6

ORDER BY  r_num

;

It's unclear how you plan to use this in a procedure.  Maybe you just need a procedure (or a function) that opens a cursor like this.

2985493

Thank you. Could you write a procedure to do the work? This is just an example, the actual chosing rule is complicated enough that has to use procedure and cursor. I wonder how to write a procedure returns result just like a select sentence.

2985493

I am a new beginner from China. It is some difficult to find learning material of oracle procedure here.So could you just write a sample procedure for me to do this work? I can expand a simple procedure to a more complex one by myself if you give me the sample. Thank you!

Frank Kulash
Answer

Hi,

2985493 wrote:

Thank you. Could you write a procedure to do the work? This is just an example, the actual chosing rule is complicated enough that has to use procedure and cursor. I wonder how to write a procedure returns result just like a select sentence.

Here's one way:

VARIABLE  c  REFCURSOR

CREATE OR REPLACE PROCEDURE  top_by_area

(    csr          OUT  SYS_REFCURSOR

,    n_to_return  IN   PLS_INTEGER   := 6

)

IS

BEGIN

    OPEN  csr  FOR

        WITH    got_area_num    AS

        (

            SELECT    name, area

            FROM      person

            ORDER BY  ROW_NUMBER () OVER ( PARTITION BY  area

                                           ORDER BY       name

                                         ) 

            , area

        )

        SELECT    name, area

        ,         ROWNUM     AS r_num

        FROM      got_area_num

        WHERE     ROWNUM  <= n_to_return

        ORDER BY  r_num

        ;

END  top_by_area;

/

SHOW ERRORS

EXEC  top_by_area (:c);

PRINT  :c

The output from the PRINT command given your sample data is:

NAME AREA    R_NUM

---- ---- --------

A1   A           1

B1   B           2

C1   C           3

A2   A           4

C2   C           5

A3   A           6

This is just one way of creating and testing the procedure.  I don't know how you plan to use it.

Marked as Answer by 2985493 · Sep 27 2020
2985493

Thank you, I will learn this and have a try.

1 - 5
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Dec 12 2012
Added on Nov 9 2012
4 comments
1,197 views