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!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

How to return multiple value in select list

james.Apr 18 2008 — edited Apr 28 2008
Hi All,

How can we return multiple values in select list.
here is example of my select statement.

select 'a' display_value, 'b' return_value from dual;

is there any way i can return another value into page temp item.

select 'a' display_value, 'b' return_value, 1 ??? from dual;

Please help me.

--Thanks

Comments

Denes Kubicek
I tried reading this three times but still do not understand, what you want to do. Could you
please explain?

Denes Kubicek
-------------------------------------------------------------------
http://deneskubicek.blogspot.com/
http://www.opal-consulting.de/training
http://htmldb.oracle.com/pls/otn/f?p=31517:1
-------------------------------------------------------------------
s1m0n
I guess he means he wants to have multiple return values, based on 1 display value. but no, html doesn't have that option. in html a select list has options, in style like:
<option value='[return_value]'>[display_value]</option>

you could use tricks like comma-seperated ed. but guess dit would not be very useful. I would recommend to use technical id's/ primary key values on you're tables. with a id/primary key value in return value you will have access to all the data.
Denes Kubicek
Okay,

Sounds like an explanation. But for that purpose you use multiselect lists.

Denes Kubicek
-------------------------------------------------------------------
http://deneskubicek.blogspot.com/
http://www.opal-consulting.de/training
http://htmldb.oracle.com/pls/otn/f?p=31517:1
-------------------------------------------------------------------
james.
I am sorry, if I confuses you. Here what i am looking. I will take simple example and explain.

Say for example i have current select list like this.

select 'Sam' display_value, 'Sam' return_value from dual;
union
select 'Lesli' display_value, 'Lesli' return_value from dual;

and at same time when user select 'Sam' I want to return some flag say for example is_male_flag value '1' to apex hidden variable.

select 'Sam' display_value, 'Sam' return_value, 1 <return 1 into :p1_is_male_flag> from dual
union
select 'Lesli' display_value, 'Lesli' return_value, 0 <return 0 into :p1_is_male_flag> from dual

How can we do this ? When user select 'Sam' i want identify he is a male.

I appreciate your help.

Thanks

Message was edited by:
james.
Denes Kubicek
Normaly,

You would create a computation for your :p1_is_male_flag item. This computation would
take the value of the select list into consideration.

Denes Kubicek
-------------------------------------------------------------------
http://deneskubicek.blogspot.com/
http://www.opal-consulting.de/training
http://htmldb.oracle.com/pls/otn/f?p=31517:1
-------------------------------------------------------------------
james.
Denes Kubicek,

Thank you for your help. I am still not able to return value into hidden variable.

My select in select is not working.

I am getting following 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.

My select statement is :

select 'Sam' display_value, 'Sam' return_value, 1 from dual
union
select 'Lesli' display_value, 'Lesli' return_value, 0 from dual

Please help me.

--Thanks
s1m0n
Like the error says, you're query is incorrect. For SQL Query based LOVs the sql-statement should have only a display and return vale in the select. In your case:
select 'Sam' display_value
, 'Sam' return_value
from dual
union
select 'Lesli' display_value
, 'Lesli' return_value
from dual

By the way youre sql does not make any sence to me.
Are you familiar with the static list for LOVs/Selectlist?
If i see this example, i would recommened to use that option

Simon
Johnny Be Good
Simon,

you said one could use tricks like comma-separated lists in a select-list (LOV).
How would that look like?

Cause I actually would like to do something like that.

I tried creating a static LOV in this way:

Sequence, Display Value, Return Value:
1 a (a1, a2, a3)
2 b (b1, b2, b3)
3 c (c1, c2, c3)

and use the return values in a select statement with something like that:

select * from table where column in selectlist.returnvalue;

But this statement returns no rows.

You got an idea what I did wrong?

Thanks
Johnny
s1m0n
Hi Johnny,

I would use a same construction as with a multiple select. With a multipleselect the values are seperated by : So if you have an selectlist item ( P1_SELECT ) returning a list as a1:a2:a3 for the column to_be_selected, You can use this in the query with the instr function, something like:
select t.*
from table t
where instr( upper(:P1_SELECT)||':'
, upper(t.to_be_selected)||':') > 0
Johnny Be Good
Thank you very much Simon.

Exactly what I was looking for!
1 - 10
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on May 26 2008
Added on Apr 18 2008
10 comments
1,257 views