LOV query first||last

I want to create a LOV query that concats the lastname firstname and then returns emp# as the key.
How do I embed it in such a way to make this happen.
I used the following but get an error:
select last_nm ||' '|| first_nm, Employee_nbr from hr.v_keys_employee@dwprod order by 1
The error is: LOV query is invalid, a display and a return value are needed, the column names need to be different.

I am doing the same thing. I want only employees of a certain type so I want to join on another table. It took forever to get the syntax just right but this works:
select fac_contacts.txtlastname ||', '|| fac_contacts.txtfirstname emp_name,
fac_contacts.id return
from fac_contacts, fac_lk_contact_types
where fac_contacts.contacttypeid=fac_lk_contact_types.id
and fac_lk_contact_types.txtname='Facilities'
order by 1

Similar Messages

  • How to accessing current row report column value in Lov Query?

    Hi,
    which access methods (eg. bind variables, substitutions, ...) for getting the current row report column value can be used in the "Lov Query" property of a report column?
    As what I know of and what I have read on the forum there are no bind variables for the report columns. For the "Link Text" property it seems that the column values exist as substitution strings (#COLUMN_NAME#). But they don't work in the Lov Query. => And would be good because of a hard parse each time the Lov query is executed.
    The following post (Re: Simulating a correlated sub query in lov
    is showing a solution to use package variables for temporary storage of the referenced value, but the only problem with that solution is that if a new record is added with the "Add rows to tabular form" process the package variable still contains the value from the last queried row! Is there a way (variable, APEX package, ...) to determine if the lov query is executed for a new record so that the package can return null?
    I know that I could write the package in a way that the value is immediately cleared when lov_pkg.keyval is called (one time read), but then I would have to create several variables if I'm accessing the value multiple times in the query or in another query => I think an one time read solution would be very obscurely.
    Thanks for your help
    Patrick
    http://inside-apex.blogspot.com

    Hi Patrick,
    I agree that it's a waste to continually use Ajax to go back to the server to get the contents of a dynamic select list.
    There are no bind variables for any row item - but what you do have, as per my previous post, is the value of the data entered by the user in the first row. You can pass this into your application process (using get.add("VARIABLENAME", value)), which can use it to retrieve the correct LOV in your Ajax code - this will give you a "bind variable" that your process can use.
    What you could do, however, is generate hidden select lists on your page - one for each possible LOV list and replace the contents of the new row's select list with the contents of the appropriate hidden select list. This is easy to do with javascript (using innerHTML functions). Obviously, though, the usefulness of this depends on the number and size of the select lists.
    Even if you don't generate them to start with, you can keep a copy of any select lists returned by Ajax in the DOM for use on new rows. So, if you have retrieved a select list, you will have a copy of it in DOM which you can then copy into the new row. If you don't have the list in DOM, use Ajax to get it, store a copy of it and copy it into the new row.
    Which method you use will depend on the number/size of select lists needed. If they are few in number and/or size, I would suggest generating hidden lists. If they are large, use Ajax to get them once, store them and then retrieve them from the DOM when needed.
    There is another thread here where Arie recommends going to the server every time to make sure you get the most up-to-date data for the lists. If you want to follow this advice, for this reason, use get.add("VARIABLENAME", value) to pass the value to your process. If this is not an issue, you can use one of the other methods I outlined above.
    Regards
    Andy

  • LOV Query is Invalid

    When testing the following in SQL Commands it runs.
    select DISTINCT LNAME, FNAME as display_value, FNAME||' '|| LNAME as return_value
    from PERSONNEL_SSN
    where ACTIVE = 'Y'
    order by 1
    However, I get an LOV Query is Invalid error when trying to use it in Source: Lists of Values Query.
    I'm new to Apex and am learning as I go.
    Any suggestions would help.
    Thanks!

    As Marc advised, you are returning an additional field, although I suspect you are maybe attempting to display "Last Name, First Name" - if so, you would do this:
      select distinct lname||', '||fname display_value
           ,fname||' '||lname return_value
      from personnel_ssn
    where active = 'Y'
        order by 1Having said that, you might want to re-visit your data model - you might come unstuck if new employee "Michael R. O'Donnell Esq." joins the organisation on the first day of your holiday... :-)
    Edited by: Joel_C on 16-Nov-2011 15:42

  • Concatenation of 2 return value LOV query

    LOV query with 2 columns in the return_value

    Dear Neha Sharma!
    Try this kind of query as source for your LOV:
    SELECT col1 || ':' || col2 AS return_value, col3 AS display_value
    FROM   your_table;To use only one of the both returnvalues you may split up the returnvalue with REGEXP_REPLACE
    REGEXP_REPLACE(return_value, '^(\S+):(\S+)$' , '\1')This will give you the first part of returnvalue -> col1. To get col2 use \2 as the last parameter of REGEXP_REPLACE.
    Yours sincerely
    Florian W.
    Edited by: Florian W. on 24.06.2009 07:45
    Edited by: Florian W. on 01.07.2009 07:47

  • Invalid LOV query error

    I am trying to modify a query for LOV page item but get an Invalid LOV query error when trying to Apply Changes to my page(query however works in SQL*Plus)
    I am trying to change the date format of query result to MON YYYY.
    Original query that works:
    select distinct bill.BILLED_DATE display_value, bill.BILL_ID return_value
    from BILL;
    New Query that fails in APEX (but works in SQL*Plus)
    select distinct to_char(bill.BILLED_DATE, 'MON YYYY') display_value,
    bill.BILL_ID return_value from BILL;
    Anyone have any idea what I need to do to make this work?
    "1 error has occurred
    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"

    Strange, this lov does work and is no different than yours:
    select distinct to_char(sysdate,'MON YYYY') disp, 1 retval from dual
    What are the results from the query? Can there be something wrong with that?
    Regards Guido

  • 1.6 LOV query invalid, was working in 1.5

    The following LOV query was valid in 1.5:
    select rd.name, rd.refdata_id from refdata rd, refdata_meta meta where meta.name = 'Title' and rd.refdata_meta_id = meta.refdata_meta_id and (:20_PATIENT_ID IS NOT NULL OR visible = 'Y') order by rank
    This query is being flagged as invalid in 1.6. The problem appears to be the parenthetical OR clause, since taking it out passes validation. The error message is:
    "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."
    Seems to me that the validator is equating the existence of a left parenthesis with an inline query, which of course is incorrect as the above perfectly valid SQL demonstrates.
    The query with the OR clause operates to populate the LOVs just fine in my existing app migrated from 1.5, so this is a maintenance and new app creation issue.
    I can of course work around it by views as needed to support a simplified LOV query, but I would much rather just get the former level of functionality back. Any prospect of fixing what appears to me to be a bug in the LOV query validator for the 1.6 platform?
    thanks,
    susan weber

    Susan,
    In 1.6, we introduced LOV query validations, to help head off problems before runtime. Looks like in this case, the check has a bug. It's trying to parse your SQL as if it were a query in a region and it fails because of the item name you are using that begins with a numeric digit and is followed by non-numeric characters. Such a query fails to parse with DBMS_SQL.PARSE. But the query does work, as you know, in an LOV, where EXECUTE IMMEDIATE with a USING clause handles it okay.
    So we have three bugs, the LOV query validation algorithm, the misleading validation failure message, and the bug that allows users to create and use items with names that are not valid Oracle identifiers. Thanks for pointing this out.
    Your workaround is to use v('20_PATIENT_ID') instead of using bind variable notation.
    Scott

  • Select list and subquery: "LOV query is invalid"

    Hi all,
    I want to create a select list with the following format:
    "name1 (count of another table)"
    "name2 (count of another table)"
    I've boiled it down to a simple query with a non-correlated subquery that works fine in SQL*Plus but not as an LOV:
    select table1.field1 || (select count(*) from table2) d,
    table1.field2 r
    from table1
    I get this (Apex 3.2.1):
    1 error has occurred
    * 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.
    Even this doesn't work:
    select table1.field1 || (select 'a' from dual) d,
    table1.field2 r
    from table1
    I've tried it with an inline view, joining table1 to a select from table2 that returns the count, but I get the same result. Any ideas?
    Edited by: MalcA on Jan 22, 2010 12:14 PM

    I don't know, but the difference is that the count(*) code goes from the select clause to the from clause.
    Other times I had the same problem and always did it and it was the solution.

  • Urgent: Formular question: get first/last month value with qty value

    We've got a query result as the following:
    Jan_2007 -- Feb_2007 -- Mar_2007 -- Apr_2007
    0 --- 54 --- 0 --- 3
    23 ---0 --- 12 --- 7
    In the above query result,
    1st row shows the sales quantity in Jan_2007 is 0, in Feb_2007 is 54, in Mar_2007 is 0, and in Apr_2007 is 3.
    2nd row shows the sales quantity in Jan_2007 is 23, in Feb_2007 is 0, in Mar_2007 is 12, and in Apr_2007 is 7.
    We would like to add a new column to get the first/last month value with quantity, e.g., in 1st row, the 1st month value with quantity value (>0) is Feb_2007, and the last month value with quantity value (>0) is Apr_2007. Therefore the 1st month value with qty is Feb_2007 and the last month value with qty is Apr_2007. In 2nd row, the first month value with qty is Jan_2007 and the last month value with qty is Apr_2007. But how to use formular to get the 1st/last month values with qty?
    We will give you reward points!

    Hello Kevin,  
    You can create forumula using [Boolean Operator|http://help.sap.com/saphelp_nw04/helpdata/en/23/17f13a2f160f28e10000000a114084/content.htm]
    IF<Logic Expression> THEN <Expression1> ELSE <Expression2> can also be made using a formula in the form
    You can also use the [AND, OR Logical operators |http://help.sap.com/saphelp_nw04/helpdata/en/23/17f13a2f160f28e10000000a114084/content.htm]to check all the keyfigure columns.
    Thanks
    Chandran

  • LOV Query problem

    I have a very huge and a lenghty LOV Query . I am using 6i builder and when i save the module and try to reopen it , Only 3/4th of the LOV query is available and the remaining disappears . I can compile this in 6i by copying the query again but it creates a problem in 10g . ie. The Fmx file is not generating in 10g.
    Firstly ,
    I haven no idea as to why the code disappears for no reason ? IS it because its too lenghty. I am sure there are no errors because it wouldn't have compiled if there were any .
    Anybody who has come across such problems , kindly advice!
    Thank you .

    hii,
    Create a VIEW of your query in database level and then create LOV based on that VIEW.
    Regards
    PS

  • LOV query is invalid, a display and a return value are needed

    hello - i am having this issue and can't get around this when creating a popup LOV based on sql.
    below is LOV query. as you see the view has only two columns. I tried various ways by giving alias to columns in query but nothing works. What did I miss here?
    select description,inventory_item_id from xx_apex_inv_v
    1 error has occurred
    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.

    Did you try it like this?
    select description d, inventory_item_id v from xx_apex_inv_v

  • Can someone tell me what's wrong with this LOV query please?

    This query works fine..
    select FILTER_NAME display_value, FILTER_ID return_value
    from OTMGUI_FILTER where username = 'ADAM'
    But this one..
    select FILTER_NAME display_value, FILTER_ID return_value
    from OTMGUI_FILTER where username = apex_application.g_user
    Gives the following error.
    1 error has occurred
    * 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.
    Thanks very much,
    -Adam vonNieda

    Ya know, I still don't know what's wrong with this.
    declare
    l_val varchar2(100) := nvl(apex_application.g_user,'ADAM');
    begin
    return 'select filter_name display_value, filter_id return_value
    from otmgui_filter where username = '''|| l_val || '''';
    end;
    Gets the same error as above. All I'm trying to do is create a dropdown LOV which selects based on the apex_application.g_user.
    What am I missing here?
    Thanks,
    -Adam

  • Trouble using pipelined function in an select list lov query

    I'm trying to use a pipelined function in a select list lov query but i cet the 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 query is as follows :
    SELECT gt.navn d, gt.GEOGRAPHY_TYPE_ID r
    FROM GEOGRAPHY_TYPE gt
    WHERE gt.kode NOT IN (1)
    and gt.kode in (select lov_value from table(RAPPORT_FILTER_PKG.GET_RAPPORT_FILTER_VALUE_PIP (
    SYS_CONTEXT ('rapport_filter_ctx','filter_id'),'GEOGRAPHY_TYPES')) )
    ORDER BY gt.navn DESC
    if i use a discrete values '80' instead of the call to
    SYS_CONTEXT ('rapport_filter_ctx','filter_id')
    i don't get eny errors, but then the LOV isn't as dynamic as i has to be
    any idears???
    Edited by: [email protected] on Dec 1, 2008 8:50 AM
    Edited by: [email protected] on Dec 1, 2008 11:17 AM

    nope that doesn't do it either
    contains a syntax errror at
    SYS_CONTEXT (('rapport_filter_ctx',:P500_RAPPORT_FILTER_ID),'GEOGRAPHY_TYPES'))
    my theory is that it's got something to do with the way APEX binds values because
    the query
    SELECT gt.navn d, gt.GEOGRAPHY_TYPE_ID r
    FROM GEOGRAPHY_TYPE gt
    WHERE gt.kode NOT IN (1)
    and gt.kode in (select r from table(RAPPORT_FILTER_PKG.GET_RAPPORT_FILTER_VALUE_PIP ('80','GEOGRAPHY_TYPES')) )
    ORDER BY gt.navn DESC
    works fine in both TOAD and in APEX but as soon as i replace th '80' with :P500_RAPPORT_FILTER_ID then, apex won't accept the code??????
    Edited by: [email protected] on Dec 3, 2008 7:54 AM

  • LOV Query Invalid

    Hello.
    I am uisng Apex 4.1 on Oracle 10.2.0.5 and Oracle App Server.
    Would someone please tell me why the following LOV query is causing the dreaded 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.
    select d, r
    from
    select
    '(select)' as d,
    'javascript:void(0)' as r
    from dual
    union
    select
    initcap(INFO_NAME) as d,
    'javascript:popUp2(''' || INFO_LINK || ''', 1000, 800);' as r
    from INFO_LINKS
    order by 1Running this query in the SQL Commands section returns the result set without problem.
    Related to this, I've noticed that I am getting this same error for many similar LOV "complex" queries that involve things like UNIONs or sub-queries. In fact, when I bring up an already working LOV query in the LOV editor and then simply click the "OK" button without modifying the query, I get this same error. WHY?
    Thanks in advance for any help on this.
    Elie

    Hello Everyone.
    I just realized what my mistake is.
    Many of the individual lines in my LOV query are ending with a carriage-return character. And so, the following code line is literally concantonated with the previous line.
    Once I added one or more space characters to the end of each code line, Apex accepted the query without problem.
    Whew! That was tricky, indeed.
    And this is why many of my other already working queries suddenly caused the error when I clcik the OK button in the LOV editor. For some reason, bringing up these already existing, working queries stripped awawy any space characters from the very end of the code codes.
    I hope this helps others facing the same issue.
    Elie

  • LOV Query with decode

    Hi All,
    I have following Query for my LOV.
    SELECT DECODE (PTY_COMP_FLG, 1, PTY_COMP_E_NAME,
    PTY_E_FIRST_NAME || ' ' || PTY_E_LAST_NAME)
    PTY_NAME,
    PTY_NUM
    FROM RE_PARTY
    WHERE PTY_TYPE = 1
    ORDER BY 1
    I get the 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.
    Please help me out of this.
    Thanks in advance.
    Regards
    Arif
    Message was edited by:
    Arif

    Check the query once again, as it should work.
    Ex:
    SELECT DECODE (EMPNO,2839,ENAME,JOB||' '||'NO MANAGER') Display_Value,
    EMPNO Return_Value
    FROM EMP
    WHERE JOB <> 'MANAGER'
    ORDER BY 1
    Its just a query tried in LOV and it is working.
    Regards
    Ckengs

  • "FROM" in a string in a LOV query

    An LOV query such as this:
    select c001 || ' from '  d, seq_id r
    from   apex_collections
    where  collection_name = 'ABC'
    order by 1produces this error when trying to save the LOV: "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."
    Splitting the string into two pieces (e.g., ' fr' || 'om ') avoids the problem. Looks like the parser isn't tokenizing strings before looking for keywords.
    Rodney

    Rodney,
    Looks like it just doesn't like the space at the beginning.
    That said, this worked for me:
    SELECT c001||chr(32)||'from ' d, seq_id r
    FROM apex_collections
    WHERE
    (collection_name = 'ABC'
    ORDER BY 1
    Chad

Maybe you are looking for

  • XP mode looses network connectivity periodically on multiple Dell Optiplex Windows 7 Professional PCs.

    XP mode looses connectivity periodically throughout the day on a daily basis but Windows 7 Pro host PC never looses connectivity.  Problem is at its worst when the XP mode has been running all day.  If XP mode is rebooted once daily, problem is reduc

  • Auto login in AUR with Firefox.

    Is there a way to auto login into AUR with Firefox. Now when I get there, the username and password is filled in. But I would like to be logged in. I think Opera does it. Possible?

  • Vbscript using Manufacturer to run a program install

    Hello, I'm new to scripting and was looking for assistance on my attempt to use a vbscript to install a program based on manufacturer detected. Basically, I would like to have the script detect if it is a Dell or an ASUS system then depending on what

  • "Filtered By" option in Robohelp ??

    Hi guys ! I need to develop help file (in chm format) for our company' s product, i am new with RoboHelp using trial version and want to know whether this version of RoboHelp supports "Filtered By" option while compilation? We want to create a hifi h

  • Adobe Encore CS4

    My adobe Encore CS4 d'ont work - It blocks at Initializing Transcoding!