Delete Multiple record in database block

hi to all,
i have one button. what i want if i press this button all the records that i selected from detail blocks will be deleted.
i used this code but i always received an error : FRM-40102: record must be entered or deleted first.
DECLARE
Num_Total_Records NUMBER;
Num_Loop_I NUMBER;
BEGIN
GO_BLOCK(<BLOCK_NAME>);
FIRST_RECORD;
LAST_RECORD;
Num_Total_Records := TO_NUMBER(NAME_IN('SYSTEM.CURSOR_RECORD'));
FIRST_RECORD;
FOR Num_Loop_I IN 1..Num_Total_Records LOOP
IF <CHECKBOX> = 1 THEN
if <condition> then
else
if <condition> then
else
end if
--condition is satisfied...deleted the selected record
delete_record;
commit;
end if
END IF;
NEXT_RECORD;
END LOOP;
<................................................>
END;

baguhan,
by this if u have selected all records, some records will won;t delete.
because as poelger said, delete_record will already skip 1 record.
so instead of the code u gave , its beter to all else portion in the condition and in the else portion gave the next record.
this is the your code modified
DECLARE
Num_Total_Records NUMBER;
Num_Loop_I NUMBER;
BEGIN
GO_BLOCK(<BLOCK_NAME>);
FIRST_RECORD;
LAST_RECORD;
Num_Total_Records := TO_NUMBER(NAME_IN('SYSTEM.CURSOR_RECORD'));
FIRST_RECORD;
FOR Num_Loop_I IN 1..Num_Total_Records LOOP
IF <CHECKBOX> = 1 THEN
--condition is satisfied...deleted the selected record
delete_record;
commit;
else
NEXT_RECORD;
END IF;
END LOOP;
<................................................>
END;
Regards,
Manu

Similar Messages

  • Delete multiple record in tabular with check box.

    Hello guys,
    I need your suggestion..
    I have master detail block. (INSTRUCTOR and SECTION)
    At detail block, I add check box item (name: RB_SECTION_ID) with Database Item "No", and value when check :SECTION_ID (on the property).
    I make a button DELETE. The trigger was DELETE from SECTION where section_id = :SECTION.RB_SECTION_ID and
    instructor_id = :INTRUCTOR.INSTRUCTOR_ID;
    but It not work.
    How we delete multiple record by check multiple check box then click DELETE button..??
    Regard.
    Nia..

    You datablock in the form cannot automaticaly refresh the changes you make with the SQL statements.
    For that you need to explicity call certain built-ins to refresh the data
    execute_query(no_validate) --> fetches the available data for that session. Here you deleted some records, so those records will not be available until you do a rollback in the same session(i.e, you exit the form without saving). But until you save, those deleted records will be avaiable for the users in other sessions)
    Also, your code works only because the records you deleted are all already saved ones.
    So it will be a good practice to use built-in of form builder rather than DML stmt.s
    Here you can do like this
    begin
    go_block('TRY_TABLE');
    first_record;
    loop
    if :TRY_TABLE.CCKBOX = 'Y' THEN
    delete_record;
    END IF;
    NEXT_RECORD;
    EXIT WHEN :SYSTEM.LAST_RECORD = 'TRUE';
    END LOOP;
    END;
    If your code is like above one, you can revert your deletion by simply giving a F7 (enter-query) and F8 (xecute query).

  • Urgent:                FORMS-III   Deleting Multiple Records By Marking X

    Deleting Multiple Records By Marking X
    In Forms III, i need to delete multiple records by marking X (in non database Item)
    i.e.
    ========================
    D Empno Ename Deptno
    ========================
    X 10001 ABC 10
    10002 DEF 10
    X 10003 GHI 20
    X 10004 JKL 20
    =======================
    How To Do????????????
    Rgds,
    Rashad

    Create a button say lable "delete" in a block other than the block from where u want to delete records.
    suppose the block's name is emp_blk
    now create a WHEN-BUTTON-PRESS trigger for delete button and write the following code
    begin
    go_block('emp_blk');
    first_record;
    loop
    if :emp_blk.d ='X' then
    delete_record;
    end if;
    if :system.last_record='TRUE' then
    exit;
    end if;
    next_record;
    end loop;
    end;
    filnally commit on save.

  • How to Save Multiple Records In Data Block

    Hi All,
    I Have Two Blocks --> Control Block,Database Block
    Please Any Idea How to Save Multiple Records In Data Block when User changed Data in Control Block.
    Thanks For Your Help
    Sa

    Now i have to use each record of control block(ctl_blk) as where condition in data base block(dat_blk)and display 10 records from database table.>
    Do you want this coordination to be automatic/synchronized or only when the user clicks a button or something else to signal the coordination? Your answer here will dicate which trigger to put your code in.
    As to the coordination part, as the user selects a record in the Control Block (CB), you will need to take the Key information and modify the Data Block's (DB) "DEFAULT_WHER E" block property. The logical place to put this code is the CB When-New-Record-Instance (WNRI) trigger. You code will look something like the following:
    /* Sample WNRI trigger */
    /* This sample assumes you do not have a default value in the BLOCK WHER E property */
    DECLARE
       v_tmp_dw    VARCHAR2(250);
    BEGIN
       v_tmp_dw := ' DB_Key_Column1 = '||:CONTROL.Key_Column1||' AND DB_Key_Column2 = '||:CONTROL.Key_Column_2;
       Set_Block_Property('DATA_BLOCK', DEFAULT_WHER E, v_tmp_df);
       /* If you want auto coordination to occur, do the following */
       Go_Block('DATA_BLOCK');
       Execute_Query;
       /* Now, return to the Control Block */
       Go_Block('CONTROL_BLOCK');
    END;
    The Control block items are assigned with values in Form level (Key_exeqry).If your CD is populated from a single table, it would be better to create a Master - Detail relationship (as Abdetu) describes.
    Hope this helps,
    Craig B-)
    If someone's response is helpful or correct, please mark it accordingly.

  • How to Delete Multiple Records using selectbox in jsf

    Hi!
    My Senario is I want to delete multiple records using checkbox. After selecting multiple records when i click the delete button the selected
    rows shuld be deleted.if am doing like this but the edit ,delete for each row functionality is not working.
    <h:selectBooleanCheckbox id ="bcb" value="#{item.empno}">
    </h:selectBooleanCheckbox>
    But other functionality is not wokring.
    Can any one plz tell how to select the multiple records and how to send the id to the serverside.
    I want code code for jsp and as well as backingBean how to accaess .
    Any Reply shuld be apreciated

    You may find this article useful as well: http://balusc.blogspot.com/2006/06/using-datatables.html
    Check the chapter "Select multiple rows" for two generic ways to select multiple rows in a datatable.

  • Deleting multiple records via html checbkoxes?

    I'm trying to delete multiple records in a table based on the
    selection of checkboxes.
    I have an html form with 4 checkboxes. If a user checks any
    box, I want to delete the associated records. and if they ucnheck
    something I want to insert multiple records. This form does not
    hold the primary keys but other unique parameters. Here is my sql
    statement.

    > and that keyword is not mentioned in the DELETE
    statement chapter.
    IN is not specific to DELETE statements. It can also be used
    with SELECT or UPDATE statements. It is a way of specifying
    multiple values in a single statement, instead of using multiple OR
    statements:
    http://www.w3schools.com/sql/sql_in.asp
    Since you are using cfqueryparam, you also need to use
    list="true" (ie you are passing in a list of values, not just one)
    <cfset listOfValues = "1,2,5,6,8">
    WHERE ColumnName IN
    <cfqueryparam value="#listOfValues#" list="true"
    cfsqltype="...">

  • How to delete a record in database it should be effect in XML

    In my application wheni insert a record in database it automatically inserted in XML now my problem is when i delete a record in database it should also effect in XML
    plz anybody anything knows about this reply me

    First up all, when u insert a record in database, how the data is inserted in xml file. Is there any application written for that?
    So when u delete the record from database,and want that same data should be deleted from the xml file, write a application to delete data from xml, and call that when u delete record from database.
    U can Write application using DocumentBuilderFactory.
    And using XQuery, you can delete data from xml.
    Hope this will help u.
    .....yogesh

  • To delete multiple records

    hi all,
    Can any tell tell me how to delete multiple records in table control of a screen
    i have checked the multiple rows in table control attributed and assigned a name.I needhelp in writing code.
    Thanks

    hi,
    As you have marked multiple fields in the table control your table control is mulple selection enabled.
    <b>PROCESS AFTER INPUT.</b>
    loop at IT_CONF.
        field X_CONF-CHECK
          module TC_CONF_mark on request.
      endloop.
      module TC_CONF_user_command.
      MODULE USER_COMMAND_0102.
    *this modifies the internal table with check field as X
    module tc_conf_mark input.
      data: g_tc_conf_wa2 like line of it_conf.
      if tc_conf-line_sel_mode = 1.
        clear g_tc_conf_wa2.
        loop at it_conf into g_tc_conf_wa2
          where check = 'X'.
          g_tc_conf_wa2-check = ''.
          modify it_conf
            from g_tc_conf_wa2
            transporting check.
        endloop.
      endif.
      modify it_conf
        from x_conf
        index tc_conf-current_line
        transporting check.
    endmodule.
    module tc_conf_user_command input.
    * write code to handle table control scrolling /pageup/pagedown
    endmodule
    *Check the ok_code
    module user_command_0102 input.
        case ok_code.
          when 'DEL'.
           * Delete from internal table where check = X
        endcase.
    endmodule.                
    <b>PROCESS BEFORE OUTPUT.</b> 
      module TC_CONF_change_tc_attr.
      loop at   IT_CONF
           into X_CONF
           with control TC_CONF
           cursor TC_CONF-current_line.
        module TC_CONF_get_lines.
      endloop.
    module tc_conf_change_tc_attr output.
      describe table it_conf lines tc_conf-lines.
    endmodule.
    module tc_conf_get_lines output.
      g_tc_conf_lines = sy-loopc.
    endmodule.
    Thus you will delete the marked lines from the internal table in PAI and in PBO you can read the refreshed internal table without the table entries that are marked as deleted in the table control and display the same in the table control. This is another way.
    Regards,
    Richa

  • Insert multiple records into database through internal table

    Hi
      please help me how to insert multiple records into database through internal table

    Hi,
    Welcome to SCN.
    Press F1 on INSERT statement and you will teh syntax as well the docu for the same.

  • Delete Multiple Records from Item Master

    Hi,
    We received wrong master data which has been uploaded and two groups have to be deleted. All the items in those particular groups have also to be deleted. Can anyone suggest how to delete multiple records from Item Master?
    Currently I am navigating through each Item and doing a Right Click + Remove. It is very painful given the huge number of records.
    Regards
    Sudatt

    Hi Sudatt.....
    I recommend you not to run any kind of delete or update SQL query as it harms DB.
    You can create your own front end application with the help of any technical consultant which can be
    achieved very easily. Else such problems create a big problem during upgradation to next version.......
    Regards,
    Rahul

  • Need to delete multiple records at a time

    Hi,
    My requirement is to delete multiple records at a time, i am using JDV11g and read only ADF table and rowSelection="multiple".
    i have taken command button and invoking the below method.
    RowKeySet rowKeySet = (RowKeySet)this.t1.getSelectedRowKeys();
    CollectionModel cm = (CollectionModel)this.t1.getValue();
    System.out.println("RowKeySet is: "+ rowKeySet.getSize());
    for (Object facesTreeRowKey : rowKeySet) {
    cm.setRowKey(facesTreeRowKey);
    JUCtrlHierNodeBinding rowData =
    (JUCtrlHierNodeBinding)cm.getRowData();
    System.out.println("RowData is : "+rowData.getAttribute("ParamValue7"));
    rowData.getRow().remove();
    Please do need full

    Hi,
    I don't understand what you mean by "+Please do need full+" , so I am ignoring this part. Here's a link that shows you best practices
    http://blogs.oracle.com/smuenchadf/examples/
    See example 134.
    Frank
    ps.: I suggest you bookmark the link

  • Please Help! Deleting multiple record by using checkbox selected

    Hello everybody,
    I am a new to JSP. I really don't know how to delete multiple record by using checkbox selected and pressing submit button.
    For example, deleting webmailbox letters using checkbox selected and delete button. The mail we checked will delete from the inbox.
    I like to use my user account deleting system of my project like above example.
    How can I do in JSP? I will very please you if you share you knowledge and code for me.
    If you have URL address, could you share me for reference?
    Please help me...
    With Thanks and Regards,
    wtdahl

    Take a look at this thread, I thing it answers your question quite good:
    http://forum.java.sun.com/thread.jsp?thread=516658&forum=45&message=2463505

  • How to delete a record in Database View?

    HI All,
    I have created a Database  View using tables LIKP,LIPS,VBUK,VBUP.
    In that view I am getting a extra record which is not exit in any tables
    but its getting in database view.
    I tried buffer memory refresh and even tried SE16n , SE11(thro CODE(DELE))..But record has not been
    deleted.
    Plz suggest wat shud i have to do to delete the record.
    Thanks in advance and help realy appriciate.
    Regards
    Steve

    >
    Steve Johnson wrote:
    > In that view I am getting a extra record which is not exit in any tables
    > but its getting in database view.
    Your intention should be in search of the root of that extra record. Not the deleting it without knowing anything.
    Sure, You have put join conditions correctly?
    Cheers

  • Insert Multiple records using Database adapter with Stored procedure func

    Hi All,
    I want to insert multiple records on a database using a stored procedure. I wanted to insert those records using a Database Adapter and the Database adapter should be invoked by a Mediator.
    Can somebody suggest me with ideas whether it can be acheived with OOB capabtilities in SOA suite or not?
    Thanks for your help in advance.
    Thanks,
    Shiv

    The use case you want to achieve is feature supported by the DBAdapter and it is possible to invoke the same from mediator.
    Please have a look at the oracle documentation and you should be able to get the necessary information.
    The below links should help you as well:
    http://download.oracle.com/docs/cd/E15523_01/integration.1111/e10231/adptr_db.htm
    http://blogs.oracle.com/ajaysharma/2011/03/using_file_adapter_database_adapter_and_mediator_component_in_soa_11g.html
    There are some video tutorials as well :)
    http://www.youtube.com/watch?v=dFldS-fDx70 This should also help
    Thanks,
    Patrick

  • Delete Multiple records in Table?

    Hi ..
    I need to perform delete operation in my table with multiple selection.
    My coding is..
    for(int i=wdContext.nodeDetails2().size()-1;i>=0;i--)
    if(wdContext.nodeDetails2().isMultiSelected(i) || wdContext.nodeDetails2().getLeadSelection()==i)
    wdContext.nodeDetails2().removeElement(wdContext.nodeDetails2().getDetails2ElementAt(i));
    When i delete first record, It works fine and multiple selection also works fine.
    But when i select last record(only one) to delete, Then All the records get deleted. ???? Why this happens???
    Anybody help to solve this probelm..
    Thnx in advance..
    Regards,
    GS

    Hi Sathish,
    Store the node size in a variable then try. To avoid problems with the index, the context is executed in reverse. Suppose in a table you have 10 rows and you are deleting row 2 the after deletion of row 2 row 3 will come to row 2,row 4 will come in row 3 in this way process will be continue up to last row.
    Try this.
    int n = wdContext.nodeDetails2().size();
    int leadSelected = wdContext.nodeDetails2().getLeadSelection();
    // loop backwards to avoid index troubles
    for (int i = n - 1; i >= 0; --i) {
    if (wdContext.nodeDetails2().isMultiSelected(i) || leadSelected == i) {
    wdContext.nodeDetails2().removeElement(wdContext.nodeDetails2().getDetails2ElementAt(i));
    Regards,
    Mithu

Maybe you are looking for

  • How to get 'List' view with playlist within Music

    The Music Ap is usually listed along the botton of iPad. With in that ap we have menus across the bottom of the screen. Within the 'Playlists' music I have thumb nail icon views only.  See below: I would like a 'list view' - no icons.  See below Wher

  • Object Reference not set to instance of Object when sub-report on new page

    I have a problem when my sub-report goes onto the second page of the report, with an error message. My VB.NET displays a report and sub-report (in the footer) in a CrystalReportViewer: - When both are on the first page, both display fine - When the s

  • Major Problem with kernel panic on new iMac: HELP!

    My housemates 24" core 2 duo imac kernel panicked when playing Call of duty 2 (side question: if anyone has any reason why it keeps freezing and the screen getting full of horizontal lines would love to hear from you) Now I can not start the computer

  • Dependency Injection - JAX-WS / Spring/ WebLogic 10.0.0

    I have an issue with Spring dependency injection not working in WebLogic 10.3.0. We are using WebLogic 10.3.2 (11gR1) in our development environment which uses technologies: JAX-WS web service and Spring. My webservice class extends SpringBeanAutowir

  • How to install SDK com into Delphi 7

    Hello All, I am a freshman about SBO, now I try to install the SDK com into my Delphi7, how to do? who can provide a sample? thanks for your help in advance.