Using Union in popup LOV

HI,
I want to select data from 2 tables using Union in Popup LOV ,
please help.
I am getting a error message like
"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."
when i use union query
my query is like this
select a from table 1
union
select b from table 2
order by a;

Hi,
Three things -
1) Remove the semi-colon from the end of your query (it can work without it, but you'll eventually run into problems some day by putting a semi-colon on the end, so better to get into the habit of not doing it).
2) You need to provide 2 columns in your query, a display value and a return value (look at the error message you are getting). You are only returning a single column.
3) Wrap your query inside another query to get it to work.
Something like this should work -
select * from (
  select 1 as r, 2 as d from dual
  union
  select 3 as r, 4 as d from dual)
order by dObviously change the values/columns to suit your own purposes.
Hope this helps,
John.

Similar Messages

  • 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

  • Disabling Popup LOV (named LOV) cell in my tabular form

    Hello.
    I have a tabular form.
    I have a column where I insert values based on the named list of values. I make the field of "Popup LOV (named LOV)" type. However, ApEx allows the values to be either picked from the popup list or entered manually into the field's text field. I want to prevent the user from being able to manuall enter the values into the field and force the use of the popup LOV.
    I know that selecting Popup LOVs for regular items in a region make the text field "disabled" disallowing direct entering of values. However, for tabular forms' fields, this does not seem to be the case.
    Is there a style I can add to the attribute to make this happen?
    thanks
    Boris

    Hi Boris,
    I'm glad that you are learning things through this forum!
    You can't validate tabular form items using the normal Item Level validation - as this is for page item names only (that is, P1_EMPNO for example).
    You can do validation using PL/SQL in a Page Level Validation. There are a number of examples on how to do this on this forum. Here's one by Denes: [http://htmldb.oracle.com/pls/otn/f?p=31517:41]
    When you submit a tabular form page, Apex creates collections for each "fnn" set of items. "f01" items are stored in APEX_APPLICATION.G_F01, "f02" items are stored in APEX_APPLICATION.G_F02 and so on. To validate any item, you loop through one collection and check its value or the values in the same position on the other collections.
    In Denes's example, he is looping through the "f02" items (that is APEX_APPLICATION.G_F02 from 1 to APEX_APPLICATION.G_F02.COUNT) and checks the values in the "f07" (APEX_APPLICATION.G_F07) and "f08" (APEX_APPLICATION.G_F08) items. The items are stored in their collections in the same order as they appear on the page, the first item in G_F01 is on the same row as the first item in G_F07 and so on. The validation(s) to perform will depend on your requirements.
    In the example, Denes is using a "Function Returning Error Text" validation. In these, you either return a string containing the error or NULL (meaning no error has been found).
    Andy

  • Strange behavior when Popup LOVs has read-only condition and Bug Report

    Hi,
    I observed an inconsistent behavior of Popup LOVs when the read-only condition is true. In that case the defined lov query is used to map the internal value of the page item to the display value defined in the lov query.
    What is the reason for this behavior? Because if the Popup LOV is in "edit mode" the page item value is just displayed without looking up the display value. The display value is just used for the popup lov. Mapping the value is normally a behavior of the popup key lov.
    -> The result is that different values are displayed if the page item is in edit or read-only mode. That's not really the behavior someone would expect.
    BTW, there seems to be a bug with "Display Extra Values" set to "Yes" in the case read-only is true. If the lookup doesn't return a value it just displays [ ], but because the property is set to yes it should display the value. The Popup Key Lov has the same bug.
    Thanks for bringing some light into that behavior
    Patrick
    Oracle APEX Essentials: http://essentials.oracleapex.info/
    My Blog, APEX Builder Plugin, ApexLib Framework: http://www.oracleapex.info/

    Patrick,
    I've added your comments to a task already in our queue to examine all item types for correct behavior in read-only mode. I've noticed the quirks with display extra values also.
    By the way, still interested in your thoughts re: Re: Bug Report: Images broke when using get_blob_file_src and not authentic .
    Scott

  • Popup LOV fails in firefox when using an outer join!!!

    I have a popup lov which contains at least 2 outer joins in my query. The popup renders fine in IE but i get the error message:
    "Popup List of Values query is invalid, a display and a return value are needed, the column names need to be different"
    when launching the popup from Firefox (1.5.0.2)
    Anyone got any idea why this works in IE but fails in Firefox?
    Cheers
    Duncan

    Hello,
    Duncan – If you'll run your example code on SQL*Plus, you'll see that for department "OPERATIONS" there is no returned value. This could happen with outer join. The problem can be with the way FF is interpreting this non-value. I didn't try it my self, but maybe if you'll use display null value with your LOV, it will solve the problem. Another possible option is to use NVL() on the returned value.
    Chris – Some of the Apex team members, like Carl, are using FF as their main browser. There are some compatibility issues with the last version of FF, but from that, to your conclusion of Apex only support IE, there's a long road.
    Regards,
    Arie.

  • Is there a problem using popup LOVs in a portal form with a bind variable?

    I have a portal form with 2 LOVs. The second LOV is a dependent LOV whose bind variable can be NULL. I have read Note 263923.1, "How To Create Dependent Lovs In Forms", and my form works as long as I use combo boxes to display the LOVs. I need to use popups so the user can search the LOVs as they are quite lengthy. Plus I want to be able to pick a value from my second LOV without selecting a value from the first LOV -- hence, my bind variable can be null and that is where my problem lies. As long as I select a value from the first LOV, the second LOV popup will work. If I click on the icon to display the second LOV without pre-selected a value from the first LOV, I get the following error:
    POPUP LOV ERROR:
    LOV: "9A17692880B6B8509F514F5B9CA9EC808DD403218B3CF19A33C04CD1FAB0ADE17ADC33E6B67998A933357CE5264D204E"
    Parse Message: Parse as pre-set global: "TORE".
    Find Message: LOV is of type DYNAMIC (LOV based on SQL query).
    Query: "SELECT ...."
    wwv_bind.prepare_bind: ORA-01403: no data found
    My form is based on a table with a custom layout. The sql for the second LOV is similar to: SELECT ENAME, EMPNO FROM SCOTT.EMP WHERE (DEPTNO = :DEPT AND :DEPT IS NOT NULL) OR :DEPT IS NULL.
    Thanks in advance for any help,
    Carol

    Don't use EPS any more! It does not support transparency nor color management.
    If you save vector files from Illustrator, use AI with PDF compatiblity.
    If you save image files from Photoshop, use PSD.
    If you save image files combined with vector forms and/or text from Photoshop, use PDP which is a Photoshop PDF.
    For vectors from Illustrator use CMYK files.
    For images use RGB, conversion to CMYK should never done before PDF export, better, if the printer allows it, is to export a PDF with live transparency as it is PDF/X-4
    If the printer requires a PDF with CMYK only export a PDF/X-1a.

  • Example: Cascading Popup LOVs (Solution using Ajax)

    If you need popup LOVs to depend on each other, here's a way to do it:
    Put this in the header text of the page:
    <script type="text/javascript">
    function clearFormData(data) {
    var items = new Array();
    items.push(data);
    for (var i = 0; i < items.length;i++) {
    var item = items;
    document.getElementById(item).value = '';
    if (document.getElementById(item+'_HIDDENVALUE')) document.getElementById(item+'_HIDDENVALUE').value = '';
    return true;
    function setSessionData(data) {
    var get = new htmldb_Get(null,document.getElementById('pFlowId').value,null);
    var items = new Array();
    items.push(data);
    for (var i = 0;i < items.length;i++) {
    var item = items[i];
    var tempObjID = (document.getElementById(item+'_HIDDENVALUE')) ? item+'_HIDDENVALUE' : item;
    get.add(item, document.getElementById(tempObjID).value);
    get.get();
    return true;
    </script>
    These are some helper functions (makes it easier to port to other pages, you could also put them in an external js file).
    Now on the second (or whatever) popup LOV (one that needs the value of another), put following code into the field "Form Element Option Attributes":
    [i]onclick="setSessionData('P1_FIRST_POPUP')"
    Change "P1_FIRST_POPUP" into the id/name of the popup LOV that the second depends on.
    Now to clear the second one (if there is already something in it) you can put this into the "Form Element Option Attributes" field of the first popup LOV:
    onclick="clearFormData('P1_SECOND_POPUP')"
    Change the "P1_SECOND_POPUP" into the id/name of the popup LOV that depends on the first one.
    If you need more than one item to be set in the session use the javascript functions like this:
    onclick="setSessionData(['P1_FIRST_POPUP','ANOTHER_ITEM';'AND_SO_ON'])"
    onclick="clearFormData(['P1_SECOND_POPUP','ANOTHER_ITEM';'AND_SO_ON'])"
    This is the best solution I figured out so far for cascading popups.
    Demo: http://apex.oracle.com/pls/otn/f?p=36908:2
    If you need cascading select boxes it's better to use this solution: http://apex.oracle.com/pls/otn/f?p=11933:37 .
    Edit:
    - works now regardless of being logged in or not, I just forgot to take ou the 0 in the htmldb_Get call (=> always
    sent the session id "0", which didn't exist)
    - added a link to the demonstration

    excellent tip for using ajax to update session state.
    one small change to share:
    function setSessionData() {
    var get = new htmldb_Get(null,document.getElementById('pFlowId').value,null,null);
    for (var i = 0; i < arguments.length; i++) {
    var item = arguments\[i\];
    var tempObjID = (document.getElementById(item+'_HIDDENVALUE')) ? item+'_HIDDENVALUE' : item;
    get.add(item, document.getElementById(tempObjID).value);
    get.get();
    return true;
    set 4th argument to htmldb_Get constructor to null.. causes the script to retrieve the value from the hidden form field, rather than being set explicitely.
    just noticed this code is different from the demo, which does set a static value of 2. Tempted to hit cancel, but maybe this can avoid someone else a lot of head scratching.
    also, was having issues with Array.push() during debugging to find the above issue.. and changed the way html form element id(s) are passed to the function; opted to use the implicit "arguments" array instead. Minor, but worth noting.
    thanks again for the useful piece of code.
    edit:
    this wiki doesn't parse brackets well; added char escapes so they'll show.. will need to remove by hand.

  • Passing Request to a POPUP LOV from previous page

    Hi All,
    I'm stuck again :( and its urgent..
    I have a popup LOV and i want to populate values in it based on REQUEST coming from first page.
    If I click CREATE on first page POPUP LOV should display certain values and if I click UPDATE on first page, it should populate different set of values.
    Also when I navigate further from this page and return back, the LOV's should have values based on previous request selected.
    For this I have created an item P_REQ which stores value of request from first page i.e :P_REQ wil have values CREATE or UPDATE.
    Now I'm able to pass this value to a select list. However a POPUP list is not able to fetch this P_REQ value.
    MY query for LOV is as below
    select d1 d ,r1 r
    from
    (select name d1 ,ID r1,'C' up_cr
    FROM Client
    'WHERE statusid in (1,3)
    union
    select name d1,ClientID r1,'U' up_cr
    FROM Client_List)
    where up_cr = decode(:P_REQ,'CREATE','C','U')
    ORDER BY d1
    Kindly help.. Its Urgent..

    Hi,
    If you use that computation to set the value of P_REQ it is actually also saving it in the session. The value stored can then be retrieved by the popup LOVs query using :P_REQ so you don't need to pass the value at all as it is already available.
    To see this, go to: [http://apex.oracle.com/pls/otn/f?p=33642:237] The list of employees has INSERT or UPDATE in the final column. This is used in the link on the EMPNO column as the "Request" setting. This link passes you to another page which uses the computation to set the value in P238_REQUEST (this is displayed on the screen). Then you have a link to "Open popup". All this does is open another page which has a region with a source of: Request value: &P238_REQUEST.
    Andy

  • Change Colour of PopUp Lov

    I have the following code for a popup lov
    select a,b from
    select '1' res, htf.escape_sc(su.sukey) a, htf.escape_sc(su.sukey) b
    from udm_su su, udm_lde lde
    where su.ldeid = lde.ldeid
    and su.sukey in (select su_generic
                     from vrp_cfg_gensuconv)
    and lde.ldekey = :F140_LDEKEY
    union
    select '2' res, htf.escape_sc(su.sukey) a, htf.escape_sc(su.sukey) b
    from udm_su su, udm_lde lde
    where su.ldeid = lde.ldeid
    and su.sukey not in (select su_generic
                     from vrp_cfg_gensuconv)
    and lde.ldekey = :F140_LDEKEY
    order by res, a, bWhat I want to do is dispaly the result of the first select statement in red
    and the second in blue
    Cheers
    Gus

    Gus C wrote:
    Apex 3.2Don't have 3.2 around to experiment with. If the above doesn't work in 3.2 then I'm inclined to think that it isn't going to. Which is odd as the indications are that the restrictions were introuced in APEX 4.0:
    <li>{thread:id=1338180}
    <li>{thread:id=2126522}
    Part of the problem is that LOVs rendered as select lists (which is most common) cannot contain HTML elements ( +{thread:id=898835}+ ), but the less common Pop-up LOV renderings can.
    If this is a critical requirement, then 2 possibilities come to mind:
    1. Fairly complex modification of the Pop-up Page/LOV templates to include JavaScript/AJAX that will execute for this list, figure out how many entries need to be each colour, and iterate over the options adding the require styles.
    OR
    2. Use a report on a pop-up page rather than an LOV.
    Both look like more trouble than this is worth.

  • Popup LOV Returning Values

    In my entry form I'd like to use the "Popup LOV" to bring the names of employees. I use the following statement:
    SELECT full_name, party_id
    FROM vs_parties
    ORDER BY 1
    Everything seems to be working OK, however, only "party_id" is returned to the form. Is there a way I can hide the ID field and display the related "full_name" only.
    Regards, Tomas

    In order to clear out a Popup Key LOV value it was suggested to ..... Preface the query with [select '-choose option-' a, 0 b from dual union all ...].
    Does anyone know of a fix for this solution if you want to set the value to null? Because as it stands if you use this query and replace "0" with null, the popup key lov actually returns "-choose option-" for both the display value and the actual value. I cannot use the value of "0" so that is why I am needing it to return as null.
    Here is an example I posted up, the field that has the Popup key is "Name" you will see that once you pick "choose option" and save the record that in the report it sets the value of name to "-choose option" instead of null. Once this happens you cannot edit the record unless you do a backend SQL update to set value to null or a anything else.
    Here is the link: http://htmldb.oracle.com/pls/otn/f?p=37103:21
    This is the LOV query used for Name:
    select '-choose option-' a, null b from dual union all select IP a, ip_id b from IP order by a

  • Dynamic popup LOV

    I have a select list with 3 values. The value chosen determines the table name and column name to be used for a subsequent popup LOV.
    How can I do this?
    The query for a popup LOV doesnt seem to accept a PL/SQL block returning a query like a report region does.
    Thanks

    OK I got this.
    I changed the select list to 'select list with redirect' so that it sets just that value in session state and wrote my LOV query as
    select col1 d,col2 r
    from table1
    where :P1_SELECT='Table1'
    union all
    select col3 d,col4 r
    from table2
    where :P1_SELECT='Table2'
    union all
    select col5 d,col6 r
    from table3
    where :P1_SELECT='Table3'
    Depending on the value of the selected item, only one of the above queries should be executed.
    Thanks

  • Theme 23 does not display popup LOV in tabular form

    I created new application using new Theme 23. In tabular form the popup LOV button does not show. While using this theme the column LOV button is soooooo small it is not visible. If I move the cursor on the side of the field eventually I cursor handle will change and I can click and popup LOV will show. When I switch to an older theme (e.g. 21) the LOV button shows just fine.
    Does anyone can offer a solution? Can I expect more this type of problems in the new theme 23?

    I examined exported application file. Indeed the problem is p_column_id parameter. It should be decimal number for translated application. Characters %2C in p_column_id value stands for comma. It should be dot instead. Parameter value should be p_column_id=30289208519476123679.915121.

  • How to get the value from one Popup lov column to another popup lov column

    Hi,
    I am new to oracle apex development and having the below issue.
    In my application, there is a tabular form with 15 columns ( c1.. c15).
    I have to populate the value of column C5 based on the selected(from popup lov) value of column C3, tried to use onchange, but didn't help much.
    Any help please.
    Thanks and Regards,

    Oh boy, this is a fun one.
    onchange should work theoretically (in this example, assume that f05 is the target column that should be set and "this" is the source item whose value is to be transferred to f05 on the same row (row 2)):
    onchange=$s('f05_0002',$v(this));
    BUT the catch is of course that needs to be different for every row (can't hardcode the '2'), so you need something to dynamically create the row number component.
    I wrote this for an app I'm working on that uses master-detail forms heavily (I also wrote a lot more code to read the fmap array that is in v4 so that I can reference my cells via their column name and not the numeric position (so "f05 can be determined w/o hard coding), insulating against columns moving around, columns being made display-only etc. but I won't bore you with that here unless you really need to know).
    function getRow(pObj)
    { //Pass in an object reference to a tabular form cell and get back an integer
      //derived from the object ID.
      var vRow=pObj.id.substr(pObj.id.indexOf("_")+1);
      if (isNaN(vRow))
        return (null);
      return (parseInt(vRow,10));
    function formatRow(pRow)
    { //Pass in an integer and it'll be returned as the tabular form cell ID suffix
      //(e.g.: pass in 1 and get back string "_0001").
      //Used in building ID references to tabular form cells.
      if((isThingEmpty(pRow)) || (isNaN(pRow)))
        return(null);
      var vRow=pRow.toString();
      while(vRow.length<4)
        vRow="0"+vRow;
      return("_"+vRow);
    }Therefore:
    onchange=$s('f05_'+formatRow(getRow(this)),$v(this));
    So in essence, pass in "this" which will be a reference to the current item, largely to determine what row we're on. getRow will return 1, 2, 3, etc. formatRow will take that and return 0001, 0002, 0003, etc. Once that is done, it'll concatenate with the f05 and f04 to refer to the correct columns (determining f05, f04, etc. dynamically is another matter if you really need to but I didn't want to complicate this answer too much at once).
    Note: above I also use a isThingEmpty() function that I wrote. It does nothing other than check the item for an empty string, if the item is null, etc. Just do your own evaluation of empty-string, no-value, etc. there.
    It would indeed be nice though if Apex had a better way to delclaratively access the tabular form items though. Despite all the v4 enhancements, tabular forms were not entirely upgraded to the same full functionality of page items.

  • Popup lov in a report is not working if I have an order by caluse

    I created a form manually using the document from the url:
    http://otn.oracle.com/products/database/htmldb/howtos/tabular_form.html#MANUAL
    I used the following query from that document.
    select htmldb_item.hidden(1,empno) empno,
    ename,
    htmldb_item.select_list_from_query(3,job,'select distinct job, job from emp') job,
    htmldb_item.popupkey_from_query(4,mgr,'select ename, empno from emp',10) mgr,
    wwv_flow_item.date_popup(6,null,hiredate) hiredate,
    htmldb_item.text(7,sal,10) sal,
    htmldb_item.text(8,comm,10) comm,
    htmldb_item.select_list_from_query(9,deptno,'select dname, deptno from dept') deptno
    from emp
    This works fine.
    But if I add an order by clause to the query the popup key for mgr column doesn't work.
    select htmldb_item.hidden(1,empno) empno,
    ename,
    htmldb_item.select_list_from_query(3,job,'select distinct job, job from emp') job,
    htmldb_item.popupkey_from_query(4,mgr,'select ename, empno from emp',10) mgr,
    wwv_flow_item.date_popup(6,null,hiredate) hiredate,
    htmldb_item.text(7,sal,10) sal,
    htmldb_item.text(8,comm,10) comm,
    htmldb_item.select_list_from_query(9,deptno,'select dname, deptno from dept') deptno
    from emp
    order by ename
    Is this a bug ?
    Is there a work around ?
    Thanks
    Chandra.

    Chandra,
    Please refrain from asking the exact same question twice. It doesn't help the quality of this forum. If you have to, "bump" an existing unanswered question up (wait a day or two, please) in case it fell through the cracks.
    Now for the answer:
    select htmldb_item.hidden(1,empno) empno,
    ename,
    htmldb_item.select_list_from_query(3,job,'select distinct job, job from emp') job,
    htmldb_item.popupkey_from_query(4,mgr,'select ename d, empno r from emp',10) mgr,
    wwv_flow_item.date_popup(6,null,hiredate) hiredate,
    htmldb_item.text(7,sal,10) sal,
    htmldb_item.text(8,comm,10) comm,
    htmldb_item.select_list_from_query(9,deptno,'select dname, deptno from dept') deptno
    from (select * from emp order by ename)
    Use an inline view like in the example above to do the sorting first. If you sort a result set that includes Popup LOVS, then the Javascript used to populate the text fields doesn't work anymore.
    Sergio

  • How  to Create Multi select  Popup LOV

    Hi,
    I have a requirment in my application like Below scenario.
    I created one page like compose mail. In that i have used popup lov for selecting the user.
    But the problem is, it is allowing only one user to be select.In my case i want to select multiple users to send the
    mail.
    Please help me.
    NR

    Hi,
    How many users do you have in total? If it is a small number (a few dozen) you could use a multi select list or a shuttle item.
    However if there are hundreds of users to choose from, you may need to write your own pop up LOV to select them (probably using an Apex collection to store the temporary list).
    Or if you are really cool you could do something web 2.0-style using ajax (like those boxes in facebook where you just type the names of the persons and it shows a autocomplete list).
    Luis

Maybe you are looking for

  • What are the OLAP cube data access auditing capabilities

    Hi All, We are currently activating RDBMS fine-grained-audit (FGA) policies on our datawarehouse to comply with security policies in place in our company. Part of our datawarehouse store financial confidential data for which we need to perform access

  • How to use custom function for formatting the Line Chart Axes?

    Hi... I'm using a Line chart who's y axis value range from 0 to 50000. This is a number which it gets from it's dataProvider. I want to format this and show it as $50,000 $40,000 $30,000 $20,000 $10,000 $0 instead of 50000 40000 30000 20000 10000 0 H

  • 135 page pdf will print mainly blank pages

    Previously my HP 7410 would print these large documents fine. Now it mainly prints blank pages. It will print 10 pages OK but not any greater number of pages of the document. I am running XP on a Dell desktop with a Linksys router for a laptop. I get

  • Problem while using an adobe form "Unable to fulfil request for memory"

    Hi Experts, When I try to call a Adobe Form from the porta,l the system encounters a problem and the error message is "Unable to fulfil request for 3665920 bytes of memory space.".Could yopu please provide you valuable suggestion to resolve the issue

  • PS6 is suddenly crashing.

    Photoshop CS 6 crashed twice this evening. Enclosed is the crash report: Log Name:      Application Source:        Application Error Date:          10/26/2012 6:36:58 PM Event ID:      1000 Task Category: (100) Level:         Error Keywords:      Cla