apex_item.select_list_from_query in PL/SQL?

Hello

I use APEX 4.0 on a 10g database.

I need to use the apex_item.select_list_from_query function in a PL/SQL program.
variable varchar2(1000);
SELECT apex_item.select_list_from_query(1,sel_name,'SELECT sel_name FROM user_selection WHERE id = (SELECT id FROM users WHERE upper(login)=upper(:APP_USER))','style="width:100%;margin-bottom:5px;"','YES','%',' ',null,'label') INTO variable FROM user_selection;
htp.p(variable);
Who works only the query returns many rows:
ORA-01422: exact fetch returns more than requested number of rows
If I add a where condition to not return clause that one line, it works.
If I use a cursor, then I loop through the records, it works but I get several drop-down lists.

Can someone tell me how to use this function in PL/SQL?

Thank you.

Yann.

This is the current or default value. If an existing value of the database is necessary, then there must be a clause where clause to limit the extraction of a line, as you mentioned, for example

declare
  l_sel_name varchar2(30);
begin
  SELECT sel_name INTO l_sel_name FROM user_selection WHERE ...
  htp.p(
    apex_item.select_list_from_query(
        1
      , l_sel_name
      , 'SELECT sel_name FROM user_selection WHERE id = (SELECT id FROM users WHERE upper(login)=upper(:APP_USER))'
      , 'style=""'
      , 'YES'
      , '%'
      , ' '
      , null
      , 'label'));
end;

Tags: Database

Similar Questions

  • Column Collection reference in APEX_ITEM.select_list_from_query

    I'm now making reference to a column in my collection in the APEX_ITEM.select_list_from_query function. Below, you can see where I tried this, but I get just an error. Any help would be greatly appreciated, thank you.

    APEX_ITEM.select_list_from_query (9, c005,'SELECT WORKLOAD_INDICATOR, wi.) APEX_DATA WORKLOAD_INDICATOR_ID. NURSE_STAFF_WORKLOAD_INDICATOR wi JOIN APEX_DATA. NURSE_STAFF_INDICATORS_WEIGHT w ON wi. WORKLOAD_INDICATOR_ID = w.WORKLOAD_INDICATOR_ID WHERE DEPT_ID = V ("P1_DEPARTMENT") AND (assets = "Y" GOLD wi.) WORKLOAD_INDICATOR_ID = ' | C005. ) GROUP OF WORKLOAD_INDICATOR, wi. Order WORKLOAD_INDICATOR_ID of sum (w.weight) DESC', NULL, 'YES', NULL, 'Select a workload indicator')

    What value there c005? If it is empty, then this might explain the error.

    If this call to apex_item is part of a larger selection, then show the selection complete. Since you concatenate c005 value in the string without any assertion there are chances of surprising characters, like whites.

    Maybe you need to encapsulate a case this whole thing all about expression in order to eliminate cases where c005 has no correct value.

    As

    cases where c005 is null or no regexp_like (c005, "\D") then

    APEX_ITEM.select_list_from_query (9, c005,'SELECT WORKLOAD_INDICATOR, wi.) APEX_DATA WORKLOAD_INDICATOR_ID. NURSE_STAFF_WORKLOAD_INDICATOR wi JOIN APEX_DATA. NURSE_STAFF_INDICATORS_WEIGHT w ON wi. WORKLOAD_INDICATOR_ID = w.WORKLOAD_INDICATOR_ID WHERE DEPT_ID = V ("P1_DEPARTMENT") AND (assets = "Y" GOLD wi.) WORKLOAD_INDICATOR_ID = ' | C005. ) GROUP OF WORKLOAD_INDICATOR, wi. Order WORKLOAD_INDICATOR_ID of sum (w.weight) DESC', NULL, 'YES', NULL, 'Select a workload indicator')

    cases of termination

  • Binds inside the apex_item.select_list_from_query

    Hello

    Unable to find anything to answer my question...
    Maybe someone has a tip.

    Is it possible to use references to link inside of the where the statement of a query in
    apex_item.select_list_from_query?

    I tried with the # < Columnanme > #-rating but he had no success.

    As seen here
    Re: Bug or what? (SELECT_LIST_FROM_QUERY)

    Denes Kubicek provided an example with #Rownum # as a parameter.
    But I need inside the string query...

    I want to refer to columns of the query to a query in a table as


    Select
    a,
    b,
    c,

    apex_item.select_list_from_query (2, c, ' select x, y of the tab where (z = "#b #") ") sel_col,.

    d,
    e
    FROM MyTable.

    Is this possible?

    Concerning
    Andrée

    Andrée:

    Try this

    select
    a,
    b,
    c,
    apex_item.select_list_from_query (2, c, 'select x, y from tab where (z = ' || b || ')   ) sel_col,
    d,
    e
    from mytable;
    

    CITY

  • Apply to a variable to APEX_ITEM. SELECT_LIST_FROM_QUERY

    OS = Windows 7 version

    Version of DB = 10G

    Apex Version = 3.2.1.00.11

    Hello

    Currently, I'm trying to use apex_item.

    I want the order of the SELECT_LIST_FROM_QUERY to display the users at the top of the drop folder.

    I created a view named dbv_team_list;

    select upper (parties.last) || ' ' || upper(parties.first) || ' - ' || skill.skill_level || ' - ' || team_list.status display
         , team_list.team_list_id return
      from dbx_team_list team_list
         , dbx_users users
         , sfm_common.sct_parties parties
         , dbx_skill_level skill
         , dbx_pay_rate pay_rate
    where team_list.user_id = users.user_id
       and users.par_id = parties.par_id
       and team_list.skill_level_id = skill.skill_level_id
       and team_list.pay_rate_id = pay_rate.pay_rate_id
       and team_list.effective_to is null;
    
    
    
    

    I want to use the query named dbv_team_list like this and add an order by (to obtain the registration of the user logged on to appear at the top of the list);

    select display, return from dbv_team_list order by (case return when 3 then 0 else 1 end) asc
    
    
    
    

    I formed what follows as a test to see if I need work and it does.

    SELECT APEX_ITEM.SELECT_LIST_FROM_QUERY(12,NULL,'select display, return from dbv_team_list order by (case return when 3 then 0 else 1 end) asc') "Name"
      FROM DUAL
    
    
    
    
    
    

    I created something called P19_USERNAME to store the value of the column in the view named «BACK» This value is a number.

    But when I try to put a variable in the code it returns an error. The following text shows what I tried so far and everyone here is the error code returned.

    Example 1

    SELECT APEX_ITEM.SELECT_LIST_FROM_QUERY(12,NULL,'select display, return from dbv_team_list order by (case return when :P19_USERNAME then 0 else 1 end) asc') "Name"
      FROM DUAL
    
    
    
    
    
    

    error report:

    ORA-06550: line 1, column 152:

    PL/SQL: ORA-00932: inconsistent data types: expected NUMBER obtained TANK

    ORA-06550: line 1, column 7:

    PL/SQL: SQL statement ignored

    Example 2

    SELECT APEX_ITEM.SELECT_LIST_FROM_QUERY(12,NULL,'select display, return from dbv_team_list order by (case return when NV('P19_USERNAME') then 0 else 1 end) asc') "Name"
      FROM DUAL
    
    

    Failed to parse the SQL query:

    ORA-00907: lack of right parenthesis

    Could someone tell me if this is possible and how would I make the code so it's works.

    Concerning

    Ben

    Benton says:

    But when I try to put a variable in the code it returns an error. The following text shows what I tried so far and everyone here is the error code returned.

    Example 1

    1. SELECT APEX_ITEM. SELECT_LIST_FROM_QUERY (12, NULL, "Select display, return from dbv_team_list by (case back when: end P19_USERNAME of another 1 then 0) CSA '") 'name '.
    2. OF THE DOUBLE

    error report:

    ORA-06550: line 1, column 152:

    PL/SQL: ORA-00932: inconsistent data types: expected NUMBER obtained TANK

    ORA-06550: line 1, column 7:

    PL/SQL: SQL statement ignored

    APEX are "you typed": all element values are of type VARCHAR2. The SQL CASE expression requires that the original expression and comparison expressions are of the same type. Here, the original expression seems to be a NUMBER, or the comparison of the expressions must also show NUMBERS. The APEX P19_USERNAME element is a VARCHAR2, so it must be explicitly converted or accessible using the function NV:


    SELECT APEX_ITEM.SELECT_LIST_FROM_QUERY(12,NULL,'select display, return from dbv_team_list order by (case return when to_number(:P19_USERNAME) then 0 else 1 end) asc') "Name"
      FROM DUAL
    


    Example 2

    1. SELECT APEX_ITEM. SELECT_LIST_FROM_QUERY (12, NULL, "Select display, return of the order of dbv_team_list (case back when NV('P19_USERNAME') then 0 1 other end) CSA") 'name '.
    2. OF THE DOUBLE

    Failed to parse the SQL query:

    ORA-00907: lack of right parenthesis

    Quotes inside strings must be escaped by doubling them:

    SELECT APEX_ITEM.SELECT_LIST_FROM_QUERY(12,NULL,'select display, return from dbv_team_list order by (case return when NV(''P19_USERNAME'') then 0 else 1 end) asc') "Name"
      FROM DUAL;
    

    However, the best approach when dealing with strings containing code is to use the alternative quoting mechanism:

    SELECT APEX_ITEM.SELECT_LIST_FROM_QUERY(12,NULL,q'{select display, return from dbv_team_list order by (case return when NV('P19_USERNAME') then 0 else 1 end) asc}') "Name"
      FROM DUAL;
    

    Also suggest you use does not RETURN as a means of identification as it is a keyword in PL/SQL.

  • Using APEX_ITEM in SQL performance issues?

    Hello

    I was wondering if using APEX_ITEM.* in your SQL source for a report would give some performance issues? I expect the report to bring a little more than 3000 documents. When I developed it it was working fine but we had 150 cases or so, but now we have migrated demand during our test the page system will take about 2 minutes to load. Here is my SQL to create the report:

    Select distinct
    initcap (MPa.pa_name) | ' (' || sd. DESIGNATION_CODE | ')' site.
    FRC. REPORT_DESCRIPTION report_category,
    MF. Function FEATURE_DESC
    decode (cmf. SELECTED_FOR_QA, 'Y', 'X', ' N ',' ') QA,.
    () apex_item.select_list_from_query
    21,
    CPF. ASSIGN_TO,
    «Select ss.firstname | "» '' || SS. Surname d, ss. STAFF_NUMBER r
    of snh_staff ss,.
    snh_management_units smu,
    m_pa_snh_area psa
    where ss. MU_UNIT_ID = EMS. UNIT_ID
    and smu. UNIT_ID = psa. UNIT_ID
    and ss. CURRENTLY_EMPLOYED = "Y"
    and psa. SCM_LEAD = "Y"
    and psa. MAIN_AREA = "P"
    and psa.PA_CODE = ' | MPa.pa_code,
    NULL,
    '' YES. ''
    NULL,
    (' ') assign_to,.
    () apex_item.select_list_from_query
    22,
    Decode (to_char (cpf.planned_fieldwork, ' DD/MM /'),)
    30/06 /', 'Q1 ' | TO_CHAR (planned_fieldwork, 'YYYY'),
    30/09 /', 'T2 ' | TO_CHAR (planned_fieldwork, 'YYYY'),
    31/12 /', 'Q3 | TO_CHAR (planned_fieldwork, 'YYYY'),
    31/03 /', 'T4 ' | TO_CHAR (planned_fieldwork-365, "YYYY").
    TO_CHAR (cpf.planned_fieldwork, "YYYY")),
    ' select r d,
    of CM_CYCLE_Q_YEARS') planned_fieldwork,.
    () apex_item.select_list_from_query
    23,
    Decode (to_char (cpf.planned_cmf, ' DD/MM /'),)
    30/06 /', 'Q1 ' | TO_CHAR (planned_cmf, 'YYYY'),
    30/09 /', 'T2 ' | TO_CHAR (planned_cmf, 'YYYY'),
    31/12 /', 'Q3 | TO_CHAR (planned_cmf, 'YYYY'),
    31/03 /', 'T4 ' | TO_CHAR (planned_cmf-365, "YYYY").
    TO_CHAR (cpf.planned_cmf, "YYYY")),
    ' select r d,
    of CM_CYCLE_Q_YEARS') planned_cmf,.
    () apex_item.select_list_from_query
    24,
    CPF.monitoring_method_id,
    "(Select METHOD, MONITORING_METHOD_ID from cm_monitoring_methods where active_flag ="Y"') monitoring_method,
    (apex_item). Text
    25,
    CPF.pre_cycle_comments,
    15,
    255,
    "title =" '. CPF.pre_cycle_comments |' » ',
    'annualPlanningComments '.
    || TO_CHAR (cpf. Comment PLAN_MON_FEATURE_ID)),
    (apex_item). Text
    26,
    TO_CHAR (cpf. CONTRACT_LET, 'MON-DD-YYYY'),
    11,
    (11) contract_let,
    (apex_item). Text
    27,
    TO_CHAR (cpf. CONTRACT_REPORT_PLANNED, 'MON-DD-YYYY'),
    11,
    (11) contract_report,
    (apex_item). Text
    28,
    CPF. ADVISOR_DATA_ENTRY,
    11,
    (11) advisor_entry,
    CMS.complete_percentage | ' ' || status of CMS. Description,
    (apex_item). Text
    29,
    TO_CHAR (cpf. RESULT_SENT_TO_OO, 'MON-DD-YYYY'),
    11,
    (11) result_to_oo,
    CPF. PLAN_MON_FEATURE_ID,
    CMF. MONITORED_FEATURE_ID,
    mpa.PA_CODE,
    MPF. SITE_FEATURE_ID
    of fm_report_category ERS,
    m_feature mf,
    m_pa_features mpf,
    m_protected_area mpa,
    snh_designations sd,
    cm_monitored_features FMC,
    cm_plan_mon_features FCP,
    cm_monitoring_status cms,
    cm_cycles cc,
    msa m_pa_snh_area,
    snh_management_units smu,
    ssa snh_sub_areas
    where frc. REPORT_CATEGORY_ID = mf. REPORT_CATEGORY_ID
    and mf. Feature_code = mpf. FEATURE_CODE
    and mpa.PA_CODE = mpf.PA_CODE
    and mpa. DESIGNATION_ID = sd. DESIGNATION_ID
    and the mpf. SITE_FEATURE_ID = FCM. SITE_FEATURE_ID
    and CME. MONITORED_FEATURE_ID = cpf. MONITORED_FEATURE_ID
    and cms. MONITORING_STATUS_ID = FCM. MONITORING_STATUS_ID
    and cc. CYCLE # = FCM. CYCLE #.
    and msa.PA_CODE = mpa.PA_CODE
    and msa. UNIT_ID = EMS. UNIT_ID
    and msa. SUB_AREA_ID = ass. SUB_AREA_ID
    and cc. CURRENT_CYCLE = 'Y '.
    and msa. MAIN_AREA = 'P '.
    and msa. SCM_LEAD = 'Y '.
    and the mpf. INTEREST_CODE in (1,2,3,9)
    and ((nvl (: P6_REPORTING_CATEGORY, 'TOUT') = 'ALL'))
    and to_char (frc. FCA_FEATURE_CATEGORY_ID) = case nvl (: P6_BROAD_CATEGORY, 'ALL') when "ALL" then to_char (frc. (FCA_FEATURE_CATEGORY_ID) else: P6_BROAD_CATEGORY end)
    or (nvl (: P6_REPORTING_CATEGORY, 'ALL')! = 'ALL')
    and to_char (mf. REPORT_CATEGORY_ID) = case nvl (: P6_REPORTING_CATEGORY, 'ALL') when "ALL" then to_char (mf. REPORT_CATEGORY_ID) else: P6_REPORTING_CATEGORY end))
    and ((nvl (: P6_SNH_SUB_AREA, 'TOUT') = 'ALL'))
    and to_char (msa. UNIT_ID) = case nvl (: P6_SNH_AREA, 'ALL') when "ALL" then to_char (msa. (UNIT_ID) else: P6_SNH_AREA end)
    or (nvl (: P6_SNH_SUB_AREA, 'ALL')! = 'ALL')
    and to_char (msa. SUB_AREA_ID) = case nvl (: P6_SNH_SUB_AREA, 'ALL') when "ALL" then to_char (msa. SUB_AREA_ID) else: P6_SNH_SUB_AREA end))
    and ((nvl (: P6_SITE, 'TOUT')! = 'ALL'))
    and mpa.PA_CODE =: P6_SITE)
    or nvl (: P6_SITE, 'ALL') = 'ALL')

    As you can see I have 9 calls the APEX_ITEM API and when I get out them the works of report that I expect.

    Has anyone else ran into this problem?

    We're currently on APEX: 3.0.1.00.08 and using Oracle9i Enterprise Edition Release 9.2.0.8.0 - 64 bit, Production database.

    Thanks in advance,
    Paul.

    Try to remove all except one of the calls apex_item.select_list_from_query, and then rewrite this one to use subquery factoring. Now compare at the same time for the same query with and without subquery factoring. In addition, 500 lines is a realistic number that you expect someone to change?

  • How do you define a default value for APEX_ITEM. SELECT_LIST_FROM_QUERY?

    Hi all
    I have the report based on a query

    SELECT distinct apex_item.hidden (1, seq_id), c003 c004, c006, APEX_ITEM c005. SELECT_LIST_FROM_QUERY (6, c020, 'select DISTRIBUTION_NAME, DISTRIBUTION_NAME from the DISTRIBUTIONS',' style = "" ',' YES, ' default here? "," ", null, 'label'") 'BONOU,"NVL (c017, 'SPLIT'), 'Split', SEQ_ID
    OF APEX_collections
    WHERE collection_name = "ARGYLL_INVOICES."
    order of seq_id


    I would like to enter a default value in the APEX_ITEM. SELECT_LIST_FROM_QUERY. I can't make it work.

    Anyone know what I am doing wrong, or suggest an easier way?
    Thank you

    Just as a note, but you want to ensure your APEX_ITEM call is closed. The code snippet you posted isn't complete.

     APEX_ITEM.SELECT_LIST_FROM_QUERY(6,c020, 'select DISTRIBUTION_NAME, DISTRIBUTION_NAME from DISTRIBUTIONS','style="", SEQ_ID   <-- No closing )
    

    In literature - http://www.utoug.org/i/doc/api099.htm - (even if it is not necessarily the easiest to read), he gives this explanation of the syntax:

    APEX_ITEM. () SELECT_LIST_FROM_QUERY
    p_idx in NUMBERS
    p_value IN VARCHAR2 default,
    p_query IN VARCHAR2,
    p_attributes IN VARCHAR2 default,
    p_show_null IN VARCHAR2 default,
    p_null_value IN VARCHAR2 default,
    p_null_text IN VARCHAR2 default,
    p_item_id IN VARCHAR2 default,
    p_item_label IN VARCHAR2 default,
    p_show_extra IN VARCHAR2 DEFAULT)
    RETURN VARCHAR2;

    What you want to watch is p_value to set an initial value. It must come from your data, but you might want to consider doing a NVL or DECODE to replace your default.

    In this case, it would change your query to be:

    SELECT distinct apex_item.hidden(1, seq_id), c003,c004,c005, c006,
          APEX_ITEM.SELECT_LIST_FROM_QUERY(6,c020, 'select DISTRIBUTION_NAME, DISTRIBUTION_NAME from DISTRIBUTIONS','style=""),
          SEQ_ID
      FROM APEX_collections
     WHERE collection_name = 'ARGYLL_INVOICES'
    order by seq_id 
    

    If the value is always NULL, you can use the p_show_null, p_null_value and p_null_text to highlight 'by default'

    SELECT distinct apex_item.hidden(1, seq_id), c003,c004,c005, c006,
          APEX_ITEM.SELECT_LIST_FROM_QUERY(6,NVL(c020,0), 'select DISTRIBUTION_NAME, DISTRIBUTION_NAME from DISTRIBUTIONS','style="",YES, 100, 'Default'),
          SEQ_ID
      FROM APEX_collections
     WHERE collection_name = 'ARGYLL_INVOICES'
    order by seq_id 
    
  • Error buffer using APEX_ITEM

    I have this query on a report of the apex:

    Select APEX_ITEM. TEXT (1, ATRIBUTO, 30) 'attributes '.
    ATRIBID
    , VALOR 'real value '.
    APEX_ITEM. SELECT_LIST_FROM_QUERY (2
    ATRIB_VLR_ID
    ,' choose VALOR
    ID
    of ATRIBBVAL
    where ATRIB_ID = ' | ATRIBID | »
    order of valor') "answers".
    of APEX_TEMP
    where PRODUCT =: P3_PRODUCT
    and APP_SESSION =: APP_SESSION.

    I have a lot of products that query runs reasonable.
    But I also have a group of products that when I want to run, it gives the error:

    error report:
    ORA-06502: PL/SQL: digital or value error: character string buffer too small

    When I reduce the number of lines of response (see example below) in the SELECT_LIST_FROM_QUERY the error does not occur.

    Select APEX_ITEM. TEXT (1, ATRIBUTO, 30) 'attributes '.
    ATRIBID
    , VALOR 'real value '.
    APEX_ITEM. SELECT_LIST_FROM_QUERY (2
    ATRIB_VLR_ID
    ,' choose VALOR
    ID
    of ATRIBBVAL
    where ATRIB_ID = ' | ATRIBID | »
    and rownum < = 90
    order of valor') "answers".
    of APEX_TEMP
    where PRODUCT =: P3_PRODUCT
    and APP_SESSION =: APP_SESSION.

    Any sugestion to help me?

    In this case, the apex I use is 3.2.1 and 11.2.0.1.0 data base.

    The apex_item.select_list_from_query method returns a VARCHAR2 value that has a maximum of 4000 bytes size when it is retrieved in a SQL query.

    Pass to the apex_item.select_list_from_query_xl method returns a CLOB value up to 32 KB.

  • select_list_from_query using the union

    As a manual, how to have the APEX_ITEM. SELECT_LIST_FROM_QUERY when the query is like
    SELECT 'A' D, 'A' R FROM DUAL UNION ALL
    SELECT 'B' D, 'B' R FROM DUAL UNION ALL
    SELECT 'C' D, 'C' R FROM DUAL UNION ALL
    Please suggest


    Sanjay

    Hello
    >

    select APEX_ITEM.SELECT_LIST_FROM_QUERY(04,NULL,'select 'A' D, 'B' R from DUAL
     union all
     select 'C' D, 'D' R from dual', 'style=""','','YES',' - Select Details - ', 'f04_' || '#ROWNUM#', NULL, 'NO')LR_COURIER from dual
    

    Bracket missing error appears when you run the above code.
    >

    To escape the single quotes shipped like this

    select APEX_ITEM.SELECT_LIST_FROM_QUERY(04,NULL,'select ''A'' D, ''B'' R from DUAL
     union all
     select ''C'' D, ''D'' R from dual', 'style=""','','YES',' - Select Details - ', 'f04_' || '#ROWNUM#', NULL, 'NO')LR_COURIER from dual
    

    See you soon,.

    PS: Or use the q! Construct

    select APEX_ITEM.SELECT_LIST_FROM_QUERY(04,NULL,q'!select 'A' D, 'B' R from DUAL
     union all
     select 'C' D, 'D' R from dual!', 'style=""','','YES',' - Select Details - ', 'f04_' || '#ROWNUM#', NULL, 'NO')LR_COURIER from dual
    

    Published by: Dominique 21 August 2012 16:19

  • Apex_item.text dynamic item add or subtract value

    I have a report that creates dynamic items using the package apex_item, like this:
    select id
    ,      apex_item.hidden(1,id) 
    ,      label
    ,          decode(typ_id,
                        1, apex_item.text(p_idx=> 2, p_value=> null, p_attributes=> 'class="number"') || 'num', /*this should be a numberic field, isn't working jet*/
                        2, apex_item.text(2),
                        3, apex_item.select_list_from_query(p_idx=> 2, p_query=> 'select label, id from list where prop_id = ' || id, p_show_null=> 'NO'),
                        4, apex_item.date_popup(2, 0),
                        5, apex_item.text(2,'0') || '<a href="f?p=&APP_ID.:1:&SESSION."><img src="#WORKSPACE_IMAGES#add.gif"/></a> <a href="f?p=&APP_ID.:1:&SESSION."><img src="#WORKSPACE_IMAGES#substract.gif"/></a>',
                        descr
                   ) value
    from properties 
    order by id
    In the latter type of element (where typ_id is 5) I want to have a textfield allowing only numberic values. If the user clicks on the image "add.gif" the value of the element must be added by 1, and when the user clicks on 'substract.gif' value must be lowerd by 1. How can I make this work? The images can be replaced by another element, if necessary.

    Hi Mir,

    My apologies for the restructuring of the query using case. I hope this would help you. The code could be much simpler if you could take the JS logic to a JS function on the page.

    http://Apex.Oracle.com/pls/Apex/f?p=44973:2

    See you soon
    Ligon
    PS: The code for formatting here has been driving me crazy so I have to put it in a page to show you :)

  • ID of the game with SELECT_LIST_FROM_QUERY

    Hello

    I use ApEx 4.0 on Oracle 10 g.

    I created a ListBox using SELECT_LIST_FROM_QUERY:
    apex_item.select_list_from_query(1,v_loggus_name,'SELECT loggus_name FROM USER_SELECTION WHERE loggu_id ='||v_loggu_id,'style="width:100%;margin-bottom:5px;"','NO','P3_CART_LIST','label');
    In the documentation , we read: "ID attribute for the < input > tag HTML p_item_id.".

    But a selection list is a < select > tag, not a < input > tag...

    If the ID is not set when you look at the HTML code.

    I tried to use instead:
    apex_item.select_list_from_query(1,v_loggus_name,'SELECT loggus_name FROM USER_SELECTION WHERE loggu_id ='||v_loggu_id,'id="P3_CART_LIST" style="width:100%;margin-bottom:5px;"','NO',null,'label');
    But it doesn't work when I try to call an ajax like this (use my application process: P3_CART_LIST):
    var get = new htmldb_Get(null,$x('pFlowId').value,'APPLICATION_PROCESS=Add_to_cart',0);
    get.add('P3_CART_LIST','a_value');
    = > ERR-1002 cannot find the item for the "P3_CART_LIST" element ID "349 enforcement.

    Any idea?

    Thank you.

    Yann.

    Hello

    You cannot set the session state for items you create with APEX_ITEM.
    For example, use APEX_APPLICATION. G_X01 to pass the value to the application process.

    function myf(pMyVal){
     var get = new htmldb_Get(null,$x('pFlowId').value,'APPLICATION_PROCESS=Add_to_cart',0);
     get.addParam('x01',$v(pMyVal));
    .......
    

    Upon request as

    .....
    INSERT my_tbl(my_col1)VALUES(APEX_APPLICATION.G_X01);
    .....
    

    Kind regards
    Jari

  • redirect apex_item.select_list

    Hello

    I try to redirect APEX_ITEM. SELECT_LIST_FROM_QUERY in this way:
    ...
    APEX_ITEM.SELECT_LIST_FROM_QUERY(51-num, '',
                   'select distinct level_name display_value, level_name return_value from '
                   ||i.view_name,
                            'onchange="location.href=''f?p=100:4:5187140117232985:LVLCHG:NO::LVL:''+this.options[selectedIndex].value;"',
                   'no',
                   '','','LVL','','')
    ...
    With onchange in the p_attributes page redirects but it cannot retrieve the selected value.
    He will raise an error: ERR-1002 cannot find the item for the item 'LVL' ID in the application "100".
    However I put the ID to LVL in the select list and in the url too.

    Can you help me solve this problem?
    Thank you!

    Hello:

    What exactly are you trying to do? It seems to me that you are trying to redirect to the same page that defines the list select using the apex_item API. To pass a value in the URL of the target for the value, I think that must be a page/app APEX element.

    CITY

  • Feature Select multi with apex_item type

    I need implement the feature selection multi for the report. Is this can be implemented with the apex.item.

    For a line, you can do something like this:

    Select ename, empno, apex_item.select_list_from_query (1, null, 'select deptno from emp ',' multiple = "multiple" ') from emp where empno = 7839

    Scott

  • Problem with the cascading for interactive report selection list

    Hi all.

    I'm trying to implement the solution of cascading to the tabular presentation list.

    https://Apex.Oracle.com/pls/Apex/f?p=31517:176:103661090335568:

    But instead of the form of paintings, I use interactive report. After executing the query, I get the error:

    ORA-06550: line 1, column 147: PL/SQL: ORA-00936: lack of expression ORA-06550: line 1, column 13: PL/SQL: statement ignored


    My Sql query for the report:

    select 
    apex_item.hidden(1, a."DATA_ID")DATA_ID,
    apex_item.select_list_from_query(10,
      b.WAVE_GROUP,
     'select GROUP_DISPLAY, GROUP_RETURN from dwd_wave_group',
     'onchange="f_set_casc_sel_list_item(this,f11_'||LPAD (a.DATA_ID, 4,'0')||')"',
     'YES',
     '',
     '- Select Group -',
     'f10_' || LPAD (a.DATA_ID, 4, '0'),
      NULL,
     'NO'
     )WAVE_GROUP,
    apex_item.select_list_from_query(11, b."WAVE_USER",
    'SELECT username d, '
    ||'username r FROM dwd_user where groups = '||b."WAVE_GROUP",
    '',
    'YES',
    '', 
    '- Select User -',
    'f11_' || LPAD (a.DATA_ID, 4, '0'),
     NULL,
    'NO'
    )WAVE_USER
    from "DWD_WAVE_MASTER" a, dwd_wave_assignment b
    where a.data_id = b.data_id
    and b.wave_id = 'wave_1'
    

    If I exclude the condition 2nd selection list query and change as below then everything works fine. Query does not give error on sql developer.

    Use: APEX 4.2.6 with Database 11g.

    apex_item.select_list_from_query(11, b."WAVE_USER",
    'SELECT username d, '
    ||'username r FROM dwd_user',
    '',
    'YES',
    '', 
    '- Select User -',
    'f11_' || LPAD (a.DATA_ID, 4, '0'),
     NULL,
    'NO'
    )
    

    Can someone please help!

    Thank you

    Nabila

    The nabila Islam wrote:

    I'm trying to implement the solution of cascading to the tabular presentation list.

    https://Apex.Oracle.com/pls/Apex/f?p=31517:176:103661090335568:

    But instead of the form of paintings, I use interactive report. After executing the query, I get the error:

    ORA-06550: line 1, column 147: PL/SQL: ORA-00936: lack of expression ORA-06550: line 1, column 13: PL/SQL: statement ignored

    My Sql query for the report:

    1. Select
    2. apex_item. Hidden (' 1, a. "DATA_ID DATA_ID").
    3. apex_item.select_list_from_query (10,
    4. b.WAVE_GROUP,
    5. "select GROUP_DISPLAY, GROUP_RETURN from dwd_wave_group,"
    6. "onchange =" f_set_casc_sel_list_item (this, f11_'|) LPAD (a.DATA_ID, 4, '0'). ") » ',
    7. '' YES. ''
    8. '',
    9. -Select Group «-»,
    10. "f10_" | LPAD (a.DATA_ID, 4, '0'),
    11. NULL,
    12. 'NO '.
    13. ) WAVE_GROUP,.
    14. apex_item.select_list_from_query ("11, b.") WAVE_USER,"
    15. "SELECT user name d.
    16. |' username r FROM dwd_user where group = ' | b."WAVE_GROUP."
    17. '',
    18. '' YES. ''
    19. '',
    20. "- Select user -",
    21. "f11_" | LPAD (a.DATA_ID, 4, '0'),
    22. NULL,
    23. 'NO '.
    24. ) WAVE_USER
    25. of 'DWD_WAVE_MASTER' a, b dwd_wave_assignment
    26. where a.data_id = b.data_id
    27. and b.wave_id = 'wave_1. '

    If I exclude the condition 2nd selection list query and change as below then everything works fine. Query does not give error on sql developer.

    Use: APEX 4.2.6 with Database 11g.

    1. apex_item.select_list_from_query ("11, b.") WAVE_USER,"
    2. "SELECT user name d.
    3. |' username r FROM dwd_user ",
    4. '',
    5. '' YES. ''
    6. '',
    7. "- Select user -",
    8. "f11_" | LPAD (a.DATA_ID, 4, '0'),
    9. NULL,
    10. 'NO '.
    11. )

    What is the data type of DWD_WAVE_ASSIGNMENT. WAVE_GROUP? If it is not a number, then it must be enclosed in quotes when it is used as a literal:

    apex_item.select_list_from_query(11, b."WAVE_USER",
    'SELECT username d, '
    
    ||'username r FROM dwd_user where groups = ' || dbms_assert.enquote_literal(b."WAVE_GROUP"),  
    
    '',
    'YES',
    '',
    '- Select User -',
    'f11_' || LPAD (a.DATA_ID, 4, '0'),
    NULL,
    'NO'
    )
    
  • AJAX get several tabular values I

    Hello
    All those put in place the great example of damien Kubicek - ApEx
    -Section III - Ajax solutions get several tabular values I have? Within the
    my test apex.oracle.com workspace for that I've set up this example
    My tabular presentation. I created the table my_book_store and I also exported
    the site and imported data in the my_book_store table in
    Apex. Oracle.com test site. My table and data are the same as an example but
    I get this error
    failed to parse SQL query: ORA-01403: no data found
    Here's the code I added within the application. If someone sees
    everything that is not correct please point my error or errors please.

    Create the Table Script
    CREATE TABLE  "MY_BOOK_STORE" 
       (     "BOOK_ID" NUMBER, 
         "BLOB_CONTENT" BLOB, 
         "MIME_TYPE" VARCHAR2(4000), 
         "SUBJECT" VARCHAR2(4000), 
         "PRICE" NUMBER, 
         "AUTHOR" VARCHAR2(100), 
         "TOPIC" NUMBER
       )
    /
    
    
    CREATE UNIQUE INDEX  "SYS_IL0003125020C00002$$" ON  "MY_BOOK_STORE" (
    /
    Header HTML
    <script language="JavaScript" type="text/javascript">
    
    function f_set_multi_items_tabular(pValue, pRow){
        var get = new htmldb_Get(null,html_GetElement('pFlowId').value,
    'APPLICATION_PROCESS=Set_Multi_Items_Tabular',0);
    if(pValue){
    get.add('TEMPORARY_APPLICATION_ITEM',pValue)
    get.add('T_ROWNUM',pRow)
    }else{
    get.add('TEMPORARY_APPLICATION_ITEM','null')
    }    
    
        gReturn = get.get('XML');
    
        if(gReturn){
            var l_Count = gReturn.getElementsByTagName("item").length;
            for(var i = 0;i<l_Count;i++){
                var l_Opt_Xml = gReturn.getElementsByTagName("item");
    var l_ID = l_Opt_Xml.getAttribute('id');
    var l_El = html_GetElement(l_ID);
    if(l_Opt_Xml.firstChild){
    var l_Value = l_Opt_Xml.firstChild.nodeValue;
    }else{
    var l_Value = '';
    }

    if(l_El){
    if(l_El.tagName == 'INPUT'){
    l_El.value = l_Value;
    }else if(l_El.tagName == 'SPAN' && l_El.className == 'grabber'){
    l_El.parentNode.innerHTML = l_Value;
    l_El.parentNode.id = l_ID;
    }else{
    l_El.innerHTML = l_Value;
    }
    }
    }
    }
    get = null;
    }

    </script>

    Tabular Form - Region Source
    SELECT     apex_item.select_list_from_query
                         (31,
                          NULL,
                          'SELECT subject d, ' || 'book_id r FROM my_book_store',
                             'style="width:250px" '
                          || 'onchange="f_set_multi_items_tabular(this.value,''#ROWNUM#'''
                          || ')"',
                          'YES',
                          '0',
                          '- Select Book -',
                          'f31_' || '#ROWNUM#',
                          NULL,
                          'NO'
                         ) book,
               apex_item.text (32,
                               NULL,
                               80,
                               100,
                               'style="width:190px" ',
                               'f32_' || '#ROWNUM#'
                              ) subject,
               apex_item.text (33,
                               NULL,
                               80,
                               100,
                               'style="width:50px;text-align:right" ',
                               'f33_' || '#ROWNUM#'
                              ) price,
               apex_item.text (34,
                               NULL,
                               80,
                               100,
                               'style="width:130px" ',
                               'f34_' || '#ROWNUM#'
                              ) author,
               apex_item.text (35,
                               NULL,
                               80,
                               100,
                               'style="width:20px;text-align:right" ',
                               'f35_' || '#ROWNUM#'
                              ) qty
          FROM my_book_store
    Application process - Set_Multi_Items_Tabular
    DECLARE
       v_subject   my_book_store.subject%TYPE;
       v_price     my_book_store.price%TYPE;
       v_author    my_book_store.author%TYPE;
       v_qty       NUMBER;
    
       CURSOR cur_c
       IS
          SELECT subject, price, author, 1 qty
            FROM my_book_store
           WHERE book_id = :temporary_application_item;
    BEGIN
       FOR c IN cur_c
       LOOP
          v_subject := c.subject;
          v_price := c.price;
          v_author := c.author;
          v_qty := c.qty;
       END LOOP;
    
       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 ('<body>');
       HTP.prn ('<desc>this xml genericly sets multiple items</desc>');
       HTP.prn ('<item id="f32_' || :t_rownum || '">' || v_subject || '</item>');
       HTP.prn ('<item id="f33_' || :t_rownum || '">' || v_price || '</item>');
       HTP.prn ('<item id="f34_' || :t_rownum || '">' || v_author || '</item>');
       HTP.prn ('<item id="f35_' || :t_rownum || '">' || v_qty || '</item>');
       HTP.prn ('</body>');
    END;
    I have two elements of the Application

    TEMPORARY_APPLICATION_ITEM and T_ROWNUM

    Hi Charles,

    Basically, there are few questions here

    First of all I don't know what causes the Oracle error

    failed to parse SQL query: ORA-01403: no data found
    

    I just rename the columns and back return that fixed the issue. I guess that the metadata of the apex was damaged for some reason any.

    There is no problem with your javascript or the application process.

    The issue has been with your application to the element Protection of Session State has been Restricted - can not be set browser and you try to set their via JavaScript which will fail, I changed it to unlimited use.

  • Select the list doesn't work is not in the report - see demo

    Ok..

    I have created a demo on APEX 4.1.1... and 4.2 and it fails when 10 characters or more are in the list, with 103 lines or more

    http://Apex.Oracle.com/pls/Apex/f?p=13679:1

    workspace: nzp
    username:demo
    password: demo

    Dean

    You use the apex_item.select_list_from_query method which returns a VARCHAR2 value that has a maximum of 4000 bytes size when it is retrieved in a SQL query.

    Go to the apex_item.select_list_from_query_xl method returns a CLOB value up to 32 K in size, such as discussed in the error report: ORA-06502: PL/SQL: digital or value error: character string b. (The problem, it was not a not clear exactly how the list was generated).

Maybe you are looking for