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

Similar Messages

  • 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

  • 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

  • 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+ ;)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • 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

  • 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

  • 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

  • POPUP LOV'S BASED ON SQL QUERY

    Help! I am a beginner with APEX and SQL in general, and I need help with an issue I am experiencing. I've created a POPUP LOV with the following SQL statement:
    SELECT CLOCK_NUMBER || ' ' ||LAST_NAME||', '||FIRST_NAME D, EMP_ID R
    FROM MASTER
    The return value should populate the table, but instead it is returning to the report in APEX. If I choose a SELECT LIST based on a named LOV, it works. But unfortunately I cannot use a SELECT LIST, but I must use a POPUP based on a named LOV. Has anyone had these issues with POPUP LOV's? This is driving me crazy, and I'm sure I'm doing something stupid!
    Thanks!

    I've researched this quite a bit and it seems that this is a huge problem with APEX 3.1. Basically, I've created a tabular form. I have a column based on a LOV. In a tabular form, you DO NOT have the option of creating a PopUP..KEY..LOV, which would work for me, since it writes the return value back to the table. The normal PopUP LOV that you have the option of implementing on a tabular form does not behave like a PopUP..KEY..LOV, but it brings the return value back to the report (which in my case would be an employee_id, which doesn't work), and writes the display value back to the table.
    To add insult to injury, a regular SELECT LIST (based on named LOV) would work, however my LOV violates the buffer (which is 32k) and I get this error:
    report error:
    ORA-20001: Error fetching column value: ORA-06502: PL/SQL: numeric or value error: character string buffer too small
    I've researched this error and there are about 10 to the 100 posts regarding it, especially when dealing with LOV's and select lists that violate the 32k limit.
    Any new fresh advice?
    Thanks for your response as well. I appreciate your time and any help you may offer.

  • How to create graph based on sql query

    Hi all,
    I am using jdev 10.1.3.3
    My requirement is need to ctreate graph(pie chart) based on sql query ex: select count(empno) from emp group by deptno;
    and also i need to give link on graph. If i click 10 deptno part in pie chart only 10 deptno employee list need to display.
    Please help meeeeeee
    Thanks
    NR

    Hi,
    just non click able graph in ADF 10g using BI Graph: http://www.freewebalbum.com/blogs/faces/bjanko/blogs.jsp?blog=bjanko20070629162305
    regards,
    Branislav

  • Bold a single row in a Report based on SQL Query

    Should be easy? So, how do I bold a single row in a report based on SQL query without creating a new template or writing Java for the page? What is the Tabular Form Element "Element Attributes" field for? Or what am I supposed to put in there to make it do anything?

    One way to do this is to add a hidden column to your report which contains the formatting value, for example:
    select empno
    , ename
    , sal
    , decode(empno,1,'font-weight:bold','font-weight:normal') style
    from emp
    Hide the STYLE column.
    Then you can use this column for each column in Column Formatting > HTML expression in this way:
    <span style="#STYLE#">#SAL#</span>
    Unfortunately you have to do this for each colum you want to appear bold.
    good luck,
    Dirk Dral

  • 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

  • Lookup vo based on sql query or on Entity?

    Hello all,
    which is better for performance to build a view object to be used as lookup [LOV] based on SQL query or build an Entity object and a view object based on it? and why?
    regards,

    As fas as i know,EO is better rather than SQL because result is backedup by EO cache..

  • 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

  • Dynamic Rendering of Child Component based on SQL Query

    I want to preface this with I am very new to ADF.
    I have a page with a parent-multi child (tabbed) layout, and what I want to do is render one of the children based on the values of a sql query. I tried creating a manged bean but I had no idea how to get the database connection, so I added a method to my application module implementation instead. The method is of type boolean that runs my sql query and based on the results, returns true or false. I then set the tab's Rendered property to this method, #{bindings.method.execute}. Unfortunately, when I run the application the tab is not rendered, no matter what the value of the results. I therefore set a breakpoint on the code and ran it through the debugger, but the code is never being executed.
    If anyone could help, it would be greatly appreciated.
    I am running JDeveloper 11.1.1.3, hitting an Oracle 11g database, using ADF BC.
    Thanks,
    Michelle

    I don't really know what you mean, here is my code:
      public boolean checkLevel2Needed(String revwId)
        PreparedStatement stmnt = null;
        StringBuffer sql = new StringBuffer();
        Object[] procArgs = new Object[]{ revwId };
        ResultSet rs = null;
        boolean level2Required = false;
        System.out.println(revwId);
        sql.setLength(0);
        sql.append("Select count(*) as yesCount from usq.vu_review_response ");
        sql.append(" where revw_id = ? ");
        sql.append(" and gp_name = 'Level 1 Screen' ");
        sql.append(" and resp_text = 'Yes' ");
        try
          stmnt = getDBTransaction().createPreparedStatement(sql.toString(), 0);
          if (procArgs != null)
            for (int z = 0; z < procArgs.length; z++)
              stmnt.setObject(z + 1, procArgs[z]);
          rs = stmnt.executeQuery();
          if (rs.next())
            if (rs.getInt("yesCount")>0)
              System.out.println(rs.getInt("yesCount"));
              level2Required = true;
          rs.close();
        catch (SQLException e)
          throw new JboException(e);
        finally
          try
            if (stmnt != null)
              stmnt.close();
          catch (SQLException e) {}
        return level2Required;
      }But I don't think it is ever executing this code, the system.out.println's don't show up in the console and if I run it through the debugger with a breakpoint it never stops.
    What I really need is for this code to execute when I enter this page, and also any time the page is updated. Should I be using a backing bean?
    Thanks,
    Michelle
    Edited by: MSchaffer on Jan 6, 2011 5:27 PM

  • Populate multi select list  in on demand application process

    Hi all,
    To populate a multi select list we use this code:
    DECLARE
    l_counter number;
    l_o_name varchar2(2000);
    l_val varchar2(100);
    BEGIN
    l_val := wwv_flow.g_x01;
    owa_util.mime_header('text/xml', FALSE );
    htp.p('Cache-Control: no-cache');
    htp.p('Pragma: no-cache');
    owa_util.http_header_close;
    htp.prn('<select>');
    FOR rec IN (
    SELECT DISTINCT DECODE(districtscode,NULL,'- Onbekend -',districtscode) as "NAME"
    , DECODE(districtscode,NULL,'-2',districtscode)as "ID"
    FROM table
    WHERE (UPPER(dienstcode) =(l_val)
    or l_val = '-1')
    and objectsubcategorie_id in (select objectsubcategorie_id from table where ind_actief = 'J')
    and ind_uitgesloten is null
    UNION
    SELECT '- Alle districten -', '-1'
    FROM DUAL
    ORDER BY 1
    LOOP
    htp.prn('<option value="' || rec.ID || '">' || rec.NAME
    || '</option>');
    END LOOP;
    htp.prn('</select>');
    END;
    However: L_val is determined by a multiselect list. So, L_id can be: 'A:B:C'. I can convert the value of l_id to 'A','B','C' (with eg replace function). However in a where clause one cannot say: WHERE UPPER(dienstcode) in l_val. So I created a refcursor which I put in a pl/qsl table. Then I looped through the pl/sql table.
    Somehow this did not have the same results. Eventhough the refcursor gave back the same data which I tested by logging the values of the pl/sql table just before the htp.prn command, the htp.prn did not return the values.
    Does anyone know why this happens? Is there a difference between the for loop in this code and looping through a self defined pl/sql table?
    Thanks in advance
    Maurice

    Please, anybody could help me with this?
    Thank you!

Maybe you are looking for

  • Fcpx looping at wrong folder for optimized clips

    When I'm optimizing an AVCHD in events browser it show H.264. Looking in in the rendering files the ApplePro Res422 is there. I don't want to reimport the media in the Events. Was functionning properly now don't !!! Look like a bug. Please help. Mich

  • A bizarre ORA-13349 case in 9i

    Hi all, We have just migrated from 8.17 to 9.2 and encountered a rather strange validation error on a particular polygon geometry. Subject Geometry: Parcel polygon composed of 4 polylines and 3 arcs. Validation SQL: SELECT SDO_GEOM.VALIDATE_GEOMETRY(

  • Cant edit information in iTunes (name/artist/genre etc.)

    I recently purchased a new PC reinstalled iTunes to the new computer. Finally got everything up and running,but now I can't edit any of the information such as song names,artist, genre etc. Tried clicking all over the place - tried both right and lef

  • Revolution VM indicator won't go away

    Started yesterday when i rec some VM's. I have listen to them and deleted them.  After shuting off (overnight) the indicator is still there. I dial VM and it says I have no messages.

  • I want to delete all my old post!!

    PLEASE FOR ADMIN TO DELETE ALL MY POST!!! AND HOW I DELETE MY ACCOUNT ?