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
Similar Messages
-
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 weberSusan,
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 -
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 -
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 PMI 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. -
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 -
LOV Query is "invalid" all of a sudden...
The query below was written a while back (I've been through several APEX upgrades since then). I recently went in to the LOV Definition to make some changes and found that, no matter what I do, I get the error:
"LOV query is invalid, a display and a return value are needed, the column names need to be different..."
This is even true if I make no changes to the Query but try to "Apply Changes". I'm guessing that an upgrade someplace along the line is causing this.
Any ideas on how to make this query valid once again?
(APEX 3.1)
Thanks!
Alex
SELECT 'ES Value of ' || TO_CHAR(round(ve_value,-2),'$99,999,999') d, 'ES' c
FROM QUERY_MAIN qm
WHERE query_id = nv('P310_QUERY_ID')
AND subject_propid = nv('P309_BLS_PROPID')
AND nvl(ve_value,0) > 0
UNION
SELECT 'PV Value of ' || TO_CHAR(round(Bluelime_Common.get_perfect_value(nv('P309_BLS_PROPID'), NULL, NULL, TO_DATE(:p0_base_date, 'MM/DD/YYYY')),-2),'$99,999,999') d, 'PV'
FROM dual
where TO_DATE(:p0_base_date, 'MM/DD/YYYY') != trunc(sysdate)
UNION
SELECT 'PV Value of ' || TO_CHAR(round(Bluelime_Common.get_perfect_value(nv('P309_BLS_PROPID')),-2),'$99,999,999') d, 'PV'
FROM dual
where TO_DATE(:p0_base_date, 'MM/DD/YYYY') = trunc(sysdate)
or :p0_base_date is nullHave you tried this:
SELECT disp_val d, ret_val r
FROM (SELECT 'ES Value of '
|| TO_CHAR (ROUND (ve_value, -2), '$99,999,999') disp_val,
'ES' ret_val
FROM query_main qm
WHERE query_id = nv ('P310_QUERY_ID')
AND subject_propid = nv ('P309_BLS_PROPID')
AND NVL (ve_value, 0) > 0
UNION
SELECT 'PV Value of '
|| TO_CHAR
(ROUND
(bluelime_common.get_perfect_value
(nv ('P309_BLS_PROPID'),
NULL,
NULL,
TO_DATE
(:p0_base_date,
'MM/DD/YYYY'
-2
'$99,999,999'
) disp_val,
'PV' ret_val
FROM DUAL
WHERE TO_DATE (:p0_base_date, 'MM/DD/YYYY') != TRUNC (SYSDATE)
UNION
SELECT 'PV Value of '
|| TO_CHAR
(ROUND
(bluelime_common.get_perfect_value
(nv ('P309_BLS_PROPID')
-2
'$99,999,999'
) disp_val,
'PV' ret_val
FROM DUAL
WHERE TO_DATE (:p0_base_date, 'MM/DD/YYYY') = TRUNC (SYSDATE)
OR :p0_base_date IS NULL)Denes Kubicek
http://deneskubicek.blogspot.com/
http://www.opal-consulting.de/training
http://htmldb.oracle.com/pls/otn/f?p=31517:1
------------------------------------------------------------------- -
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 -
LOV query is invalid, a display and a return value are needed, the column n
Hello,
I used to have no trouble at all creating dynamic LOV but from today I' am alway getting the error mentioned above.
This is the LOV query
select nm,zon_id from scr_zones_mv@d29ut
I tried to created a view of the referenced table, I'm able to select from this view in query builder but it gives the same error.
What is going wrong?
ErwinSorry guys,
I already found the problem.
thanks
Erwin -
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 vonNiedaYa 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 AMnope 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 -
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:
ArifCheck 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 -
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 -
"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.
RodneyRodney,
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 -
What is wrong with this dynamic LOV query?
I am trying to create a dynamic LOV which contains calendar week numbers, given a bind var containing the year. If the year given is this year I want the LOV to contain all weeks up to but not including this week, if the year given is in the past I want the LOV to contain all weeks in that year.
Here is my query;
select display_value, week_num from
(select decode(
:P31_YEAR,
to_char(sysdate, 'YYYY'), to_number(to_char(sysdate, 'IW')),
1+to_number(to_char(to_date('31/12/' || :P31_YEAR, 'DD/MM/YYYY'), 'IW'))
) max_weeks,
level week_num,
'Week ' || level display_value
from dual
connect by level < 54
) where week_num < max_weeks
When I try to create the dynamic LOV Apex tells me the query is invalid. It runs in TOAD and as far as I can see follows the LOV query rules.Try this:
select display_value d, week_num r from
(select decode(
nvl(:P13_YEAR,'2007'),
to_char(sysdate, 'YYYY'), to_number(to_char(sysdate, 'IW')),
1+to_number(to_char(to_date('31/12/' || nvl(:P13_YEAR,'2007'), 'DD/MM/YYYY'), 'IW'))
) max_weeks,
level week_num,
'Week ' || level display_value
from dual
connect by level < 54
) where week_num < max_weeks
Scott -
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.comHi 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
Maybe you are looking for
-
Attaching USB drive with iTunes library to TC
Ok, so I've gotten Time Capsule working properly and I'm ready to move my USB drive, which contains my iTunes library, to TC. I tried it this morning, mounted the drive from my MacBook Pro, changed my library location in iTunes preferences, and iTune
-
Random thick lines and loss of sensativity
Hello. I've been having a problem with random sensativity in lines. On my other computer, which is several years older then the one I'm working on now, working on PS with a tablet that was Bamboo, I would draw and quite often, every other stroke or s
-
good morning everyone. Gmail is acting up again. Lately mail will check my gmail account only once, after quitting and re-launching the program. After that it just sits there. I've had a few problems like this in the past. I expect Google is behind t
-
Continous HTTP access error logged when using Weblogic Cluster
I am not sure if this is the right forum for this discussion, but here we go anyways. We have created a Weblogic Cluster with one Administration Server and up to 12 Managed Servers. Our Weblogic version is 9.2. SSL has been enabled for all Servers an
-
Blinking display on output list of ALV Reports
Hi As per the requirement i got i need to put the blinking display in the output ALV Llist, for example if there is Nil Quantity in the stock it should blink like buzzer light. Kindly give me reply as soon as possible.