Insert and Delete at the same time?

Hi,
I have a dynamic list and dynamic form. When a person inserts a record using the dynamic form, I would like to delete a record from another table using a foreign key when the new record is added (assuming a record exists in the other table). Is this achievable, and if so, can anyone provide any help?
Thanks in advance for any advice provided.
Gary

As kendenny says, this appears to be a misunderstanding of how database transactions work.
As Hoek says, if it's an insert and delete on the same table, there is a MERGE statement that can help do that as a single statement.
However, you do not do an INSERT from one table and a DELETE at the same time from another table.  But that doesn't matter, because that's the point of logica transactions on a database.
You perform your insert, which starts a transaction (if one isn't already started).
You then delete from your other table (which adds to the transaction)
When you're happy that both things are done, you COMMIT your transaction which then applies those changes.
If you're not happy with something you can ROLLBACK, and that will undo all the changes from the transaction.
So, the commit and rollback allow the changes to be applied as one logical unit, even though the changes are applied in multiple steps.

Similar Messages

  • Can we use both INSERT and UPDATE at the same time in JDBC Receiver

    Hi All,
    I would like to know is it possible to use both INSERT and UPDATE at the same time in one interface because I have a requirement in which I have to perform both the task.
    user send the file which contains both new and old record and I need to save those in MS SQL database.
    If the record exist then use UPDATE otherwise use INSERT.
    I looked on sdn but didn't find any blog which perform both the things at the same time.
    Interface Requirement
    FILE -
    > PI -
    > JDBC(INSERT & UPDATE)
    I am thinking to use JDBC Lookup but not sure if it good to use for bulk record.
    Can somebody please suggest me something or send me the link of any blog or anything to solve this problem.
    Thanks,

    Hi ,
              If I have understood properly the scenario properly,you are not performing insert and update together. As you posted
    "If the record exist then use UPDATE otherwise use INSERT."
    Thus you are performing either an insert or an update which depends on outcome of a search if the records already exist in database or not. Obviously to search the tables you need " select * from ...  where ...." query. If your query returns some results you proceed with update since this means there are some old records already in database. If your query returns no rows  you proceed with "insert into tablename....." since there are no old records present in database.
      Now perhaps the best method to do the searching, taking a decision to insert or update, and finally insert or update operation is to be done by a stored procedure in MS SQL database.  A stored procedure is a subroutine available to applications accessing a relational database system. Here the application is PI server.   If you need further help on how to write and call stored procedure in MS SQL you can look into these links
    http://www.daniweb.com/web-development/databases/ms-sql/threads/146829
    http://www.sqlteam.com/article/stored-procedures-parameters-inserts-and-updates
    [ This part you can ignore, Since its not sure that you will face this situation
        Still you might face some problems while your scenario runs. Lets consider this scenario, after the stored procedure searches the database it found no rows. Thus you proceed with an insert operation. If your database table is being accessed by multiple applications (or users) other than yours then it is very well possible that after the search operation completed with a null result, an insert/update operation has been performed by some other application with the same primary key. Now when you are trying to insert another row with same primary key you get an error message like "duplicate entry not possible for same primary key value". Thus you need to be careful in this respect. MS SQL has a feature called "exclusive locks ". Look into these links for more details on the subject
    http://msdn.microsoft.com/en-us/library/aa213039(v=sql.80).aspx
    http://www.mssqlcity.com/Articles/Adm/SQL70Locks.htm
    http://www.faqs.org/docs/ppbook/r27479.htm
    http://msdn.microsoft.com/en-US/library/ms187373.aspx
    http://msdn.microsoft.com/en-US/library/ms173763.aspx
    http://msdn.microsoft.com/en-us/library/e7z8d5hf(v=vs.80).aspx
    http://mssqlserver.wordpress.com/2006/11/08/locks-in-sql/
    http://www.mollerus.net/tom/blog/2008/03/using_mssqls_nolock_for_faster_queries.html
        There must be other methods to avoid this problem. But the point is you need to be sure that all access to database for insert/update operations are isolated.
    regards
    Anupam

  • Issues when Insert and Analyze at the same time

    Hi All,
    We have a weekend job that used to take 12-15 hours usually and insert around 8 millions of records to a table from external table. Last weekend the same load took 60 hours and it move to Monday and there are some business impact.
    While we investigate the same issue we identified that there is one more weekend analyze job for all the tables and indexes and took around almost same time and we noticed that the table we inserted the 8 million records alone it took around 15 hours. This table now has around 91 Core records.
    We need to identify why this jobs taken long time as almost 4 times compare to the normal scenario.
    I would like to know what exactly happen when Analyze and insert happened to the table at the same time. And What all issues can occur because this.
    Best Regards,
    Shijo

    Ok,
    It is unclear what version you are using as you forgot to post that.
    Furthermore it is unclear what 'Analyze' is, as analyze statistics was already deprecated in 9i.
    Secondly, most people is this forum speak English, and they are accustomed international units only.
    Sybrand Bakker
    Senior Oracle DBA

  • How can I delete photos from my iPad, iPhone, and laptop at the same time?

    How can I delete photos from my iPad, iPhone, and laptop at the same time so I don't have to do it separately on each device?

    Photos that were synced from your computer using iTunes can only be deleted by de-selecting them from the folder from where they were synced -  and then re-syncing.
    Connect the iPad to the PC and launch iTunes.
    Click on the iPad name on the left side under devices.
    Click on the Photos Tab on the right.
    If you want to remove all of the Photos - uncheck the Sync Photos from Heading
    Click on Apply in the lower right corner of iTunes
    If you are using iTunes 11 - this will be helpful, Setting up syncing in Windows.
    http://support.apple.com/kb/PH12313

  • How do i delete email from my iPhone,ipad and computer at the same time?

    How do i delete email from my iPhone,ipad and computer at the same time?

    Go to http://support.google.com/mail/bin/answer.py?hl=en&answer=77702. It tells you how to set up gmail on iPhone.  Then go to gmail settings then "accounts and imports" and add your AT&T POP email account  to import mail from AT&T to gmail

  • How do i start video and audio at the same time in ios

    How do i start video and audio at the same time in ios?
    I have tried a lot of different ways but i cant figure it out?
    I can get the sound and animation (timeline) to start playing.
    There is no problem to start the video and the animation at the same time.
    But i cant get both the video and the audio to start playing when i press a button.
    It works great in OSX and on windows?
    Here is an example:
    // insert code for mouse click here
    // Play an audio track
    sym.$("_1")[0].play();
    // Play a video track
    sym.$("host")[0].play();
    // Play the timeline at a label or specific time. For example:
    // sym.play(500); or sym.play("myLabel");
    sym.play("marker1");

    If the game has sound in it (and possibly even if it doesn't) it may be overriding the Music app and causing it to stop playing - in which case there is nothing that you can do about it.

  • Problem with audio of my notebook. Audio works through pc speakers and earphones at the same time

    Hi all, 
    thanks in advance for your advices.
    I have a problem with my notebook (HP pavilion g6 2305 sl).
    The problem is that when I connect my earphones the audio of my pc don't stop, hence I can hear (music, film, ...) both by earphones and speakers at the same time.
    I tried to install again the latest driver audio, but nothing was changed.
    I tried to use another pair of earphones, but nothing.
    I have noted that if I connect the Jack at my pc, but not until the end, the audio stops from the speakers and goes through the earphones, but only if the jack is not completly inserted in the notebook.
    I read a lot of forum on the web but I'm not able to find a solution for my problem.
    (ps. the problem comes out suddenly, without any signal. I don't have installed any update or new software before the problem's start)

    Right click on speaker icon, lower right screen.
    Choose playback devices.
    Select "speakers and headphones" as your default.
    Disable "communications headphones".

  • Can I use Time Capsule and LaCie at the same time?

    Can I use Time Capsule and LaCie at the same time?

    stephaniefromarlington wrote:
    Before I answer your questions, let me first just say thank you so much for your amazing patience and helpfulness.  Whether or not we get to the bottom of this, I am very, very grateful to you. 
    We will get to the bottom of it, and you're quite welcome.  Don't feel you ought to know all this stuff -- none of us were born with it!
    By the way, in answer to your original question, yes, you can use the Time Capsule while backups are running. There's no conflict at all.
    1)  Estimated size of full backup:  205.94 GB
    2)  My LaCie has available:  11.04 GB of 359.95 GB
    That's part of the problem right there; 360 GB is a bit small to back up 206 GB.  Ordinarily, a Time Machine drive should be 2-3 times the size of the data it's backing-up, so Time Machine can keep a reasonable "depth" of old backups for you.
    It looks like Time Machine is trying to do a fairly large backup, and there just isn't enough room for it.
    But something doesn't quite add up.  Time Machine should have deleted all but your most recent backup, trying to make room for the new one.  But that would mean there should only be a bit less than 206 GB on the disk, not 360.
    A clue may be lurking in your logs.  Use the widget in #1 of Time Machine - Troubleshooting to display the backup messages from your logs.  Locate the backup in question, then copy and post all the messages here.

  • Backup to file system and sbt_tape at the same time?

    hello!
    is it possible to do a rman backup to disk and sbt_tape at the same time (just one backup, not two)? the reason is, that i want to copy the rman backup files from the local file system via robocopy to another server (in a different building), so that i can use them for fast restores in the case of a crash.
    if not, what is the recommended strategy in this case? backups should be available on tape AND the file system of a different machine.
    environment: oracle 10g, windows server 2008, commvault for backup on tape
    thanks for your advice.
    best regards,
    christian

    If you manually copy backupsets out of the FRA to another location, but still accessible as "local disks", you can use the CATALOG command in RMAN to "catalog" the copies.
    Thus, if you opy or move files from the FRA to /mybackups/MYDB, you would use
    "CATALOG START WITH /mybackups/MYDB" or individually "CATALOG BACKUPPIECE /mybackups/MYDB/backuppiece_1" etc
    Once you have moved or removed the backupsets out of the FRA, you must use
    "CROSSCHECK BACKUP"
    and
    "DELETE EXPIRED BACKUP"
    to update the RMAN repository. Else, Oracle will continue to "account" for disks pace consumed by the BackupPieces in V$FLASH_RECOVERY_AREA_USAGE and will soon "run out of space".
    You would do the same for ArchiveLogs (CROSSCHECK ARCHIVELOG ALL; DELETE EXPIRED ARCHIVELOG ALL) if your ArchiveLogs go to the FRA as USE_DB_RECOVERY_FILE_DEST

  • Tethering and Voice at the same time

    Is there a refence to show what models support using tethering and voice at the same time?

    I have the same problem with 2 iPhone 4S. When I'm only using data, download speed on 3G is 5.57Mbps, Upload 1.07Mbps and ping 79ms. As soon as I make or receive a phone call those speeds drop to:
    Download: 0.27Mbps
    Upload: 0.1Mbps
    Ping: 638ms
    With these speeds the web browser and all the other apps just keep trying to load or log in but nothing happens. As soon as I hang up, the speed goes back to normal. the problem is non existen while on wi-fi.
    AT&T triend to make some changes on the settings of my sim but itr didn't help at all. Just this morning I got a call from AT&T to let me know that the data speed is supposed top drop and that they don't make any promises as to the data speed, that their "talk & surf"propaganda only means that if you are using the internet, you can still receive phone calls....***? I never had this problem with the iPhones, 3G, 3Gs, 4. I asked them that I wanted to speak with somebody higher up or an enginner to discuss this issue but I'm still waiting to hear from them.
    The guys at apple were a little confused with this problem (I did reset the network settings but problem persisted, then reset all settings...nothing, then hard reset, restored from back up, deleted everything and set it up as new iphone...the problem is still there...) they asked if I could take the phone to the Apple store so they can run some advanced diagnostics...I'll have to take a road trip (closest Apple store is about 100 miles from my hometown)...Going on 1/5/2012....We'll see....

  • My Ipad mini does not see my printer. my wife's ipad2 does. We both use IOS8 and upgraded at the same time. How can I remedy this?

    My Ipad mini does not see my printer. my wife's ipad2 does. We both use IOS8 and upgraded at the same time. How can I remedy this?

    OK great info!
    I found 2 possible ethernet to USB adapters:
    By "Plugable":  USB 2.0 to ethernet LAN wired network adapter - seems this will work, but I'll contact Plugable.
    2. Apple USB Ethernet Adapter
    Easily connect your MacBook Air computer to an Ethernet network with the Apple USB Ethernet Adapter. Small and light, it connects to the USB 2.0 port of your MacBook Air and provides an RJ-45 connector that supports 10/100BASE-T performance.  BUT NOT SURE IF THIS WILL WORK ON ANYTHING BUT a MacBook Air…
    One person commented: 
    This little gem used to be the device of choice for adding a second Ethernet interface to a Mac Mini Server and I'd been using one that way for about a year. After doing a software update to 10.6.6 it stopped working. Forewarned is forearmed – it appears that Apple is finally enforcing the MacBook Air system requirement.
    Thanks for any additional comments.
    Best regards,
    Steve Schulte
    Sunday 6 January 2013

  • Recording Audio and Midi at the same time in Logic 7 Express Can it be done

    I am wondering if I can record audio and midi at the same time in Logic 7 Express. I am running my guitar thrugh a Roland GR 33, and a line out and using the GR 33 to trigger sounds in the Logic's synth section but cant seem to record all three tracks at once. If any one knows how let me know. Oh and I am running the GR Synth and Guitar into the Prosonus Fire Fox and have the GR 33 out midi to the Fire Box as well. So I guss the question is how do I sent up two audo tracks and one midi track to record in real time. Thanks Victor

    I am wondering if I can record audio and midi at the
    same time in Logic 7 Express. I am running my guitar
    thrugh a Roland GR 33, and a line out and using the
    GR 33 to trigger sounds in the Logic's synth section
    but cant seem to record all three tracks at once. If
    any one knows how let me know. Oh and I am running
    the GR Synth and Guitar into the Prosonus Fire Fox
    and have the GR 33 out midi to the Fire Box as well.
    So I guss the question is how do I sent up two audo
    tracks and one midi track to record in real time.
    Thanks Victor
    Try arming the audio tracks, select one of the tracks, then while holding down the shift key, select the midi track you want to record, arming the "r" on the midi track. Press "record".....
    HL

  • Can I use a camera for application in Labview and VBAI at the same time ?

    Dear all,
    I'm trying to save an AVI file with Labview and make an image process with VBAI at the same time, in one machine.
    The error : "Camera already in use" displayed.
    My Camera is a GIGE and I work with Imaqdx. I've test the multicast mode but it only operate with several machines.
    How can I do this ?
    Thank's to help me,
    Yoann B

    I'm not necessarily saying that.  It's been a while since I've used VBAI, so I don't remember all of the capabilities, but if VBAI can do the inspection and recording at the same time, you should be fine.
    The trick is that only one program can access the camera at the same time.  That application reserves the camera, thus making it unavailable to others.
    Chris
    Certified LabVIEW Architect
    Certified TestStand Architect

  • My SB Audigy 2 card can't use headset and musicamplifier at the same time

    Hi, i just bought a SB Audigy 2 [D400] and i have downloaded drivers and programs. I run Windows XP SP2.
    The soundcard works fine but it is very very annoying that i physically have to change the jack in the green=line out jack from headset to musicamplifier when i want to use my musicamplifier and change back the jack in the green=line out from musicamplifier to headset when i just want to use the headset/headphones .
    In the shop they told my that i can connect both amplifier and headset at the same time and then with creative software control whether there is sound in the headset or in the amplifier. But i can't simple get it work.
    I tried to use the green to the amplifier and the headset/speakers in the black (line out 2) and then with creative speaker settings softeware choose headphones but still the ampliefier receive the sound and no sound in the headphones. Why? In fact no matter what configuration i try the headphones doesn't work.
    But if i change the jacks so headset is in the green line out then only headset is working and the amplifier doesn't work no matter i put it in sort=line out 2 jack or orange=line out 3 jack.
    Can somebody here tell me if it is possible or not to connect both headset and external amplifier and control by software which to play? and how?
    please help, thx.
    Michael

    If you can have an ASIO compatible music playing system, then it might be possible to have system like you wish when using Creative Audigy 2 card. Since ASIO bypasses Windows Audio System, you can use both 'drivers' (ASIO - WDM/MME/DS) side by side.
    Say you want to play a game (using headset /w mic) and someone other like to listen music at the same time. With ASIO capable system you can output your music for example to "center L/R (stereo) channels" and same time output sounds from other source (using MME/DS/WDM drivers) to normal output channel (Front L/R). Only thing is, you need to set your speakersystem to 4 or 6 (depending which other channel you're using) (and for better 'balance' to adjust "angle" on THX console. You get the THX console by installing Audigy 2 Zs software).
    Try for example http://img332.imageshack.us/img332/463/djs9mo.jpg[/img] width="406" alt="Image Hosted by ImageShack.us" >
    Another option:
    Say you want to play music through external amplifier and play game online with your headset + microphone (eg. others but you listen the music, you play games)
    --> try free http://img332.imageshack.us/img332/4589/tbp7rz.jpg[/img] width="406" alt="Image Hosted by ImageShack.us" >
    If you use ASIO on BeatPort Player you can select L/R individually from the list(s). Same rules as described earlier.
    = You can play from 2 different sources simultaoneusly (ASIO + WDM/MME/DS) to two different outputs without disturbance. The other (WDM/MME/DS) source is set 'automatically' output to (Audigy) "green" port, and the other (ASIO) to "black" or "orange" port (as set).
    .jtpMessage Edited by jutapa on 09-5-2005 05:30 AM

  • Ipod nano (5th generation) - want to use headphones and charge at the same time

    I have an ipod nano (5th generation).  Do I need a special set of headphones to use the headphone jack and charge the ipod at the same time?

    The iPod nanos have a 30 pin dock connector and a headphone jack. When you charge the iPod you use the dock connector therefore you can use and charge at the same time. You cannot use and charge the iPod shuffle at the same time. You might have the two mixed up.

Maybe you are looking for