Right way to delete row before insert

I create a new row with method of ViewObject.
Row row = viewObject.createRow();Then I want to delete this row. I found there are 4 methods. Which is the right answer?
//1.
row.remove();
//2.
row.refresh(Row.REFRESH_REMOVE_NEW_ROWS);
//3.
row.refresh(Row.REFRESH_FORGET_NEW_ROWS);
//4.
row.removeFromCollection();Thanks,

Timo, we're having a problem when deleting as you describe, maybe you can offer some advice?
We have a button to delete a row from an editable table, this is set to immediate=true (obviously the user should be able to skip validation when doing a delete). After deleting, if the user then clicks another button to add a new row, the values from the deleted row show in the new row :(
If we set immediate=false this seems to fix the problem, but we then get the undesirable side effect that the user has to make sure all the values in the row are correct before it can be deleted (because the validation is firing). The user experience becomes a bit strange.

Similar Messages

  • Fill multi row before insert

    hello guys I want to fill a block with multiple rows before inserting the rows data are from 2 blocks in the form I tried to use next_record , down but they are all restricted here an example of what I want to do
    I have block1 , block2 and block3 and I want to fill block3 with the first row of each block before inserting the data in the block3
    what should I do?
    Thanks in advance guys

    But MRU and MRD.... where is Multi-Row Insert?
    The MRU process does an update for existing rows and insert for new rows (that were added using the Add Row button)
    I was thinking about adding an extra value and adding a trigger to do the inserting instead
    Yes, a row-level trigger on the underlying table would be the best way to approach this problem. Let the APEX MRU and MRD processes do their job and your row-level trigger can keep inserting rows into a separate audit/history table with structure identical to the main table (plus sequence generated version number).
    Something like
    create table mytable_hist as select 'U' dml_action, 1 version_no,a.* from mytable a where 1=2;
    create or replace trigger mytrig
    after insert or update or delete on mytable
    for each row
    declare
    l_action varchar2(1);
    begin
      if inserting then l_action := 'I';
      elsif updating then l_action := 'U';
      elsif deleting then l_action := 'D';
      end if;
      insert into mytable_hist
      values
      l_action,
      version_no_seq.nextval,
      nvl(:new.col1,:old.col1), 
      nvl(:new.col2,:old.col2), 
      nvl(:new.col3,:old.col3), 
    end;
    /

  • Deleting Row Before Throwing JhdJboException

    I am using JHeadstart to develop UIX pages. Once a form is submitted on one of the pages, it creates a row in one of the database tables and begins to execute a java file we wrote. In the java file, there are certain times when a JhdJboException may be thrown. If the error is thrown, I want to delete the row that was created by submitting the form. I have tried locking the rows before I do the remove(), but I still get the same results.
    After the error is thrown, I go to check if the row has been deleted and it is still there. Is it possible that when the error is thrown, it is rolling back the remove() and restoring the row? Any advice on how to delete the row either before or after the error is thrown would be greatly appreciated. Thanks.
    -Susan
    Here's an example of the code I am using.
    Row periodRow = service.findViewObject("PeriodClosingsView1")
    .getCurrentRow();
    periodRow.remove();
    throw new JhdJboException("JHD-00104");
    This is what gets written in the OC4J log when I call the remove() method.
    06/05/17 10:19:17 Deleting row
    06/05/17 10:19:17 [20181] QueryCollection.afterRemove(2341) QueryCollection: afterRemove(0)
    06/05/17 10:19:17 [20182] ViewRowCache.removeReference(521) ViewRowCache: removeReference, vr id = 450
    06/05/17 10:19:17 [20183] server.QueryCollection(java) Column count: 9
    06/05/17 10:19:17 [20184] ViewObjectImpl.getPreparedStatement(7570) ViewObject: BilledMealTransactions1 Reusing defined prepared Statement
    06/05/17 10:19:17 [20185] ViewRowSetImpl.bindParameters(1629) Bind params for ViewObject: BilledMealTransactions1
    06/05/17 10:19:17 [20186] ViewRowSetImpl.bindParameters(1658) Binding param 1: 1
    06/05/17 10:19:17 [20187] ViewRowSetImpl.bindParameters(1658) Binding param 2: 1
    06/05/17 10:19:17 [20188] ViewRowSetImpl.bindParameters(1658) Binding param 3: 538
    06/05/17 10:19:17 Deleted row

    Susan,
    If I understand what you want: you insert a new row and commits, and remove the row and commits if your processing throws and exception.
    Probably you just forgot to commit after the remove() call. I don't know in which class you're implementing this method, but you should get the transaction and call commit. If you're inside an action method (which is not recommended):
    periodRow.remove();
    daContext.getBindingContainer().getDataControl().getApplicationModule().getTransaction().commit();
    throw new JhdJboException("JHD-00104");Where daContext is an instance of DataActionContext class.
    The best solution for your case (if you can) is simply not commit that new row until your business method finish processing without throwing an exception.
    Inserting and commiting, removing and commiting is not elegant. You should use your database capabilities of rolling back an uncommited transaction.
    Eduardo

  • What's the right way to delete an entire backup ?

    I've had two Macs doing wireless Time Machine backups to one Time Capsule.
    Question: I got rid of one Mac, and want to delete its backup entirely (but leave the other computer's backups untouched). What's the right way to do it?

    Bob Timmons wrote:
    Jespes, welcome to the discussions!
    Open your hard drive. Your Time Capsule icon should appear under the SHARED heading.
    Click on the Time Capsule and a folder will appear to the right.
    Double click the folder and you should see a xxxxxx.sparsebundle file for each computer that has been backing up.
    Click on the xxxxx.sparsebundle file that you want to delete to highlight it and then click the gear shaped icon just above. Select Move to Trash. (Do not drag the file to the Trash as this will not work).
    Be careful, as the file will be deleted instantly and you will not be able to retrieve it.
    many thanks!

  • Best way to delete data before sale of iMac

    I have created a new user with Admin privileges but I'm not sure where to go from there. I 'think' I have to delete all other accounts on the machine? But what about my data? Can it still be accessed? Should I run a utility to get rid of the current data or does the creation of a new user automatically get rid of the other data.
    As an aside, I was prompted for updates for software from the App Store. I was asked for my Apple ID & password. Do I have to Deauthorise that computer from iTunes before I sell it.
    So many questions, so little time!
    Thanks
    Brad

    Follow these instructions step by step to prepare a Mac for sale:
    Step One - Back up your data:
           A. If you have any Virtual PCs shut them down. They cannot be in their "fast saved" state. They must be shut down from inside Windows.
           B. Clone to an external drive using using Carbon Copy Cloner.
              1. Open Carbon Copy Cloner.
              2. Select the Source volume from the Select a source drop down menu on the left side.
              3. Select the Destination volume from the Select a destination drop down menu on the right
                  side.
              4. Click on the Clone button. If you are prompted about creating a clone of the Recovery HD be
                  sure to opt for that.
                   Destination means a freshly erased external backup drive. Source means the internal
                   startup drive.
    Step Two - Prepare the machine for the new buyer:
              1. De-authorize the computer in iTunes! De-authorize both iTunes and Audible accounts.
              2, Remove any Open Firmware passwords or Firmware passwords.
              3. Turn the brightness full up and volume nearly so.
              4. Turn off File Vault, if enabled.
              5. Disable iCloud, if enabled: See.What to do with iCloud before selling your computer
    Step Three - Install a fresh OS:
         A. Snow Leopard and earlier versions of OS X
              1. Insert the original OS X install CD/DVD that came with your computer.
              2. Restart the computer while holding down the C key to boot from the CD/DVD.
              3. Select Disk Utility from the Utilities menu; repartition and reformat the internal hard drive.
                  Optionally, click on the Security button and set the Zero Data option to one-pass.
              4. Install OS X.
              5. Upon completion DO NOT restart the computer.
              6. Shutdown the computer.
         B. Lion and Mountain Lion (if pre-installed on the computer at purchase*)
             Note: You will need an active Internet connection. I suggest using Ethernet if possible because
                       it is three times faster than wireless.
              1. Restart the computer while holding down the COMMAND and R keys until the Mac OS X
                  Utilities window appears.
              2. Select Disk Utility from the Mac OS X Utilities window and click on the Continue button.
              3. After DU loads select your startup volume (usually Macintosh HD) from the left side list. Click
                  on the Erase tab in the DU main window.
              4. Set the format type to Mac OS Extended (Journaled.) Optionally, click on the Security button
                  and set the Zero Data option to one-pass.
              5. Click on the Erase button and wait until the process has completed.
              6. Quit DU and return to the Mac OS X Utilities window.
              7. Select Reinstall Lion/Mountain Lion and click on the Install button.
              8. Upon completion shutdown the computer.
    *If your computer came with Lion or Mountain Lion pre-installed then you are entitled to transfer your license once. If you purchased Lion or Mountain Lion from the App Store then you cannot transfer your license to another party. In the case of the latter you should install the original version of OS X that came with your computer. You need to repartition the hard drive as well as reformat it; this will assure that the Recovery HD partition is removed. See Step Three above. You may verify these requirements by reviewing your OS X Software License.

  • How to delete data before insert in oracle database

    Hi friends,
    I have one scenario.I want to send data from sap to Oracle database.Befor i am inserting data in database table,i want to clean/delete all the records in the table .This interface will run twice in a day.Can any body help me.
    SAP-PI-JDBC
    Thanks
    Ravi

    Hi Puneet,
    As per u r suggestions,i am using stored procedure.But i am getting following error.
    Message processing failed. Cause: com.sap.aii.af.ra.ms.api.RecoverableException: Error processing request in sax parser: Error when executing statement for table/stored proc. MASTERXXXXXX' (structure 'Statement'): java.sql.SQLException: ERROR: Invalid XML document format for stored procedure: 'type="<SQL-type>"' attribute is missing for element 'NAME' (Setting a SQL-type (e.g. INTEGER, CHAR, DATE etc.) is mandatory !)'
    I have define below structure.Please check the structure and guide me.
    <Statement
            Action   attribute  required
            Table 
    Access  
            Empname   string
            Empid         string
            date            date
              Type     attribute   required
    EXECUTE----
    >Action
    Table----
    >MASTERXXXXXX
    Type----
    >char
    Please check the above structure andguide me to changes if any requires.
    Thanks
    Ravi

  • ALV - icon word processing there's a way to restrict rows before word open

    Hi everyone !
    I would like to get only rows that selected in the alv.
    how can i restrict which lines will be display in word ?

    someone can help ?

  • Resultset after insertion is the same before insertion

    hi guys, i get an updatable resultset from a connection then used it to insert a new row but the result set doesn't chane after insertion, i mean the no of rows before insertion is the same after insertion and also the data, this is the code prove what i say
              int currentRow = resultset.getRow();
              display(resultset);
              resultset.moveToInsertRow();
              for (int i = 0; i < fields.size(); i++) {
                updateCurrentRow(resultset, fields.getField(i));
              resultset.insertRow();
              display(resultset);the display function body is
            int currentRow = res.getRow();
            res.first();
            while (true)
              System.out.println("CountyCode= " + res.getInt(1));
              System.out.println("CountyName= " + res.getString(2));
              if (!res.next())
                break;
            res.absolute(currentRow);Please help me
    N.B.
    the type of resultset after creation it is res.getConcurrency() == ResultSet.CONCUR_UPDATABLE?????
    Thanks for your efforts

    thnaks for your reply, but when i used
    ownInsertsAreVisible() method; returned true, that is
    mean that the driver and DB supports the updating of
    reultset after insertion. but this is not real at my
    case? that was strange. if you have any comment please
    do,just checking the row is in fact being inserted into the database? i mean you can't see it right away but you can see it later right?
    if the row is being inserted and the ownInsertsAreVisible() returns true then there are two possible scenarios.
    1) the cursor type of your result set does not support that method, meaning the method is true in some cases but not yours... for example your query might have a join or something which makes it not possible for the result set do be fully cognizant of changes. and sometimes there are database specific cursors that have to specified as part of your query in a proprietary way to get the "right" cursor. you will need to investigate the docs for your database to figure out if any of this is true.
    2) the meta data is lying.

  • Loop through result set and delete row

    so here is what I need -
    I have a query that pulls rows from the Database through a stored procedure.(these are properties in an area)
    Before I start looping through the query, I need to check the distance between my current location and the property. If it less than 5 miles, only then should I display that property. The distance in miles will be chosen while submitting the search form.
    So is there a way to delete rows from the result set based on the criteria? Or
    Is there a better way to accomplish this? I am using the the google api to get the latitudes and longitudes. The other issue to keep in mind is the load time.
    Thanks

    You can do this the easy way or the hard way.  Depends on whether your condition that needs to be checked can be expressed in the form of a SQL where clause.  If it can, then do what BKBK suggested, and use a query of query to create a new resultset that only has the rows from the original resultset that don't meet your condition.
    If the calculation of the condition is more complex, then do a CFLOOP over the query and examine each row to see if you want to keep it or toss it.  if you want to toss it, the delete that row - there is a function in CFLIB.ORG called querydeleterow that should help you.  Or, you could just clear out the row's contents and then do the query of query as described in BKBK's post to create a new resultset that doesn't include the blank rows.

  • Delete row in database table

    Hi!
    Is there a way to delete row in database table by telling the number of the row?
    Thanx!

    Oh, sorry I didn't properly read your post.
    Try out what rvflannery suggests.
    But, for reference, you should always delete a row by it's unique ID.
    Don't go deleting things, by their position on a table, because a rows position can change.
    V

  • Deleting rows from a JTable

    Hello,
    I've got a JTable which is based on a 2-dimensional array, which contains my data. Now I want to delete several rows from the JTable. There's the possibility to modify my data-array by creating a new array which doesn't contain anymore the datasets I want to delete. Afterwards I can redraw the table and my rows are deleted. But I think that's a very complicated way to delete rows from a JTable. Can anybody tell me whether ther's an easier way to do so ? I'd really be pleased...
    Thanx,
    Findus

    When you create a TableModel using a two-dimensional array or a Vector of Vectors, a DefaultTableModel is created and it stores the data in its own Vector of Vectors. The DefaultTableModel supports methods for adding/removing rows of data. To remove the first row in the table you would do something like:
    DefaultTableModel model = (DefaultTableModel)table.getModel();
    model.removeRow( 0 );
    Note: once you create the TableModel you should set your array to null as it is not used anymore.

  • How Are Deleted Rows Tracked in Text Index?

    Does the database track this information in a table, or does it modify the record in the $I table and mark it as deleted. Just doing some analysis on an index that hasn't had the full optimization done to it in a while and want to know how I can get a count of deleted rows before I optimize so that I can troubleshoot this better in the future. Thanks!!

    Hi ,
    deleted documents are tracked in $N table. Use ctx_report.index_stats procedure to get more details about index fragmentation.
    Thanks,
    Edwin

  • Can I get handle to Database Row before an entity is deleted

    Hi,
    We are using stored procedure to list, insert , update and delete entity objects.To use the stored procedure I override the default queries generated by Toplink and make use of the stored procedure query.The issue here is that my Stored Procedure requires more arguments (like name of the user doing the insert) than there are fields in the entity.I need to provide these argument values to the call.For this I do something like
    session.getDescriptor(MyClass.class).getEventManager().addListener(new DescriptorEventAdapter(){
         public void aboutToInsert(DescriptorEvent evt) {
         evt.getRow().put("USER",evt.getSession().getProperty("username"));
    I set the username in the unitOfWork out of which I can grab the value in the eventHandler and put it inside the row just before insert.I do the same for modify too.But I dont see a similar methods for "delete".Do we have a aboutToDelete() method where I can get a handle to the row.The preDelete() does not provide a handle to the row.How can I insert additional arg values to the delete query?
    Thanks,
    Harini

    Hello Harini,
    Wow, you are correct there is no aboutToDelete, I guess manipulating the row before deletetion is not that common for our TopLink clients as this is the first request I have heard for it. I will add this request to our enhancement database. You might want to follow it up with support if it is a priority for you.
    As a workaround you could use the preDelete event to change the stored procedure call with the user name argument (i.e. build the procedure call dynamically in preDelete and set it into the query. The query will have been cloned at this point so there should be no concurrency issues. Make sure when doing this that you do not set the deleteQuery in the descriptor query manager as this will override the original query if set.
    Example:
    descriptor.getEventManager().addListener(new DescriptorEventAdapter() {
    public void preDelete(DescriptorEvent event) {
    StoredProcedureCall call = new StoredProcedureCall();
    call.setProcedureName("Delete_proc");
    call.addNamedArgument("P_ID", "ID");
    call.addNamedArgumentValue("USER", "scott");
    call.addNamedArgumentValue("TIME", new java.util.Date());
    event.getQuery().setCall(call);
    });

  • Deleting rows inserted after a particular time

    Oracle Database 11.2.0.3
    Linux  5.9
    Hi,
    I want  to know how to  delete  all rows  inserted into a  Table  after a particular time.
    For example,  I have a table  A  which contains  40,000  rows. 
    I  inserted  100,000 rows at  4:00  PM.
    And I want to know how to delete all those  100,000 rows. 
    Is there any way ?
    The database does not have Flashback enabled. It is running in NOARCHIVELOG mode.

    5b204196-d5cd-4a11-a266-0e8464667316 wrote:
    Oracle Database 11.2.0.3
    Linux  5.9
    Hi,
    I want  to know how to  delete  all rows  inserted into a  Table  after a particular time.
    For example,  I have a table  A  which contains  40,000  rows.
    I  inserted  100,000 rows at  4:00  PM.
    And I want to know how to delete all those  100,000 rows.
    Is there any way ?
    The database does not have Flashback enabled. It is running in NOARCHIVELOG mode.
    And does the table design include a column from which you could determine when the row was inserted?
    Here's what we know ...
    your database is in noarchivelog mode.  Therefore, whatever your backup strategy is, it will be essentially a point-in-time snapshot.  You will not be able to recover then roll-forward the database to the point in time immediately prior to this insert.
    your database is in noarchivelog mode.  Therefore, unless those insert statements are still in the online redo logs (extremely doubtful) you will not be able to leverage logminer.
    What kind of backups do you have?  When were they taken in relation to your insert?  What other activity occurred between that backup and that insert?  Can you afford to lose that activity as well?

  • Delete all data of a table in Oracle before insert operation in BizTalk.

    Hi,
    I need to delete all the data of a table from Oracle before insert data into it from BizTalk. I can't create stored procedure on the oracle table or how to create a xml of the delete schema of the oracle table in the BizTalk with filter node has a blank
    value because i need to delete all the data of the table so that i will send this xml as delete operation.
    Thanks in advance.
    Regards,
    Gyan

    You need to create two schemas: One for deleting all rows and one for inserting.
    Then combine these Schemas into one and use the "CompositeOperation" SOAP Action Header.
    Something like the below (a SQL Example, so the Schemas needs to be replaced by WCF-Oracle syntax)
    <Request xmlns="http://CompositeTest.CompositeSchema">
    <Delete xmlns="http://schemas.microsoft.com/Sql/2008/05/TableOp/dbo/Employee">
    <Rows>
    <Employee xmlns="http://schemas.microsoft.com/Sql/2008/05/Types/Tables/dbo">
    </Employee>
    </Rows>
    </Delete>
    <Insert xmlns="http://schemas.microsoft.com/Sql/2008/05/TableOp/dbo/Employee">
    <Rows>
    <Employee xmlns="http://schemas.microsoft.com/Sql/2008/05/Types/Tables/dbo">
    <Name>John</Name>
    <Designation>Manager</Designation>
    <Salary>100000</Salary>
    </Employee>
    </Rows>
    </Insert>
    </Request>
    Morten la Cour

Maybe you are looking for

  • Error in simple JNI project

    hi, I am new to JNI and I am trying a simple HelloWorld project but I am getting the following exception : Exception in thread "main" java.lang.UnsatisfiedLinkError: displayHelloWorld                at HelloWorld.displayHelloWorld(Native Method)     

  • Fade effect after inactivity in ADF 11.1.1.6 application

    Hello everyone, after a period of inactivity (about 10-15 minutes) in my ADF application (v. 11.1.1.6) the page is shown in semi-transparency mode with a little icon of warning on the bottom of the page. This fade effect disappears after a mouse move

  • Is the Ipad 2 compatible in Italy

    Hello, I would like to know the following things about the Ipad2 and its compatibility. 1. Is it compatible in Italy with their Wi-Fi? 2. To charge the Ipad, can it be charged on a non-apple computer? If not, is the electrical charging system compati

  • Query based LOV in an updateable report

    Hi, I have an updateable report which has a select box where the user can select "Item" I have another select box in the same report that needs to "update" its values according to the selected item. Is this possible? My first thought was to let the s

  • Help - Step by Step Material on How to load Data from flatfile to BI 7.0

    Hi BI Experts, Can any one send the document or a pdf file on how to load data from flat file to BI 7.0 in step by step process. Thanks in Advance Regards Ramakrishna Kamurthy +91-9963101073