PLS-00402: alias required in SELECT list of cursor to avoid duplicate colum
Hello
I need a little help with my PLSQL syntax.
While the SQL in the select statement run well in a report when I change it to PLSQL 'FOR' statement it needs aliias(es).
To that end, I not sure where and how many?
Any help is very welcome
Regards
Pete
Declare
SUPPLIER_CONTACT_REC SUPPLIER_CONTACT%ROWTYPE;
count1 number:=0;
Begin
For SUPPLIER_CONTACT_REC in (select *
from
supplier_contact,
supplier,
city,
province
where
supplier.supplier_key = supplier_contact.supplier_key
and
supplier_contact.EMPLOYEE_EMAIL_ADDRESS is not null
and
city.province_key = province.province_key
and
supplier.city_key = city.city_key
and
rownum <= :P263_ROWNUM
and supplier.country_key > NVL2(:P263_COUNTRY, :P263_COUNTRY - 1, 0 )
and supplier.country_key < NVL2(:P263_COUNTRY, :P263_COUNTRY + 1, 99999999999 )
and city.province_key > NVL2(:P263_PROVINCE, :P263_PROVINCE - 1, 0)
and city.province_key < NVL2(:P263_PROVINCE, :P263_PROVINCE + 1, 99999999999 )
and supplier.city_key > NVL2(:P263_CITY, :P263_CITY - 1, 0 )
and supplier.city_key < NVL2(:P263_CITY, :P263_CITY + 1, 99999999999 )
and supplier.source_key > NVL2(:P263_SOURCE, :P263_SOURCE - 1, 0 )
and supplier.source_key < NVL2(:P263_SOURCE, :P263_SOURCE + 1, 99999999999 )
and supplier.record_status_key > NVL2(:P263_RECORD_STATUS, :P263_RECORD_STATUS -1, 0 )
and supplier.record_status_key < NVL2(:P263_RECORD_STATUS, :P263_RECORD_STATUS + 1, 99999 ))
Loop
count1:= count1 + 1; --- there any more actions in here but trying to keep it simple to start with
end loop;
:P263_count:= count1;
end;
--------------------------------------------------------
Your "select *" is the problem as it is trying to get columns from all four tables and some of the column names are the same - at least that's what it look like to me :)
Steve
Similar Messages
-
Alias required in SELECT list of cursors to avoid duplicate column names
I got some error messages while compiling the following.
DECLARE
alert_id NUMBER;
CURSOR cur_search IS SELECT c.item_description,
d.name modelname,
SUM(b.quentaty),
SUM(b.balence)
FROM item_procurement_history_dtl a,
item_procurement_history b,
item_master c,
model_master d
WHERE a.item_code = b.item_code
AND a.lot_no = b.lot_no
AND a.item_code = c.item_code
AND b.modelcode = d.modelcode
AND (c.item_description LIKE '%'||:blk_stock_search_fields.item_name||'%' OR :blk_stock_search_fields.item_name IS NULL)
AND (d.name LIKE '%'||:blk_stock_search_fields.modelname||'%' OR :blk_stock_search_fields.modelname IS NULL)
AND (a.status = :blk_stock_search_fields.status OR :blk_stock_search_fields.status IS NULL)
GROUP BY c.item_description, d.name
ORDER BY c.item_description, d.name;
BEGIN
GO_BLOCK('blk_stock_search_fields');
CLEAR_BLOCK(NO_VALIDATE);
FOR i IN cur_search LOOP
:blk_stock_search_data.item_name := i.item_description;
:blk_stock_search_data.modelname := i.modelname;
:blk_stock_search_data.tot_qty := i.tot_qty;
:blk_stock_search_data.available_qty := i.available_qty;
NEXT_RECORD;
END LOOP;
FIRST_RECORD;
GO_ITEM('blk_stock_search_fields.pb_search');
END;
The error is as follows :-
Error 403 at line 23 column 2
Alias required in SELECT list of cursors to avoid duplicate column names.
What will be the solution for this error?
Thanx and Regards,
VikasVikas,
The problem is that you are referencing a column name in your LOOP that does not exist in your CURSOR. Therefore, Oracle has interpreted this to its BEST guess Exception. This can be resolved as follows:
DECLARE
alert_id NUMBER;
CURSOR cur_search IS
SELECT c.item_description,
d.name modelname,
/* You need to ALIAS the product of the SUM() so you can reference it by name.*/
SUM(b.quentaty) AS tot_qty,
/* Same issue here, you must ALIAS the SUM() of Balance in order to reference it by a name.*/
SUM(b.balence) as available_qty
FROM item_procurement_history_dtl a,
item_procurement_history b,
item_master c,
model_master d
WHERE a.item_code = b.item_code
AND a.lot_no = b.lot_no
AND a.item_code = c.item_code
AND b.modelcode = d.modelcode
AND (c.item_description LIKE '%'||:blk_stock_search_fields.item_name||'%' OR :blk_stock_search_fields.item_name IS NULL)
AND (d.name LIKE '%'||:blk_stock_search_fields.modelname||'%' OR :blk_stock_search_fields.modelname IS NULL)
AND (a.status = :blk_stock_search_fields.status OR :blk_stock_search_fields.status IS NULL)
GROUP BY c.item_description, d.name
ORDER BY c.item_description, d.name;
BEGIN
GO_BLOCK('blk_stock_search_fields');
CLEAR_BLOCK(NO_VALIDATE);
FOR i IN cur_search LOOP
:blk_stock_search_data.item_name := i.item_description;
:blk_stock_search_data.modelname := i.modelname;
:blk_stock_search_data.tot_qty := i.tot_qty;
:blk_stock_search_data.available_qty := i.available_qty;
NEXT_RECORD;
END LOOP;
FIRST_RECORD;
GO_ITEM('blk_stock_search_fields.pb_search');
END;Just an observation. Also, There are some misspellings in your cursor. Does this match your table?
Hope this helps.
Craig... -
'alias required in SELECT..' - Why can't I see this?
Please help I'm going mad here!
The error message is:
ERROR at line 1:
ORA-06550: line 113, column 37:
PLS-00402: alias required in SELECT list of cursor to avoid duplicate column
names
ORA-06550: line 113, column 37:
PL/SQL: Item ignored
ORA-06550: line 137, column 13:
PLS-00320: the declaration of the type of this expression is incomplete or
malformed
ORA-06550: line 136, column 7:
PL/SQL: SQL Statement ignored
..Yet I disagree.. I cant see any 2 fields called the same.
(FYI the cursor it speaks of is called 'c_check_employee').
And the code.
/* Formatted on 2009/02/27 15:35 (Formatter Plus v4.8.7) */
SET serveroutput ON SIZE 1000000 FORMAT WRAPPED
SET verify OFF
SET feedback OFF
DECLARE
-- Debugging/error handling
-- Work variables
p_emp_number VARCHAR2 (14);
v_rec_cnt NUMBER := 0;
insert_flag VARCHAR2 (8);
l_validate BOOLEAN DEFAULT FALSE;
l_obj NUMBER;
l_datetrack_update_mode VARCHAR2 (30) := 'CORRECTION';
l_assignment_sequence NUMBER;
l_name_combination_warning BOOLEAN := FALSE;
l_assign_payroll_warning BOOLEAN := FALSE;
l_org_now_no_manager_warning BOOLEAN;
l_other_manager_warning BOOLEAN;
l_spp_delete_warning BOOLEAN;
l_entries_changed_warning VARCHAR2 (30);
l_tax_district_changed_warning BOOLEAN;
l_person_id NUMBER;
l_assignment_id NUMBER;
l_special_ceiling_step_id NUMBER;
l_per_effective_end_date DATE
:= TO_DATE ('11-Jul-2049', 'DD-MON-YYYY');
l_people_group_id NUMBER;
l_group_name VARCHAR2 (30);
l_assignment_number VARCHAR2 (35);
l_effective_end_date DATE
:= TO_DATE ('11-Jul-2049', 'DD-MON-YYYY');
l_date DATE := SYSDATE;
ip_p_address_id per_addresses.address_id%TYPE;
ip_p_object_version_number NUMBER;
ip_p_party_id per_addresses.party_id%TYPE;
l_per_object_version_number NUMBER;
l_asg_object_version_number NUMBER;
l_full_name VARCHAR2 (240);
l_per_comment_id NUMBER;
l_per_effective_start_date DATE;
l_concatenated_segments VARCHAR2 (12);
l_soft_coding_keyflex_id NUMBER;
l_comment_id NUMBER;
l_no_managers_warning BOOLEAN;
-- Get employee details info from work table
CURSOR get_employee_details
IS
SELECT std_validate, std_person_id, std_assignment_id, std_hire_date,
std_business_group_id, std_last_name, std_sex,
std_date_of_birth, std_email_address, std_employee_number,
std_first_name, std_marital_status, std_middle_names,
std_nationality, std_title, std_national_identifier,
std_address_line1, std_address_line2, std_address_line3,
std_address_line4, std_post_code, std_telephone_1,
std_position_id, std_job_id, std_location_id,
std_organization_id, std_supervisor_id,
std_default_code_comb_id, std_set_of_books_id, std_payroll_id,
std_grade_id, std_pay_basis_id, std_assn_ovn
FROM SU_TEMPLOYEE_DETAILS;
-- checks employee details info from PER_ALL_PEOPLE_F table
CURSOR c_check_employee (p_emp_number VARCHAR2)
IS
SELECT paas.assignment_id, per.person_id, per.business_group_id,
per.last_name, per.start_date, per.date_of_birth, per.email_address,
per.employee_number, per.first_name, per.marital_status, per.middle_names,
per.nationality, per.national_identifier, per.sex, per.title, padd.address_id,
padd.primary_flag,padd.address_line1, padd.address_line2, padd.address_line3,
padd.town_or_city, padd.postal_code, padd.telephone_number_1, padd.telephone_number_2,
padd.telephone_number_3,paas.job_id, paas.location_id,paas.organization_id, paas.assignment_type, paas.primary_flag, paas.supervisor_id,paas.default_code_comb_id,
paas.set_of_books_id,paas.assignment_number, paas.period_of_service_id,paas.object_version_number
FROM per_all_people_f per,
per_all_assignments_f paas,
per_addresses padd
WHERE per.employee_number = p_emp_number
AND per.person_id = padd.person_id
AND paas.person_id(+) = per.person_id;
emp_rec c_check_employee%ROWTYPE;
-- Cursor retrieves latest Object Version Number from per_assignments_f table..
CURSOR csr_ovn (cp_person_id IN per_all_people_f.person_id%TYPE)
IS
SELECT MAX (paas.object_version_number)
FROM per_assignments_f paas, per_all_people_f per
WHERE paas.person_id = per.person_id
AND per.employee_number = paas.assignment_number
AND per.person_id = cp_person_id;
BEGIN
-- Process each record in the work table
FOR v_emp IN get_employee_details
LOOP
-- determine whether customer already exists
OPEN c_check_employee (v_emp.std_employee_number);
FETCH c_check_employee
INTO emp_rec;
IF c_check_employee%NOTFOUND
THEN
insert_flag := 'I';
ELSE
insert_flag := 'X';
END IF;
CLOSE c_check_employee;
-- Obtain the most recent Object Version Number..
OPEN csr_ovn (v_emp.std_person_id);
FETCH csr_ovn
INTO l_obj;
-- IF csr_ovn%NOTFOUND THEN RAISE NO_DATA_FOUND; END IF;
CLOSE csr_ovn;
-- Create new PER_ALL_PEOPLE_F and PER_ADDRESSES record from
-- info in table record
IF insert_flag = 'I'
THEN
BEGIN -- Importing Employee Procedure --
-- DBMS_OUTPUT.PUT (CHR (10));
-- DBMS_OUTPUT.PUT_LINE ('Importing employees.... ');
BEGIN
Hr_Employee_Api.create_gb_employee
(p_validate => l_validate,
p_hire_date => v_emp.std_hire_date,
p_business_group_id => v_emp.std_business_group_id,
p_date_of_birth => v_emp.std_date_of_birth,
p_email_address => v_emp.std_email_address,
p_first_name => v_emp.std_first_name,
p_middle_names => v_emp.std_middle_names,
p_last_name => v_emp.std_last_name,
p_sex => v_emp.std_sex,
p_ni_number => v_emp.std_national_identifier,
p_employee_number => v_emp.std_employee_number,
p_person_id => l_person_id,
p_title => v_emp.std_title,
p_assignment_id => l_assignment_id,
p_per_object_version_number => l_per_object_version_number,
p_asg_object_version_number => l_asg_object_version_number,
p_per_effective_start_date => l_per_effective_start_date,
p_per_effective_end_date => l_per_effective_end_date,
p_full_name => l_full_name,
p_per_comment_id => l_per_comment_id,
p_assignment_sequence => l_assignment_sequence,
p_assignment_number => l_assignment_number,
p_name_combination_warning => l_name_combination_warning,
p_assign_payroll_warning => l_assign_payroll_warning
Hr_Person_Address_Api.create_person_address
(p_validate => l_validate,
p_effective_date => v_emp.std_hire_date,
p_pradd_ovlapval_override => NULL,
p_validate_county => NULL,
p_person_id => l_person_id,
p_primary_flag => 'Y',
p_style => 'GB_GLB',
-- p_date_from => v_emp.std_hire_date,
p_date_from => SYSDATE,
p_date_to => NULL,
p_address_line1 => v_emp.std_address_line1,
p_address_line2 => v_emp.std_address_line2,
p_address_line3 => v_emp.std_address_line3,
p_town_or_city => v_emp.std_address_line4,
p_postal_code => v_emp.std_post_code,
p_country => v_emp.std_nationality,
p_telephone_number_1 => v_emp.std_telephone_1,
p_party_id => ip_p_party_id,
p_address_id => ip_p_address_id,
p_object_version_number => l_obj
--ip_p_object_version_number
Hr_Assignment_Api.update_emp_asg_criteria
(p_validate => l_validate,
p_effective_date => l_date, -- SYSDATE
p_datetrack_update_mode => l_datetrack_update_mode,
p_assignment_id => l_assignment_id,
p_object_version_number => l_obj,
p_organization_id => v_emp.std_organization_id,
p_location_id => v_emp.std_location_id,
p_job_id => v_emp.std_job_id,
p_position_id => v_emp.std_position_id,
p_special_ceiling_step_id => l_special_ceiling_step_id,
p_effective_start_date => l_date,
p_effective_end_date => l_effective_end_date, --IN/OUT
p_people_group_id => l_people_group_id, --IN/OUT
p_group_name => l_group_name, --IN/OUT
p_org_now_no_manager_warning => l_org_now_no_manager_warning, --IN/OUT
p_other_manager_warning => l_other_manager_warning, --IN/OUT
p_spp_delete_warning => l_spp_delete_warning, --IN/OUT
p_entries_changed_warning => l_entries_changed_warning, --IN/OUT
p_tax_district_changed_warning => l_tax_district_changed_warning --IN/OUT
Hr_Assignment_Api.update_emp_asg
(p_validate => l_validate, -- in
p_effective_date => l_date,
p_datetrack_update_mode => 'CORRECTION',
p_assignment_id => l_assignment_id,
p_object_version_number => l_obj,
p_supervisor_id => v_emp.std_supervisor_id,
p_default_code_comb_id => v_emp.std_default_code_comb_id,
p_set_of_books_id => v_emp.std_set_of_books_id,
p_concatenated_segments => l_concatenated_segments, -- out
p_soft_coding_keyflex_id => l_soft_coding_keyflex_id, -- out
p_comment_id => l_comment_id, -- out
p_effective_start_date => l_date, -- out
p_effective_end_date => l_effective_end_date,
p_no_managers_warning => l_no_managers_warning,
p_other_manager_warning => l_other_manager_warning
-- DBMS_OUTPUT.PUT_LINE ('Employee No:'|| v_emp.std_employee_number|| ' imported successfully..' );
EXCEPTION
WHEN OTHERS
THEN
RAISE NO_DATA_FOUND;
-- DBMS_OUTPUT.PUT (CHR (10));
DBMS_OUTPUT.PUT_LINE ( 'Ah, Employee:'
|| v_emp.std_employee_number
|| ' failed to load.. '
|| SQLERRM
-- DBMS_OUTPUT.PUT (CHR (10));
END;
END;
-- DBMS_OUTPUT.PUT (CHR (10));
v_rec_cnt := v_rec_cnt + 1;
-- DBMS_OUTPUT.PUT_LINE ( 'There were '|| v_rec_cnt|| ' records read in..');
-- End of customer related details
END IF;
END LOOP;
COMMIT;
END;
EXIT;
many thanks..Check primary_flag .... ;)
Regards.
Satyaki De.
Alex is Winner.... ;)
Edited by: Satyaki_De on Mar 2, 2009 5:33 PM -
Cascading Select List Doesn't work properly
I am trying to use Cascading Select List in My Application. It works for the first time when I run the page afterwards when I try to open the same page in a different window it doesn't work afterwards it doesn't work at all.My code is as follows.
1) Application Process with name getDet
DECLARE
lv_os_List varchar2(32000) := '';
platform varchar2(50);
err_code number;
err_msg varchar2(200);
BEGIN
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>');
HTP.prn ('<option value="' || 1 || '">' || '- All OS -' || '</option>');
select platform into platform from platform where platformid =:P139_PLATFORM;
if platform = 'Sun SPARC' then
for i in (select os , osid from ostype where os like '%Sola%' order by os) loop
htp.prn('<option value="' || i.osid || '">' || i.os || '</option>');
end loop;
ELSIF (platform ='Linux (x86 & x86-64)') then
for i in (select os ,osid from ostype where os like '%Linux%' or os like '%RH%' or os like '%SLES%' or os like '%OEL%' order by os) loop
htp.prn('<option value="' || i.osid || '">' || i.os || '</option>');
end loop;
ELSIF (platform ='TRU64') then
for i in (select os ,osid from ostype where os like '%Tru64%' order by os) loop
htp.prn('<option value="' || i.osid || '">' || i.os || '</option>');
end loop;
ELSIF (platform ='Windows') then
for i in (select os ,osid from ostype where os like '%Windows%' order by os) loop
htp.prn('<option value="' || i.osid || '">' || i.os || '</option>');
end loop;
ELSIF (platform ='IBM Linux on Power') then
for i in (select os ,osid from ostype where os like '%Linux%' or os like '%RH%' or os like '%SLES%' or os like '%OEL%' order by os) loop
htp.prn('<option value="' || i.osid || '">' || i.os || '</option>');
end loop;
ELSIF (platform ='IBM System z') then
for i in (select os ,osid from ostype where os like '%Linux%' or os like '%RH%' or os like '%SLES%' or os like '%OEL%' order by os) loop
htp.prn('<option value="' || i.osid || '">' || i.os || '</option>');
end loop;
ELSIF (platform like 'HP%') then
for i in (select os ,osid from ostype where os like '%HP%' order by os) loop
htp.prn('<option value="' || i.osid || '">' || i.os || '</option>');
end loop;
ELSIF (platform ='Itanium') then
for i in (select os ,osid from ostype where os like '%HP%' or (os like '%Windows%' and osid <> 201) or os like '%Linux%64%' or os like '%RH%64%'
order by os) loop
htp.prn('<option value="' || i.osid || '">' || i.os || '</option>');
end loop;
ELSIF (platform ='AIX') then
for i in (select os ,osid from ostype where os like '%AIX%' order by os) loop
htp.prn('<option value="' || i.osid || '">' || i.os || '</option>');
end loop;
ELSE
for i in (select os ,osid from ostype order by os) loop
htp.prn('<option value="' || i.osid || '">' || i.os || '</option>');
end loop;
END IF;
htp.prn('</select>');
EXCEPTION
WHEN OTHERS THEN
err_code := SQLCODE;
err_msg := substr(SQLERRM, 1, 200);
INSERT INTO ERROR_TABLE (error_number, error_message)
VALUES (err_code, err_msg);
END;
2) Application Item
CASCADING_SELECTLIST_ITEM_1
3) In the Footer of the region which contains the items the following Java Script
<script>
function get_select_list_xml(pThis,pSelect){
var l_Return = null;
var l_Select = html_GetElement(pSelect);
var get = new htmldb_Get(null,html_GetElement('pFlowId').value,
'APPLICATION_PROCESS=getDet',0);
get.add('CASCADING_SELECTLIST_ITEM_1',pThis.value);
gReturn = get.get('XML');
if(gReturn && l_Select){
var l_Count = gReturn.getElementsByTagName("option").length;
l_Select.length = 0;
for(var i=0;i<l_Count;i++){
var l_Opt_Xml = gReturn.getElementsByTagName("option");
appendToSelect(l_Select, l_Opt_Xml.getAttribute('value'),
l_Opt_Xml.firstChild.nodeValue)
get = null;
function appendToSelect(pSelect, pValue, pContent) {
var l_Opt = document.createElement("option");
l_Opt.value = pValue;
if(document.all){
pSelect.options.add(l_Opt);
l_Opt.innerText = pContent;
}else{
l_Opt.appendChild(document.createTextNode(pContent));
pSelect.appendChild(l_Opt);
</script>
<script>
get_select_list_xml($x('P139_PLATFORM'),'P139_OS');
</script>
For the first Select list form element properties
onchange="get_select_list_xml(this,'P139_OS')"
Please let me know what change I need to make in the code.Vikas,
Is your page 0 a public page or it requires authentication? I remember having the same
problem a while ago.
Denes Kubicek
http://deneskubicek.blogspot.com/
http://www.opal-consulting.de/apex/f?p=107:7
http://htmldb.oracle.com/pls/otn/f?p=31517:1
------------------------------------------------------------------- -
Dynamic Actions in Select List of Tabular Form
I have a tabular form in my application and one of the column A is Select List with lot of values. My requirement is, there is another column B in the same tabular column like Display text, which should appear when a user select A, B or C in the select list column A. Is it possible, how can I implement it?
I tried it through Dynamic Actions ->DOM Objects, but I am not sure what is the name of the Select List column value that needs to be specified, it is jst f06 or f06_???. Can someone tell me the exact steps that needs to be followed.My mistake, Javascript (and DOM attributes/methods) are case-sensitive. The attribute in question is readOnly, not readonly
I fixed it on my example page at http://htmldb.oracle.com/pls/otn/f?p=24317:255
<script type="text/javascript">
function ro_Item(nd,a){
var lEl = html_GetElement(nd);
if (lEl && lEl != false){
if(a){
lEl.readOnly = true;
lEl.style.background = '#cccccc';
}else{
lEl.readOnly = false;
lEl.style.background = '#ffffff';
return true;
function foo(pThis)
var lTD=pThis.parentNode;
var nextinput=lTD.nextSibling.getElementsByTagName('input')[0];
var nextnextinput=lTD.nextSibling.nextSibling.getElementsByTagName('input')[0];
if (pThis.value=="CLERK") {
ro_Item(nextinput,true);
ro_Item(nextnextinput,true);
else {
ro_Item(nextinput,false);
ro_Item(nextnextinput,false);
</script> -
Select Lists - Setting and Referencing (Using) the Select List variable
I have (a login page and) 3 application pages (call them Day, Week, Month), each with similar selection lists and a chart. I have three requirements.
1) When a new selection is made, the value of the selection list variable is updated --that is, it does what select lists do.
2) I need to set the value of the Month selection list variable before the Month page is rendered for the first time -- I need to give it an initial value.
3) When navigating from page to page, say from Month to Week or Day back to Month, I need to have the value of the selection list variable carried to the new page from the value on the previous page.
It sounds simple to me -- something that one could do with an (global) application item. The logic would be like
IF :Page_Name_Flag = 'Week' THEN -- staying on the Week page
SELECT :WK_SelectList_Name INTO :GLOBAL_SelectList_Name FROM DUAL
ELSE -- new pass on this page
SELECT :GLOBAL_SelectList_Name INTO :WK_SelectList_Name FROM DUAL
SELECT 'Week' INTO :Page_Name_Flag
END IF;But that doesn't work for me. The page's select list variable seems to be NULL sometimes causing the value of :GLOBAL_SelectList_Name to be set to null. Other times, the copy from the global variable to page select list varable doesn't seem to change the page select list variable.
At http://apex.oracle.com/pls/apex/f?p=43250:101 (guest/Ima9Gue8t) is an example where I have each page's select list working (except on the initial visit to the page, where the select variable is null!!!). How can I get the select list value on the new page to sync with the value from the previous page?
Thanks,
Howard
Edited by: Howard (DBA in Training) on Sep 18, 2012 11:53 AMI'm closing this because I got it to work. In the end, it worked as I had described above. There was some setting of the Select List variable, that I now have correct, that was incorrect before. I wonder what it was?
-
How to get a parameter from a HTML select list in a servlet
Hi!
I have the following problem :
In a HTML form I have the following select list:
<select name="tickets">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
</select>And in the servlet I try to read the value I have selected doing : String tickB = (String) request.getParameter("tickets");But for my amazement tickB always has the value 1, althought I have selected in the list the value 2,3,4,5 or 6
�Where is the error ? �Have I to do with getParamaterValues instead getParameter to obtain the correct value?
Bye
Edited by: bladu on Jun 4, 2008 1:25 AMWhere is the error ? No error in portion of code you have shown.
But for my amazement tickB always has the value 1, althought I have selected in the list the value 2,3,4,5 or 6Are you sure there are no other form element(hidden field, text field) with same name tickets ? If you are using GET method, you may check the url to see if there are more than one parameters named tickets set in it
Have I to do with getParamaterValues instead getParameter to obtain the correct value? Not required. -
Refresh PL/SQL Report Region (not Page) using Select List value
Hi,
I've got a report region based on a 'PL/SQL function body returning a SQL query'which gets generated on selecting a value from a Select list item, The Select List action is 'Redirect and Set value' but this causes the whole page to refresh rather than just the report region. I've tried to refresh the report only using a dynamic action on the Select List item (Action now reset to 'None') but now the report is not appearing on choosing from the List. Can anyone suggest a solution that will allow me to refresh this report without refreshing the page? I am using APEX 4.2.2 and the report syntax is as follows:
DECLARE
v_statement VARCHAR2(500);
BEGIN
SELECT query_text
INTO v_statement
FROM sql_queries
WHERE query_id = :P2_QUERY ;
RETURN v_statement ;
END ;
where P2_QUERY is Select List Item,
regards,
Kevin.KevinFitz wrote:
The report region being displayed is conditional on P2_QUERY item being NOT NULL. I assume the region not appearing is because the Action for the Select List Item is set to None and so P2_QUERY is always NULL.
No, the region is not appearing because it is conditional on P2_QUERY being NOT NULL. This means that the report region never exists on the page shown in the browser, so it can't be dynamically refreshed. (Dynamic refresh doesn't evaluate region conditions, and it only re-renders the report content, not the entire region.)
Remove the condition on the report region, check the refresh is working, then reconsider exactly what the requirements here are. If you want the region to appear only when P2_QUERY has a value, and you want it to be refreshed without submitting and re-rendering the page, then the region needs to be hidden rather than conditionally rendered, and shown via a dynamic action when P2_QUERY gets a value.
I tried adding an additional Set Value True Action for the DA event but got an error as listed above,
All irrelevant if Page Items to Submit on the region is used properly. -
Help with Select Lists in Classic Report
Hello,
I working with APEX 4.1. Oracle 11.
I have a simple classic report with 4 columns (Username, Role, Read, Update). The Read and Update columns are Select Lists with values of "Yes", "No".
Report looks like this:
Username Role Read Update
JSmith Admin Yes Yes
LJones Dev Yes No
My requirement, is that when a user selects Yes from the Update select list, the value of the associated Read column needs to change to Yes as well for that particular Username. The change has to occur upon selection of Yes from the Update select list.
Im not very strong with javascript, but for testing purposes I applied: onchange="alert('hi');" on the Update column. When I make a change to the Update select list, the alert does pop up.
Can anyone suggest how I can implement the change to the associated Read value of Yes if the Update value chosen is Yes, for that particular row.
Thank you,
LauraLauraK wrote:
I working with APEX 4.1. Oracle 11.
I have a simple classic report with 4 columns (Username, Role, Read, Update). The Read and Update columns are Select Lists with values of "Yes", "No".
Report looks like this:
Username Role Read Update
JSmith Admin Yes Yes
LJones Dev Yes No
My requirement, is that when a user selects Yes from the Update select list, the value of the associated Read column needs to change to Yes as well for that particular Username. The change has to occur upon selection of Yes from the Update select list.
Im not very strong with javascript, but for testing purposes I applied: onchange="alert('hi');" on the Update column. When I make a change to the Update select list, the alert does pop up.
Can anyone suggest how I can implement the change to the associated Read value of Yes if the Update value chosen is Yes, for that particular row.Should be possible to do this using a Dynamic Action without writing any (or much) JavaScript. The complexity in this case is that you're using items in a report rather than standard page items. -
Report with select list and link to call another report
Hi,
I am trying to do 2 reports (REPORT1 and REPORT2).
The first is a summary report (REPORT1).
This report will display sales figures for the year. Now, I need to have a select list in the result set that will have 2 options, depending on which option is chosen, I want to call REPORT2 with the select list as a parameter. How can I do this ?
Let me try to explain what I did.
I created REPORT1 on Page 100
SELECT YEAR, sum(YTD_SALES), APEX_ITEM.SELECT_LIST(1,'DEPARTMENT','Department;DEPARTMENT,Division;DIVISION') Drilldown FROM SALES_ANALYSIS WHERE YEAR > 2000
GROUP BY YEAR ORDER BY YEAR
I created 2 hidden items namely P100_YEAR and P100_DRILLDOWN
I also made the column YEAR as a link and specified both P100_YEAR and P100_DRILLDOWN as parameters to be passed.
Next, I created REPORT2
SELECT YEAR, DECODE(:P100_DRILLDOWN, 'Department', department, 'Division', Division) dept_div, sum(YTD_SALES) ytd_sales
FROM SALES_ANALYSIS
WHERE YEAR = :P100_YEAR
When I run Report 1, it's fine, when I choose either Department or Division from the Select List and click on the link to call Report 2, report 2 is displayed, but the value being passed for P100_DRILLDOWN is not correct and as a result, I am unable to get correct results for Report 2
Am I missing something ? Are there any alternate ways to do what I'm doing ?
Thanks,
AshokHi Ashok,
The link definition will not know the value selected in the list as it is constructed only when the page is being rendered. You would need to create some javascript to handle this. I've done that here: [http://apex.oracle.com/pls/otn/f?p=267:182]
The link on the EMPNO column has been defined in the HTML Expression setting for the column instead of the Link section. The HTML Expression that I have used is:
<a href="#" onclick="javascript:doDrilldown('#EMPNO#',this);">#EMPNO#</a>And, in the page's HTML Header setting, I have added in:
<script type="text/javascript">
function doDrilldown(empno,group)
var g;
var p = group.parentNode;
while (p.tagName != "TR")
p = p.parentNode;
var x = p.getElementsByTagName("SELECT");
if (x.length > 0)
g = x[0].value;
var url = "f?p=&APP_ID.:183:&SESSION.::::P183_EMPNO,P183_GROUP:" + empno + "," + g;
document.location.href = url;
</script>When a link is clicked, the doDrilldown function is called passing in the EMPNO value and the "this" object (which identifies the object triggering the call). The function starts from that object and goes up in the HTML tag tree to the nearest TR tag (the row tag that the link is on) and then finds the first SELECT list item on the row and gets its value. It then constructs a URL using this and the EMPNO value and performs a redirect to the second page (page 183 in this example).
Andy -
How to create a report based on selected item from Select list?
Hi,
I have created a tables_LOV based on:
select table_name d, table_name r from user_tab_cols
where column_name like '%_type%'
Then I created a page item ListOfTables, Display as select list and pointing to tables_LOV.
I run the page, and i can select the table i want from the drop down list.
How to create a report based on the selected item? (ex: select * from selected_table)
many thanks in advance
SalahHi Salah,
Allright, have a look at this page: http://apex.oracle.com/pls/apex/f?p=vincentdeelen:collection_report
I think that simulates what you're trying to accomplish. I've set up the simplest method I could think of.
The report is based on an apex collection. If you are not familiar with that, you should study the documentation: APEX_COLLECTION
To recreate my example you should:
1) create an (interactive) report on your collection
SELECT *
FROM APEX_collections
WHERE collection_name = 'MY_COLLECTION'
2) create a page_item select list for the tables you want to display (in my case this is called "P38_TABLES" )
3) create a dynamic action that triggers on change of your select list page_item. The dynamic action must be a PL/SQL procedure perfoming the following code:
declare
l_query varchar2(4000);
begin
l_query := 'select * from '||:P38_TABLES;
if apex_collection.collection_exists
( p_collection_name => 'MY_COLLECTION' )
then
apex_collection.delete_collection
( p_collection_name => 'MY_COLLECTION' );
end if;
apex_collection.create_collection_from_query
( p_collection_name => 'MY_COLLECTION'
, p_query => l_query
end;
Make sure you add your page_item to the "Page Items to Submit" section.
4) Add an extra true action that does a refresh of the report region.
Here are two pictures describing the da:
http://www.vincentdeelen.com/images/otn/OTN_COLLECTION_REPORT_DA1.png
http://www.vincentdeelen.com/images/otn/OTN_COLLECTION_REPORT_DA2.png
Good luck and regards,
Vincent
http://vincentdeelen.blogspot.com -
Hi, I'm using SP13 and InfoPath2013.
I created a custom form and published it to SP13 document library. This form has many MSLB. Depending on the checkboxes selected in the 1st MSLB, the other MSLB will either hide or show. Each MSLB is in its own section. The requirement
is to have each MSLB to have at least one checkbox selected. Well, the problem is that when that MSLB isnot checked in the 1st MSLB it is not visible and shouldn't require any checkbox to be selected. However, the form can't get submitted instead
an error dialog would pop up and ask user to make a selection for MSLB that is not even displayed. Is there any way to fix this besides unchecking all MSLB to be not required at least one selection? Thank you.Eric,
I follow your reply post here and still doesn't work. I also noticed your screen shot of selecting a field is not the same as what I see in InfoPath 2013.
Here is what I did,
1.Check At least one selection required for
these Multiple-selection List Boxes
as you want .
2.Create a Formatting rule for the 2nd
Multiple-selection List Box.
3.Add a Condition as below:
4. I get a validation error if I don't
select at least one checkbox in the hidden MSLB control when submitting.
I think I'm following all the steps correctly
but please let me know if I'm not. -
Bug while saving multi select list
Hi,
My requirement is to construct a region where user can select their answer from available option. answer field can be multiple select/single select or text area.
I have written below query to achieve different type of answer field.
/**query****/
DECLARE
v_sql VARCHAR2 (32767);
v_answer VARCHAR2 (32767);
v_main_sql VARCHAR2 (32767);
BEGIN
FOR cur IN (SELECT question_id, question, answer_type, available_answer FROM question WHERE status= 'ACTV')
LOOP
v_sql := 'SELECT ';
v_sql := v_sql || ' APEX_ITEM.hidden(4,question_id)||question question, '; /*do not show question id as per requirement*/
IF cur.answer_type = 'MS' -- Multi Select List
THEN
v_answer := cur.available_answer;
v_sql :=
v_sql
|| ' APEX_ITEM.SELECT_LIST_FROM_QUERY(3,null,''SELECT * from table(
AU_F_LOV_FN('''''
|| v_answer
|| '''''))'',''class="multiselect" multiple="multiple"'',''NO'') Answer ';
ELSIF cur.answer_type = 'SS'
THEN -- Single Select List
v_answer := cur.available_answer;
v_sql :=
v_sql
|| ' APEX_ITEM.SELECT_LIST_FROM_QUERY(3,null,''SELECT * from table(
AU_F_LOV_FN('''''
|| v_answer
|| '''''))'') Answer ';
ELSE -- Free text
v_sql := v_sql || ' apex_item.textarea(3,available_answer,2,20) Answer ';
END IF;
v_sql := v_sql || ' from question ';
v_sql := v_sql || ' where question_id=' || cur.question_id;
IF v_main_sql IS NULL THEN
v_main_sql := v_sql;
ELSE
v_main_sql := v_main_sql ||' UNION ' || v_sql;
END IF;
END LOOP;
RETURN v_main_sql;
END;
/***end of query***/
If I select two options from multiple select list it is saving two records into table instead of saving one record with colon delimeter.
/**query to save**/
FOR i IN 1 .. APEX_APPLICATION.G_F03.COUNT
LOOP
IF APEX_APPLICATION.G_F03(i) IS NOT NULL THEN
UPDATE question_answer
SET answer = v_answer
WHERE question_id = APEX_APPLICATION.G_F04(i)
and call_id=p_sourceid;
IF sql%rowcount =0 then
INSERT INTO question_answer (question_id,
answer,
call_id,
status,
customer_id)
VALUES (APEX_APPLICATION.G_F04(i),
nvl(v_answer,APEX_APPLICATION.G_F03(i)),
p_sourceid,
'ACTV',
p_customer_id);
END if;
END IF;
END LOOP;
/**End**/
Can anyone please help me? Why is it happening? How to tweak my query so that it saves one record with colon delimeter.Technically, my understanding is that a Shuttle is just two multiselect lists where javascript moves the items from one to the other. Technically its the same thing, just different presentation and methods for selection. When you go to process, its seen the same way as you initially had your code setup so no code changes would have been necessary. As it's a built in item type and with APEX's backwards compatibility policies, if your code works now it should continue to work.
-
Hi!
I have a problem with List View Report in mobile application (theme 50 in apex) after updating to apex 4.2.2. I created Report -> List View. I used select from pipelined function in Region Source. Then when page is running and submited three times (or refreshed three times) I get an error:
Error during rendering of region "LIST VIEW".
ORA-01007: variable not in select list
Technical Info (only visible for developers)
is_internal_error: true
apex_error_code: APEX.REGION.UNHANDLED_ERROR
ora_sqlcode: -1007
ora_sqlerrm: ORA-01007: variable not in select list
component.type: APEX_APPLICATION_PAGE_REGIONS
component.id: 21230833903737364557
component.name: LIST VIEW
error_backtrace:
ORA-06512: at "APEX_040200.WWV_FLOW_DISP_PAGE_PLUGS", line 4613
ORA-06512: at "APEX_040200.WWV_FLOW_DISP_PAGE_PLUGS", line 3220
I get this error only when I use select from pipelined function in Region Source (for example: "select value1, value2 from table(some_pipelined_function(param1, param2)) ").
You can check it on http://apex.oracle.com/pls/apex/f?p=50591 (login - demo, password - demo).
In this application:
- I created package TAB_TYPES_PKG:
create or replace PACKAGE TAB_TYPES_PKG IS
TYPE cur_rest_r IS RECORD (
STR_NAME VARCHAR2(128),
INFO VARCHAR2(128)
TYPE cur_rest_t IS TABLE OF cur_rest_r;
END TAB_TYPES_PKG;
- I created pipelined function TEST_FUNC:
create or replace
FUNCTION TEST_FUNC
RETURN TAB_TYPES_PKG.cur_rest_t PIPELINED IS
r_cur_rest TAB_TYPES_PKG.cur_rest_r;
BEGIN
r_cur_rest.STR_NAME := 'ROW 1';
r_cur_rest.INFO := '10';
PIPE ROW (r_cur_rest);
r_cur_rest.STR_NAME := 'ROW 2';
r_cur_rest.INFO := '20';
PIPE ROW (r_cur_rest);
r_cur_rest.STR_NAME := 'ROW 3';
r_cur_rest.INFO := '30';
PIPE ROW (r_cur_rest);
r_cur_rest.STR_NAME := 'ROW 4';
r_cur_rest.INFO := '40';
PIPE ROW (r_cur_rest);
r_cur_rest.STR_NAME := 'ROW 5';
r_cur_rest.INFO := '50';
PIPE ROW (r_cur_rest);
RETURN;
END TEST_FUNC;
- I created List View Report on Page 1:
Region Source:
SELECT str_name,
info
FROM TABLE (TEST_FUNC)
We can see error ORA-01007 after refresing (or submiting) Page 1 three times or more.
How to fix it?Hi all
I'm experiencing the same issue. Predictably on every third refresh I receive:
Error
Error during rendering of region "Results".
ORA-01007: variable not in select list
Technical Info (only visible for developers)
is_internal_error: true
apex_error_code: APEX.REGION.UNHANDLED_ERROR
ora_sqlcode: -1007
ora_sqlerrm: ORA-01007: variable not in select list
component.type: APEX_APPLICATION_PAGE_REGIONS
component.id: 6910805644140264
component.name: Results
error_backtrace: ORA-06512: at "APEX_040200.WWV_FLOW_DISP_PAGE_PLUGS", line 4613 ORA-06512: at "APEX_040200.WWV_FLOW_DISP_PAGE_PLUGS", line 3220
OK
I am running Application Express 4.2.2.00.11 on GlassFish 4 using Apex Listener 2.0.3.221.10.13.
Please note: this works perfectly using a classic report in my desktop application; however, no joy on the mobile side with a list view. I will use a classic report in the interim.
My region source is as follows:
SELECT description AS "DESCRIPTION", reference AS "REFERENCE" FROM TABLE(AUTOCOMPLETE_LIST_VIEW_FNC('RESULTS'))
The procedure:
FUNCTION AUTOCOMPLETE_LIST_VIEW_FNC(
p_collection_name IN VARCHAR2)
RETURN list_row_table_type
AS
v_tab list_row_table_type := list_row_table_type();
BEGIN
DECLARE
jsonarray json_list;
jsonobj json;
json_clob CLOB;
BEGIN
SELECT clob001
INTO json_clob
FROM apex_collections
WHERE collection_name = p_collection_name;
jsonobj := json(json_clob);
jsonarray := json_ext.get_json_list(jsonobj, 'predictions');
FOR i IN 1..jsonArray.count
LOOP
jsonobj := json(jsonArray.get(i));
v_tab.extend;
v_tab(v_tab.LAST) := list_row_type(json_ext.get_string(jsonobj, 'description'), json_ext.get_string(jsonobj, 'reference'));
END LOOP;
RETURN(v_tab);
END;
END AUTOCOMPLETE_LIST_VIEW_FNC;
Thanks!
Tim -
Token from report showing up in Select List
I'm working on an app that has a drill down report. One of the columns in the report is a link (Target Type = URL) to a form that allows the user to the row that he/she clicked on in the report.
The values of parms passed to the page "511" are passed via the report tokens.
Two of the tokens for some reason aren't resolved when they get to the page (511).
The tokens #MEDIA_UID# and #LOCATION_UID# appear in the respective select lists (Media has a select list and location has a select list).
For example. When the use clicks on the link the resulting page's Media select
list will look something like this:
#MEDIA_UID#
DOC
CD
DVD
The #MEDIA_UID# Token will be included in the list of values instead of
the actual value from the row in the report.
The Target Type for the link is URL.
The URL is set to:
f?p=&APP_ID.:511:&SESSION.::&DEBUG.:511:P511_MEDIA_UID,P511_LOCATION_UID,P511_REMARKS,P511_DIST,P511_DOC_MASTER_UID,P511_NUM_TO_COPY:#MEDIA_UID#,#LOCATION_UID#,\#REMARKS#\,\#DIST#\,&P510_DOC_MASTER_UID.,#COPY_NBR#
Does the URL look OK?
Has anyone noticed this type of behavior?
Thanks.
DavidBingo. You're right. I just found that out a few minutes ago. I inherited this piece of the app from someone else. I was comparing the URLs (dev to prod). Didn't think to look at the actual column alias until after I had posted this. Someone changed
the column alias in prod but didn't make that change in the Link's target URL.
If you set the target to a page in the application and then change a column alias in the query will the link pick that change up automatically? Or do you still have to make sure and change it in the link?
Thanks.
Sorry for the wild goose chase.
David
Maybe you are looking for
-
right forum? first time here. none of the options seem perfect. so i guess this applies to 'setup.' i tried to describe what's happening verbosely from the start of a file transfer to completion of writing file to 2nd hard drive. win 7 64bit home -
-
The sequel of Iphone 4s, ios and Wi-fi
Hello Apple n world, I am one of the "minor" cases when the iphone 4s wont do its job on activating Wi-fi no matter what. I use wonderful products and service of apple which delights me everytime but this is not the case. I am not going through to ex
-
Hello guys, I'm having a very, very difficult time debugging this memory leak on my server. I'm pretty sure it's related to berkeley DB XML, bu I just couldn't prove this in numbers. My server: Debian GNU/Linux 2.4.27-2-386 #1 Wed Aug 17 09:33:35 UTC
-
Tax code to make non-editable after GRN against PO
Dear All, I want to make tax code non-editable in PO after GRN is done against the LIne item. Are there settings or User exit to do to make tax code non-editable? Regards, Rakesh
-
Dear Experts, I am doing a homogenious system copy on ECC6 on windows plateform for STANDBY DATABASE . I am some queries 1. I have taken the offline backup in sapbackup folder on source system ( backup taken on hard disk ) 2. I have installed OS on