Order in a Select List based in a LOV is wrong

I have a select list based upon a LOV SQL Query.
Values in table are:
FIELD
001
002
003
AAA
when I make query in SQL Workshop:
select FIELD from TABLE order by FIELD;
I get
001
002
003
AAA
But when I make a similar query in LOV the result is in the select list
AAA
001
002
003
Someone knows what is happening?
Thank
Ander

mhichwa wrote:
It looks like your application is running a different sort / NLS preference then is the SQL workshop. Is there a chance your application identifies a language that sorts differently then default APEX. I am just guessing but it could explain this behavior.OK, I think something like this is happening because my Oracle instance have SPANISH like a NLS_LANG parameter, but why is different result between sql Workshop and LOV query, I have installed english and spanish languages in my apex instance, I get the same problem in both cases.
Other curious think is that my min and max values are OK,
for example
BETWEEN: <select list 1> AND <select list 2>
default value for <select list 1> is
DECLARE
exitvalue varchar2(10);
BEGIN
select min(FIELD) into exitvalue
from TABLE
return (exitvalue);
END;
I get 001
default value for <select list 2> is
DECLARE
exitvalue varchar2(10);
BEGIN
select max(FIELD) into exitvalue
from TABLE
return (exitvalue);
END;
I get AAA
But select list are ordered like
AAA
001
002
003
I have based select list in a lot of different sql ways
select FIELD from TABLE ORDER BY FIELD
select FIELD from TABLE ORDER BY 1
select FIELD from TABLE ORDER BY FIELD ASC
select FIELD from TABLE ORDER BY 1 ASC
Other extraneous think is that I use DESC order I get
003
002
001
AAA
Thanks
Edited by: user10999912 on 24-Jul-2010 08:07

Similar Messages

  • Problem writing a sql query for a select list based on a static LOV

    Hi,
    I have the following table...
    VALIDATIONS
    ID          Number     (PK)
    APP_ID          Number     
    REQUESTED     Date          
    APPROVED     Date          
    VALID_TIL     Date
    DEPT_ID          Number     (FK)
    I have a search form with the following field item variables...
    P11_DEPT_ID (select list based on dynamic LOV from depts table)
    P11_VALID (select list based on static Yes/No LOV)
    A report on the columns of the Validations table is shown based on the values in the search form. So far, my sql query for the report is...
    SELECT v.APP_ID,
    v.REQUESTED,
    v.APPROVED,
    v.VALID_TIL,
    d.DEPT
    FROM DEPTS d, VALIDATIONS v
    WHERE d.DEPT_ID = v.DEPT_ID(+)
    AND (d.DEPT_ID = :P11_DEPT_ID OR :P11_DEPT_ID = -1)
    This query works so far. My problem is that I don't know how to do a search based on the P11_VALID item - if 'yes' is selected, then the VALID_TIL date is still valid. If 'no' is selected then the VALID_TIL date has passed.
    Can anyone help me to extend my query to include this situation?
    Thanks.

    Hello !
    Let's have a look at my example:create table test
    id        number
    ,valid_til date
    insert into test values( 1, sysdate-3 );
    insert into test values( 2, sysdate-2 );
    insert into test values( 3, sysdate-1 );
    insert into test values( 4, sysdate );
    insert into test values( 5, sysdate+1 );
    insert into test values( 6, sysdate+2 );
    commit;
    select * from test;
    def til=yes
    select *
      from test
      where decode(sign(trunc(valid_til)-trunc(sysdate)),1,1,0,1,-1)
           =decode('&til','yes',1,-1);
    def til=no
    select *                                                                               
      from test                                                                            
      where decode(sign(trunc(valid_til)-trunc(sysdate)),1,1,0,1,-1)
           =decode('&til','yes',1,-1);  
    drop table test;  It's working fine, I've tested it.
    The above changes to my first idea I did because of time portion of the DATE datatype in Oracle and therefore the wrong result for today.
    For understandings:
    1.) TRUNC removes the time part of DATE
    2.) The difference of to date-values is the number of days between.
    3.) SIGN is the mathematical function and gives -1,0 or +1 according to an negative, zero or positiv argument.
    4.) DECODE is like an IF.
    Inspect your LOV for the returning values. According to my example they shoul be 'yes' and 'no'. If your values are different, you may have to modify the DECODE.
    Good luck,
    Heinz

  • Creating a dynamic Selection List based on a View Object

    Hello,
    I'm new to JDeveloper and I would like to create a JSP Page with dynamic Selection List based on a runtime query or based on a view object (BC4J). The selection made by an user should serve another dynamic query with the necessary parameters that I built using createViewObjectFromQueryStmt(). By now I tried this using the InputSelectLOV from the Component Palette in JDeveloper. But without success. By the way: the selection list is not very large (5 values), so it's not necessary to have a form finding the desired value.
    Maybe someone had experience about creating this already. Please give me a tip or a little example.
    Thanks.

    http://otn.oracle.com/products/jdev/howtos/jsp/renderers.html

  • Select list based on LOV - and allowing new values

    Hi All,
    I have a page that has a select list based on a dynamic list of values. I wanted to test out how the system was working, so I truncated all of my tables, and now my select list is blank (which makes sense). The problem is that I can't type anything into the select list. How can I make it so that if there isn't a value returned from the query that populates the LOV, I can just type one in? This also goes further in that if the value I wanted isn't already in the db, how does the user add in another value?
    Thanks in advance,
    Corey

    Hello,
    Well as you now know HTML based select lists don't work like that, that widget is called a combo box and there will be built in combo boxes in APEX 3.0, it's a fairly complex dhtml widget.
    What you might want to do is provide a text item next to your select box and an Add New Value Option in your select list.
    Carl

  • Select List (based on LOV) query problem

    Hello experts! I have a small problem here, which I can't seem to overcome.
    I have a page item (select list based on LOV), which is based on a query. The query returns all potential employees of a department that are responsible for a certain duty. So far so good!
    The problem is that there are two departments, which should not only see there own employees but also the name of the employee that has carried out a certain task. However, due to my query, the name of that person is not displayed - only the pk is returned.
    Do you have a recommendation how I display all employees of a specific department and have additional values translated as well?
    My query is as follows: select str_bearbeiter, cnt_bearbeiter from vt_tbl_bearbeiter where cnt_bearbeiter in (SELECT
    CNT_REGIERUNGSBEZIRK FROM TBL_REGIERUNGSBEZIRK) union select str_bearbeiter, cnt_bearbeiter from vt_tbl_bearbeiter where int_behoerde in (SELECT
    CNT_REGIERUNGSBEZIRK FROM TBL_REGIERUNGSBEZIRK where STR_REGIERUNGSBEZIRK = lower (:app_user)) whereas :app_user holds the information of the department.
    Any hint is appreciated!
    Many thanks,
    Seb

    Okay, I just had the right idea and it's working well! Sorry for posting!
    I return the name of the employee that has edited a dataset and simply add all others of the logged on department! Really easy! Should have thought of that before posting! ;-(
    The correct code is select str_bearbeiter, cnt_bearbeiter from vt_tbl_bearbeiter a, vt_tbl_punktdaten b where a.cnt_bearbeiter = b.int_bearbeiter and
    inv_pt_id_sub = :P4_PTIDS
    union select str_bearbeiter, cnt_bearbeiter from vt_tbl_bearbeiter where int_behoerde in (SELECT
    CNT_REGIERUNGSBEZIRK FROM TBL_REGIERUNGSBEZIRK where STR_REGIERUNGSBEZIRK = lower (:app_user))Bye,
    Seb

  • Dynamic Select List based on TextField data

    Hi,
    I like to dynamically display the select list based on the value in the textfield, the data in the textfield is of character type.
    Thanks

    Hello,
    Well as you now know HTML based select lists don't work like that, that widget is called a combo box and there will be built in combo boxes in APEX 3.0, it's a fairly complex dhtml widget.
    What you might want to do is provide a text item next to your select box and an Add New Value Option in your select list.
    Carl

  • Populate a select list based on sql query

    I need to populate a select list using an sql query based on the value value I get from the previous page sent using link . How can I achieve this behaviour ? I tried giving select app_item_id a,app_item_id b from app_item_definition where app_id = :P11_APP_TDL_ID order by 1 in LOV, but it doesn't work . Please advice .

    Okay, I just had the right idea and it's working well! Sorry for posting!
    I return the name of the employee that has edited a dataset and simply add all others of the logged on department! Really easy! Should have thought of that before posting! ;-(
    The correct code is select str_bearbeiter, cnt_bearbeiter from vt_tbl_bearbeiter a, vt_tbl_punktdaten b where a.cnt_bearbeiter = b.int_bearbeiter and
    inv_pt_id_sub = :P4_PTIDS
    union select str_bearbeiter, cnt_bearbeiter from vt_tbl_bearbeiter where int_behoerde in (SELECT
    CNT_REGIERUNGSBEZIRK FROM TBL_REGIERUNGSBEZIRK where STR_REGIERUNGSBEZIRK = lower (:app_user))Bye,
    Seb

  • Select List based on other select List

    Hi
    I have 2 select lists when a selection is made in one I want the second list to be limited but when nothing is selected in the first list I want the second list to display all. Apolgies if this is really a plsql thing .
    Heres what I have so far
    if :P52_ORGNAME is null
    then
    return 'select unique surname d,id r from com_contact';
    else
    return 'select unique forename||surname d,id r from com_contact where orgname = :P52_ORGNAME order by id';
    end if;
    the else is fine but I cant get the null condition to work.
    :P52_ORGNAME is a select list where show null is yes and there is no NULL value
    thanks in advance
    Kirk

    Hi,
    you can try 2 things.
    1)try putting a null display value and keep null return value as blank. dont put any value in the default value also,and see if this works,
    2)else try putting a null return value(like BLANK) and check for that value in the condition insted of null. i.e
    if :P52_ORGNAME ='BLANK'
    then
    return 'select unique surname d,id r from com_contact';
    else
    return 'select unique forename||surname d,id r from com_contact where orgname = :P52_ORGNAME order by id';
    end if;
    Hope it works..

  • Select list based on color

    Hi there
    I need to create a static select list in a tabular form with the following values: Red, Amber, Green.
    However, instead of the color names, the user wants to see the actual colors in the the select list (changing background color for each option), so it is easy to spot the problematic ones (Red). Is this possible to be done using Apex 3?
    Thanks
    Luis

    Luis et al.
    Thanks for posting code to this forum, it has been a great help. I must admit that I know nothing about javascript (close enough to nothing) but through the great posts here I have been able to get the first part working and my list values change color when the page loads. However, when I use the select list I don't know how to implement the code Luis posted to change the background color in the select lists. Any further direction would be a great help.
    I have the example page here:
    http://apex.oracle.com/pls/otn/f?p=37008:18
    and this is the code I used so far in the HTML HEADER on the page:
    <script type="text/javascript">
    function setAll()
    obj=document.forms[0];
    len=obj.elements.length;
    for (i=0;i<len;i++){
    if (obj.elements.name=="f04")
    setColor(obj.elements[i]); }
    function setColor(sel)
    var obj=sel;
    if (obj.value=='GREEN')
    obj.style.backgroundColor= "green";
    if (obj.value=='YELLOW')
    obj.style.backgroundColor= "yellow";
    if (obj.value=='RED')
    obj.style.backgroundColor= "red";
    if (obj.value=='WHITE')
    obj.style.backgroundColor= "white";
    </script>
    Thanks again,
    Dave

  • Select List based on in-line query

    Hello everyone, im having a problem creating a select list with the following query:
    select result.A d, result.B r
    from dual,
    (select RMF.nome A, RMF.chapa B
    from
    medfa_marco_has_colaborador MC,
    medfa_projeto_has_colaborador MP,
    rm_funcionario RMF
    where
    MC.mar_id = :P3_SELECT_MARCO and
    MC.pro_col_id = MP.pro_col_id and
    MP.chapa = RM.chapa) result
    but i keep getting the
    "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."
    Thnx in advance.
    E.R

    Okay, first off - does this work in SQL Workshop?
    Have you got a semi-colon at the end of the query (you shouldn't have)?
    Also when posting code put {noformat}{noformat} before and after your code to preserve formatting and spacing.
    Cheers
    Ben
    http://www.munkyben.wordpress.com
    +Don't forget to mark replies helpful or correct+ ;)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Dynamic values of a select list based on a column

    Is there an easy way to build the values of a select list from a column that contains 'Red,Green,Blue" where Red, Green, Blue will be the values of the select list?

    Bob,
    Next time you could try this for a one row table:
    WITH DATA AS
         (SELECT     SUBSTR (txt
                            , INSTR (txt, ',', 1, LEVEL) + 1
                            ,   INSTR (txt, ',', 1, LEVEL + 1)
                              - INSTR (txt, ',', 1, LEVEL)
                              - 1
                            ) AS token
          FROM       (SELECT ',' || YOUR_COLUMN || ',' txt FROM YOUR_TABLE)
          CONNECT BY LEVEL <=
                          LENGTH (txt)
                        - LENGTH (REPLACE (txt, ',', ''))
                        + 1)
    SELECT *
    FROM   DATAOr use this if your comma separated values are in more than one row:
    http://blogs.ittoolbox.com/oracle/guide/archives/sql-question-pivots-analytics-and-the-judicious-use-of-row_number-10156

  • How to do dependent select list based on parent select list

    Hello... I have the following bit of code...
    *parent select
    htmldb_item.select_list_from_query(1,null,'select program_desc_eng, program_id from myfps_programs')
    * child select using parent value
    htmldb_item.select_list_from_query(2,null,'select sub_pgm_desc_eng, sub_program_id from myfps_sub_programs where program_id = <VALUE FROM ABOVE?>')
    I know this is easily done using the select list form items and such but I need to use the htmldb_item function. On screen when a user selects value from the parent select list, I want the child select list to use the value of the parent as a parameter into its own select list. How can I reference the parent? (ie can I use htmldb_application.g_f01(1) or something of this nature?) I realize I may need a bit of javascript to have it work correctly but I'm just wondering if its possible?

    This is not a trivial task.
    See http://forums.oracle.com/forums/thread.jspa?messageID=1241356

  • How to populate 'Select List' based on Radiogroup selection?

    Hi,
    I've a Radiogroup and on the selection of any of its item, I've to populate a 'Select List' from DB, what is the best way to do this?
    I'm on APEX 2.1.0.00.39, and the Radiogroup & Select List are part of a Form Region.
    To be honest, I don't even know whether to use Radiogroup with submit or redirect :-)
    Thanks for the help,
    -Hozy

    Hi,
    I have never worked on ver 2 of APEX so i dont know wheter these functionality will work or not..
    Option 1)
    1) Make the Radiogroup as Radiogroup(with submit)
    2) Create a select list with query something similar to
    select display_value d , return_value r from myTable where someColumn = :P1_MY_RADIO_BUTTON;
    Option 2) Use AJAX.. htmldb_Get()
    Regards,
    Shijesh

  • Disable Select List based on Button

    I'm a newbie to APEX and I'm trying to disable a Select List only when an onClick action happens in a button(Create New). Otherwise the Select List should be enabled. I know I should be using JavaScript to perform this, but have no clue where to/how to start. Can any of you guide me to any useful threads or perform examples?
    Workspace :SVENKAT
    User ID :[email protected]
    Password :lemope
    I appreciate any help. Thanks!!!
    Shaan

    Shaan:
    You should check out the demo application that is present in your workspace. The application exercises the basic features of APEX and is a good starting point for somebody that wants to learn APEX. For your particular need you should look at page 2 of the demo application. This page uses the 'Report/Form' APEX wizard. As you will see it allows you to 1) List all customers 2) Create a new customer 3) Update an existing customer 4) Delete an existing customer. All these features are implemented using a simple user interface(UI). The UI you have come up with is actually cumbersome and not very intuitive IMO. Take a few moments to get familiar with the demo application. Hopefully it will help you realize the shortcomings of the UI proposed by you. :)
    http://apex.oracle.com/pls/otn/f?p=25444:2
    Login as admin/svenkat
    Varad

  • Select lists empty or POPup LOV needed with redirect

    Hi all,
    I have a form where i need 6 select lists with redirect or 6 POPup LOV with redirects.
    These select lists are separated in three groups
    like this
    group 1
    departments select list with redirect
    employees popup lov (query based on the value of department)
    group2
    Order select list with redirect
    OrderItem popup lov but needs a redirect here for employees (query based on the value of countries)
    employees popup lov (query based on the value of department)
    group 3
    some status select list with redirect
    When I choose the first select list the popup LOV is populated with good values
    when i select a value from the second select list the value in the first list disappears, including the value of the first popup lov. etc.
    How is it possible to keep the values stored in the first selects list when selecting some value of the second list.
    How is is possible to make a popup lov with redirect so that the values are in session
    and can be used in another popup lov?
    Is someone there who have experiences with this issue?
    thanks in advance,
    Hugo

    Hi Hugo,
    I don't think that you need a redirect for that. Check out my AJAX cascading popup lov solution.
    http://inside-apex.blogspot.com/2006/11/generic-solution-for-depending-select.html
    Hope this helps
    Patrick
    Check out my APEX-blog: http://inside-apex.blogspot.com

Maybe you are looking for

  • Using 1 public Windows 7 folder, how do multiple users share itunes music?

    I have 4 users on Windows 7 which use iTunes under the same Apple account. All of the music files are in the same public folder, but not listed in each each user's library. How can I have these music files automatically appear in each user's library?

  • Show the 3 characters of a characteristic in BEX

    Hello, In Query designer ,I want to create variable which hold characters of 0material_prodhier from 6 to 9. I want  user to select three characters of 0material_prodhier from 6 to 9. How can I handle it? With a formula variable?

  • SSRS Report Excel, PDF, Word download error.

    I am facing urgent issue in downloading excel, word and excel format of report. If report size exceed 3+ Mb then I can enable to download the report. Reports gets downloaded for smaller size. Reports gets rendered properly in browser but when I tries

  • Cubes related to Industrial Machinery & Components

    Dear Friends Some of you may already worked or working on the IMC industry(Industrial Machinery & Components) . can anyone suggest me. what are the cubes you have used and what cubes can  be used from BI conent .  if you have any doumnets related to

  • Does Nokia even employ an R&D department anymore?

    Last time I owned a Nokia was over two years ago and recently I decided to go back to the make of mobile that I had been used to most of my mobile-life. I just bought a Nokia 5300 (slidy, music phone) and I am appalled that Nokia have not change or i