Delete in the database based on the values of the multiple selection list

Hello

I have a selectlist in Apex and a function in the database to make a deletion based on the value selected in the selection list.
FUNCTION delete_batch (v_batch VARCHAR2) RETURN VARCHAR2
IS
BEGIN
IF v_batch like 'M%'
THEN
   RETURN ('A monthrun cannot be deleted');
ELSE
   DELETE FROM so_disco_pa
   WHERE  batch = v_batch
   ;
   DELETE FROM so_batch_pa
   WHERE  batch = v_batch
   ;
   COMMIT;
   RETURN ('Batch '||v_batch||' has been deleted');
END IF;
EXCEPTION
WHEN OTHERS THEN
    RETURN ('Batch could not be deleted');
END delete_batch;
The package is called when the user clicks on the button Delete with the rest of the process:
BEGIN
DECLARE
x   varchar2(100);
BEGIN
x := pa_control.delete_batch (:P3_BATCH);
:F105_MESSAGE := x;
END;
END;
Now, I want to change the selectlist for a multiple-selection list to make several batches can be deleted.

How can I change my procedure and the procedure to remove lots based on the values selected?

Thank you

Diana

dianap says:
I got this far, but only the first batch selected in the list is being deleted. The other values of selected package are not removed.

Help please.

Move the RETURN statement out of your loop.

Tags: Database

Similar Questions

  • Facing problem in the multiple selection list...

    Hi Andy,.

    We are facing a problem more...

    In the selection of the Menu... Like u given a solution for dropdownlist hide which works very well... but the same logic does not work for the multiple selection list item. Why so...


    David...

    Published by: David on November 17, 2008 05:22

    Hello

    If you have added in the Page template, then the P39_BATES_DESCRIPTION will not work. As the P63_ATTRIBUTE_CLASS_CODE is not on the page, javascript will throw an error and that will stop the rest of the code to run.

    You can get javascript to test for the existence of a question of fact:

    if ($x('P63_ATTRIBUTE_CLASS_CODE')) {$x('P63_ATTRIBUTE_CLASS_CODE').style.display = 'none';}
    if ($x('P63_ATTRIBUTE_TYPE')) {$x('P63_ATTRIBUTE_TYPE').style.display = 'none';}
    if ($x('P39_BATES_DESCRIPTION')) {$x('P39_BATES_DESCRIPTION').style.display = 'none';}
    

    Andy

  • The value of another field using the multiple-selection list

    Hello

    I have a multi select list as USER name name...
    In these cases, I select several users as For example JOHN AND JACK
    Database that should get both their email ID then fill in textarea (separated by commas)

    As I am new to apex, pls help.

    Welcome to this forum... :))

    What is your version of the database?

    If you use database 11g then you can use the following query for your condition,

    select LISTAGG(user_email, ':') WITHIN GROUP (ORDER BY user_email) from table_name
    where INSTR(':'||NVL(:PX_USERNAME,user_name)||':',':'||user_name||':')>0
    

    instead of PX_USERNAME use the name of your multi selection list.

    Use this query in your textfield.

    Thank you
    Lacombe

  • How to make default an element selected in the multiple selection list

    Hello

    I'm filling the list of multiple selection of a lov (dynamic lov). Is it possible to do by default one of the selected items in the list.

    Please let me know how to do this...

    Thanks /.

    How do you determine that a particular value of the LOV must be the default?
    You should be able to combine the LOV query and your 'default selection' health by using an SQL statement or a pl/sql function and specify it for the 'default value Type' in the section 'Default' definition of the elements page.

    CITY

  • problem in the multiple selection list

    Hello...

    That's my problem... We have a few values in session selection multiple list... these values are highlighted in the list... If wen I try to hide the list im unable to do? I think that its because of the session... wat shal I do nw?

    function hidelist()
    {
    document.getElementById('item_name').style.display = 'none ';
    }

    function showlist()
    {
    document.getElementById('item_name').style.display = 'block ';
    }





    David

    Hi David,

    It is difficult to know what can happen that I can't see your page - this error message indicates that javascript can not see the page element to which you are referring to.

    For example, if I make document.getElementById("ABC").style.display, but the article did a 'BCD' ID I would get this error.

    So, the first thing to check is that the list item is the ID that you think it does. Load the page and do a view Source. Find the selection list and check to see how ID attribute there. If it contains the right ID attribute, then it might be easier if you could save the page view Source and send it to me at... so I can watch it.

    Andy

  • How to use the multiple selection list values in sql query

    Hi all
    In the search form, I have a multiselect llist tell (P3_STATUS) and I want to have a query using this element and fetch documents
    How to do a sql query based on the selection of the value of this element.
    SELECT "W"."START_DT" "Start Date",
           "W"."CAMPAIGN_CODE" "Campaign Name",  
           "W"."MKT_CHANNEL" "Channel",
           "W"."MKT_SUB_CHANNEL" "Sub Channel", 
           "W"."PROMO_CODE" "Promo Code",
           "W"."TRACKING_CODE" "Tracking Code",
           "W"."TFN" "TFN",
           "W"."STATUS" "Status",
           "W"."CAMPAIGN_CODE" "Edit"
           FROM 
             "WC_MKT_CAMPAIGN_DS" "W"
      
           WHERE 
         (MKT_CHANNEL = decode(:P1_CHANNEL,'%null%',MKT_CHANNEL,NULL,MKT_CHANNEL,:P1_CHANNEL))
       AND
    (MKT_SUB_CHANNEL= decode(:P1_SUB_CHANNEL,'%null%',MKT_SUB_CHANNEL,NULL,MKT_SUB_CHANNEL,:P1_SUB_CHANNEL))
    AND *STATUS = decode(.................*
    Please could someone help me on this?

    Thanks in advance
    Robert L

    Try to change your selection of status to

    AND INSTR(':'||:P3_STATUS||':',':'||STATUS||':') > 0
    
  • Creation of Validation for the multiple selection list or shuttle point

    Hello
    I'm new to APEX and have questions about the best way to validate the selected shuttle items to verify that they exist in the sys.dba_roles table before submitting. The shuttle point uses a static LOV. I would like to than the error message to display when there is no such thing as a role selected in the element of the shuttle in the sys.dba_roles table.

    Using version 3.2 of APEX
    DB version 9.2.0.8.0
    Internet Explorer version 6

    I tried to create a validation step level about to shuttle P3_ROLE using SQL EXISTS when you press the button SUBMIT. I know that when argued that the shuttle point returns the selected values in a single string delimited by a colon. I use the APEX_UTIL. STRING_TO_TABLE to convert values selected in a table.

    CODE HERE
    declare
    l_selected APEX_APPLICATION_GLOBAL. VC_ARR2;
    number of l_num;
    Start
    l_selected: = APEX_UTIL. STRING_TO_TABLE(:P3_ROLE);
    BECAUSE me IN 1.l_selected. COUNTY
    LOOP
    Select 1 from l_num of sys.dba_roles where role = l_selected (i);
    END LOOP;
    end;

    This is the error ORA-00928: lack of SELECT keyword
    1006 - ERR error in the validation routine.

    Any advice? Thoughts? Thank you.

    Published by: Violet on Oct 14, 2010 14:50

    Hello

    Your code is PL/SQL block. You cannot use this type of validation with your code.

    Try to change the body type of the function that returns the error text and
    code for this one

    DECLARE
      l_selected APEX_APPLICATION_GLOBAL.VC_ARR2;
      l_num NUMBER;
    BEGIN
      l_selected := APEX_UTIL.STRING_TO_TABLE(:P3_ROLE);
      FOR iIN 1..l_selected.COUNT
      LOOP
        SELECT count(1) INTO l_num FROM sys.dba_roles WHERE role = l_selected(i);
        IF l_num = 0 THEN
          RETURN 'Role not exists';
        END IF;
      END LOOP;
      RETURN NULL;
    END;
    

    Kind regards
    Jari

  • A report of a multiple-selection list-based filtering

    Hey guys,.

    I have an interactive report that should be filtered by a value from a multiple selection list.
    AGENCY Multi-Select
    ----------------------
    ABC:DEF:GHI:DEF
    My question is, if there is a way to compare the: APP_USER to multiple selection list and have a line appears only if she does?

    For example something like a "where" clause
    where APP_USER is Contained within Colon Delimited List "AGENCY"
    See you soon,.
    Mauricio

    Select * from table_name
    where
    InStr (: multi_select_field_name,: app_user, 1) > 0

    Kind regards
    Shijesh

  • Point Set size dynamically the value of the corresponding select list

    Hi friends,

    Few days, before I learned a concept of change the size of the item dynamically according to the value of the selection using Jari list. I missed to ask him something (such as an extension of it).

    This is the thread

    {: identifier of the thread = 2282838}

    He produced the wonderful example below

    http://actionet.homelinux.net/htmldb/f?p=100:214:7956651650754287:NO:_

    Was that I missed in it, it possible to change the label of the element according to the selection list.

    According to the example, jari has limited the size of the element according to the selection list. Suppose that in this example if I select "China", im getting elements of different size and "India" means im get point of different size. But the labels of all the four elements are the same as

    attribute < li > 1
    attribute < li > 2
    attribute < li > 3
    attribute < li > 4

    As an extension, I need like assume that 'China' means that the label of the columns must be

    < Li > State
    < li > address
    < li > pincode
    < li > district

    If "India" is the label of the four elements must be

    < li > customers
    < Li > operators
    < li > units
    < li > provinces

    It is possible to generate different labels for the different size points, according to the value of the selection list. Since there are only four elements present in the database table.

    Brgds,
    Mini

    Hello

    Alter the table where you have point sizes and add the ITEM_LABEL column.
    Fill the column with the values you need for labels.
    Add the new column for the application process

    DECLARE
      l_sql VARCHAR2(32700);
    BEGIN
    
      l_sql := '
        SELECT item_name,
          item_size,
          item_label
        FROM demo_item_dyn_size
        WHERE lov_value = :P214_COUNTRY'
        ;
       APEX_UTIL.JSON_FROM_SQL(l_sql);
    
    EXCEPTION WHEN OTHERS THEN
      HTP.PRN('{"row":[]}');
    END ;
    

    And change something like JavaScript

    
    

    See working example
    http://ActioNet.homelinux.NET/HTMLDB/lspdemo?p=214

    Kind regards
    Jari

    Published by: jarola on 27 Sep 2011 19:39

    Corrected JavaScript.

  • By the way Select list value to another page via report link

    Hello

    I have a page 1001 with an item from the selection list (SLI), a button (BTN) and a report (EPR).

    After selecting a value of the element of selection it s possible to click on the button.

    After clicking the report button will display the data. Report structure: ID, COL1, COL2, COL3, COD values in COL1 is the links to the page 1011.

    I managed to pass the value of a column in the report, but how to pass the value of SLI this link?

    I tried: SLI, SLI, #SLI # and & SLI... but nothing has worked.

    You have an idea?

    1013248 wrote:

    Please update your forum profile with a real handle instead of '1013248 '.

    I have a page 1001 with an item from the selection list (SLI), a button (BTN) and a report (EPR).

    After selecting a value of the element of selection it s possible to click on the button.

    After clicking the report button will display the data. Report structure: ID, COL1, COL2, COL3, COD values in COL1 is the links to the page 1011.

    I managed to pass the value of a column in the report, but how to pass the value of SLI this link?

    I tried: SLI, SLI, #SLI # and & SLI... but nothing has worked.

    You have an idea?

    Use the exact static text substitution method to reference the value of the element. This requires an end point ('.) ») :

    &SLI.
    
  • Values of the cascading select list is not displayed because the ampersand &amp; in LOV

    Hello
    I use the LOV example Denes Kubicek http://htmldb.oracle.com/pls/otn/f?p=31517:119 cascading

    and I have a problem when my ename has an & in the name. In this case no values appear in the select list cascading. The application process, I use looks like this:

    < pre >
    BEGIN
    OWA_UTIL.mime_header ("text/xml", FALSE);
    HTP.p ('Cache-Control: non-cache');
    HTP.p ('Pragma: non-cache');
    OWA_UTIL.http_header_close;
    HTP.prn ("< select >");
    HTP.prn ("< option value ="' | 1 |) "" > ' | '- all employees-' | ' < / option > ");"

    FOR c IN (SELECT ename, empno
    WCP
    WHERE mgr =: cascading_selectlist_item_2)
    LOOP
    HTP.prn ("< option value ="' | c.empno |) '">' || c.Ename | ("< / option >");
    END LOOP;

    HTP.prn ("< / select >");
    END;
    < / pre >

    What should I change to make it work?
    Jacob

    Jacob,

    What happens if you change your application process on like this:

    DECLARE
       v_ename   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 ('');
    END;
    

    Do you still have the same result?

    Denes Kubicek
    -------------------------------------------------------------------
    http://deneskubicek.blogspot.com/
    http://www.Opal-consulting.de/training
    http://Apex.Oracle.com/pls/OTN/f?p=31517:1
    -------------------------------------------------------------------

  • 'shift' key does not work in the multiple selection table

    I created a table by dragging default datacontrol vo, the multiple value RowSelection, override the SelectionListener a manageBean method as follows:

    {} public void tableMakeCurrent (SelectionEvent selectionEvent)
    RowKeySet rks = selectionEvent.getAddedSet ();
    System.out.println (RKS. GetSize());
    Iterator it = rks.iterator ();
    {while (IT.hasNext ())}
    System.out.println (IT. Next());
    }
    }

    The problem is when I use 'shift' button help me select several lines, it will only print the last line, which I selected.

    Is there a way to fix this? Thank you...

    jdeveloper11.1.1.3

    for rowSelection multiple = to work with 'shift' you should not have the selectionListener or selectedrowkeys for your af:table
    http://www.adftips.com/2010/11/ADF-UI-implementing-multi-select-table.html
    delete selectedrowkeys and ownership selectionListener in the table and you will get select using the 'shift '.

  • Using AJAX code for the conditional selection list.

    Hello

    I use AJAX code for the first time, I have no knowledge in java, I got the code from this forum and try to manipulate my requirement.

    My requirement is that I have two selection lists, host_name) 1 and 2) database_name.
    As soon as I pick/choose the value of host_name select list, I need to fill in only the databases on this particular host. I don't want to send the page for this action.

    Here is the code, thank you if anyone can help.


    On request the code application process:
    -----------------------------------------------------
    declare
    number of l_counter;
    l_o_name varchar2 (2000);
    Start
    owa_util.mime_header ("text/xml", FALSE ");
    HTP.p ('Cache-Control: non-cache');
    HTP.p ('Pragma: non-cache');
    owa_util.http_header_close;
    HTP. PRN ("< select > '");
    for rec in (select "ORA_DATABASES_VW". "' Database_name ' as 'database_name ',.
    'ORA_DATABASES_VW '. "" DB_ID "as"DB_ID ".
    of 'ORA_DATABASES_VW '.
    where 'ORA_DATABASES_VW '. ("' HOST_NAME ' =: TEMP_ITEM)
    loop
    HTP. PRN ("< option value ="' | rec.db_id |) '">' || Rec.database_name | ("< / option >");
    end loop;
    HTP. PRN ("</select > '");
    end;

    Header HTML on this page:
    =================
    < script language = "JavaScript1.1" type = "text/javascript" >

    function get_List_XML (source_item, target_item) {}

    var v_Target = html_GetElement (target_item);
    var v_Source = html_GetElement (source_item);
    var ajaxResult = new htmldb_Get (null, & APP_ID, 'APPLICATION_PROCESS = POPULATE_LIST_XML', 0);
    ajaxResult.add ('TEMP_ITEM', source_item.value);
    var v_result_xml = ajaxResult.get ('XML');

    If (v_result_xml & & v_Target)
    {
    var options_Contents = v_result_xml.getElementsByTagName ("option");
    v_Count = options_Contents.length;
    v_Target.length = 0;

    for (var i = 0; i < v_Count; i ++)
    {
    var v_opt_xml = v_result_xml.getElementsByTagName ("option");
    appendToSelect (v_Target, v_opt_xml.getAttribute ('value'), v_opt_xml.firstChild.nodeValue)
    }
    }

    }
    function appendToSelect (target_item, option_val, option_content) {}
    var v_Opt = document.createElement ("option");
    v_Opt.option_value = option_val;
    {if (document. All)}
    target_item.options.Add (v_Opt);
    v_Opt.innerText = option_content;
    } else {}
    v_Opt.appendChild (document.createTextNode (option_content));
    target_item. AppendChild (v_Opt);
    }
    }
    < /script >


    Attribute of the form in the host_name column element. P935_INSTANCE_DB_NAME is my page for database_name.
    OnChange = "get_List_XML (this,"P935_INSTANCE_DB_NAME").

    Feel free to mark the answers useful or correct ;)

  • How to use the Multiple selection in ADF faces

    I have, I want to know how to use a multiple selection (ADF select several choices) for updating the database.

    by mentioning your exact jdev version.

    As far as I know he in not possible automatic update select a choice that she returns a list which you must map back to the lines of the table yourself.

    Timo

  • The MySQL Multiple selection list

    How to make multiple selections in the drop-down list in a form in Dreamweaver 8 and publish on MySQL?

    I tried using implode as recommended here: http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?forumid=12 & catid = 263 & threadid = 1112556 & highlight_key = y & keyword1 = multiple

    It worked unless the user did not select all the items in the list. Then, I got a bad argument error message.

    Then I tried just using POST without the implode and [] at the end of the name, but this put the word 'Picture' in the row/column in the database instead of the data.

    I then tried the POST with [the] on the chosen name and [] in the SQL statement: GetSQLValueString ($_POST [' devices [] ""], "text"), Dreamweaver wouldn't let me associate it under Insert a record in the section of the server behaviors - so nothing is put in the database.

    I need to be able to display multiple selected items in a list box for MySQL, but allow the user to select nothing in the drop-down list without receiving an error.

    Thank you very much for your help. In the end, he has worked with put the [] after the name and the following code:

    GetSQLValueString (isset($_POST['appliances'])? implode ("-", $_POST ['appliances']): "", "text")

Maybe you are looking for