Halting the update from a BEFORE UPDATE trigger

Hello,
I'm writing a trigger which is set to fire before update. One of the possible scenarios requires that the row being updated is not updated but instead deleted. Is it possible to send a DELETE query and then stop the update process so it doesn't spit out an error? I haven't tested this yet, but I'm quite sure it will give an error if it's trying to update a row which has just been deleted.
Thanks,
Pavel

Hi,
Personally, I don't like implement some business logic into trigger... so, why run an update whenever you need a delete ?
I would modify the original code to delete in this case instead of update.
My 2 cents,
Nicolas.
SQL> create table pavel (id number, txt varchar2(10));
Table created.
SQL> insert into pavel values (1, 'This one');
1 row created.
SQL> ed
Wrote file afiedt.buf
  1  create or replace trigger pavel_trg
  2  before update on pavel
  3  for each row
  4  begin
  5  delete from pavel where id = :old.id;
  6* end;
SQL> /
Trigger created.
SQL> update pavel set txt = 'Two';
update pavel set txt = 'Two'
ERROR at line 1:
ORA-04091: table SCOTT.PAVEL is mutating, trigger/function may not see it
ORA-06512: at "SCOTT.PAVEL_TRG", line 2
ORA-04088: error during execution of trigger 'SCOTT.PAVEL_TRG'Message was edited by:
N. Gasparotto

Similar Messages

  • HT201210 My itouch screen froze showing "plug to itunes" after trying to update to iOS6. Is there any ways to export all the pictures from it before restoring?

    My itouch screen froze showing "plug to itunes" after trying to update to iOS6. It still can be turned on and off. But the screen froze showing that message. I perhaps need to restore it. But is there any ways to export all the pictures from it before restoring?

    Only if y can get the iPod out of recovery mode with the program. Otherwise you will have to restore via iTunes which erases the iPod.
    RecBoot: Easy Way to Put iPhone into Recovery Mode

  • How to delete the files from iPhone before selling?

    How do I delete the files from my old iPhone4 before selling?

    Hey adhot,
    Before selling your iPhone, you'll want to follow these directions:
    Before you sell or give away your iOS device, make sure that you have removed all of your personal information. Follow these steps to protect your data and get your device to its factory default state for the new owner:
    Back up your device.
    Go to Settings > General > Reset, then tap Erase All Content and Settings.
    This will completely erase your device and turn off iCloud, iMessage, FaceTime, Game Center, and other services.
    If you are using iOS 7 and have Find My iPhone turned on, your Apple ID and password will be required. After you provide your password, the device will be erased and removed from your account so that the next owner can activate it.
    Contact your carrier for guidance on transferring service to the new owner.
    When the device is turned on for the first time by the new owner, Setup Assistant will guide them through the setup process.
    Important: Do not manually delete contacts, calendars, reminders, documents, photo streams, or any other iCloud data while signed in to your iCloud account, or the content will also be deleted from the iCloud servers and all of your iCloud devices.
    via: What to do before selling or giving away your iPhone, iPad, or iPod touch
    http://support.apple.com/kb/HT5661
    Have a great day,
    Delgadoh

  • My iphone was dropped into water and now is frozen on the initialization screen. I would like to retrieve the photos from it before I send it back to the insurance company. Any advice?

    I have already tried to upload the photos through a computer that does not have iTunes installed because I am afraid that it will erase everything that is already on the phone. However, it states that the DCIM folder is empty yet the device only has 12 GB of memory free on a 40 GB so obviously there is data on the phone. My Verizon rep recommends just plugging it into iTunes. I have one computer that has not updated to iOS5. Any thought? Thanks in advance.

    You could use a third party app on your computer, that uses the iPhone as just an external disk.
    There are several like iExplorer, Diskaid, Phonedisk, etc.

  • Migrating from MSSQL2005: Before-Insert Trigger Generation

    The SQL Server 2005 tables with auto=incrementer primary keys result in sequence objects being defined for use in Before-Insert triggers, which is good. I see the following code in the generated triggers:
    <br>
    IF INSERTING AND :new.ofi_service_provider_id IS NULL THEN
    SELECT OFI_SERVICE_PROVIDER_ofi_servi.NEXTVAL INTO v_newVal FROM DUAL;
    -- If this is the first time this table have been inserted into (sequence == 1)
    IF v_newVal = 1 THEN
    --get the max indentity value from the table
    SELECT NVL(max(ofi_service_provider_id),0) INTO v_newVal FROM OFI_SERVICE_PROVIDER;
    v_newVal := v_newVal + 1;
    --set the sequence to that value
    LOOP
    EXIT WHEN v_incval>=v_newVal;
    SELECT OFI_SERVICE_PROVIDER_ofi_servi.nextval INTO v_incval FROM dual;
    END LOOP;
    END IF;
    </br>
    I'm guessing this is a boilerplate template. I'd like to replace this with my own template code, so the generated triggers meet our own in-house specifications. And that looping method of bumping up a sequence object's NEXTVAL is hideous!
    Is there a way to modify your template with my own, so I can generate the triggers according to our needs?
    - Dan Clamage

    I'm trying to generate the code to fit our shop. These Before-Insert triggers would need to be rewritten for our environment. The template provided doesn't suit our needs. It'd make more sense if it was picked up from a text file, or at least presented on a Preferences screen, with placeholders for the sequence object name. Then a developer could tweak it to suit their own shop's needs, and have it generated correctly from the migration.
    This migration isn't a one-time deal for us. We'd be doing it over and over.

  • Paramerterized Interactive Reports - when running or clicking on a specific page how can I stop the report from rendering BEFORE the user enters parameters.

    I wasn't able to display in pic in this post 
    But it would look something like this
    Order type  -ALL- (select list)                GO (button)
    When I come into this page - the report renders ALL the data because the SQL is as follows
      AND ol.unit_selling_price <> 0
               AND(ordertype.transaction_type_id = :P1_TEXT OR :P1_TEXT IS NULL)
                ORDER BY   3
    Its setup this way because I want all records returned if the user makes no selections BUT CLICKS the "GO" or "SEARCH" button.
    I just don't all records rendered upon initial screen entry and without user having selection options....I.E initiate via a button.
    Thanks

    Hi,
    Here is what you can do with out any hidden items.
    on report condition select request = e1
    and enter  GO
    Now when you hit the Go button which actually submits the page to perform the search right?
    Now create a branch and redirect to same page and in REQUEST enter: GO  (But make sure you are selecting when GO button clicked and make it first branch if you have any unconditional branches)
    So the report will be seen by the user only when he hits the GO button from that screen.
    Simple enough right?
    Thanks,
    Ramesh P.

  • Update trigger is not working...

    Hi
    I am writing an update trigger.
    We have a two DB, one is application DB and other is reporting DB. We are writing trigger on Reporting DB. There is a job schedule for synchronizing the application data to reporting DB , this daly basis synchronization. So when the synchronization runs and if the FUNDING_RULE_TABLE is updated them my trigger gets called.
    CREATE OR REPLACE
    TRIGGER COMM_EXISTING_REP_TRIGGER AFTER UPDATE OF FR_IR_NAME ON FUNDING_RULE_TABLE
    DECLARE
    serialno INTEGER;
    CURSOR C_CES_REP IS
    Select distinct FR_IR_NAME,FR_IR_CODE from FUNDING_RULE_TABLE ;
    V_IR_NAME FUNDING_RULE_TABLE.FR_IR_NAME%TYPE;
    V_IR_CODE FUNDING_RULE_TABLE.FR_IR_CODE%TYPE;
    CURSOR C_CES_COMIT IS
    SELECT DISTINCT FR_IR_NAME1,FR_IR_CODE from COMM_EXSTS_COMIT_AGGR;
    IR_NAME VARCHAR2(20);
    IR_CODE VARCHAR2(10);
    BEGIN
    OPEN C_CES_REP;
    LOOP
    FETCH C_CES_REP INTO V_IR_NAME,V_IR_CODE;
    IF C_CES_REP%NOTFOUND THEN
    EXIT;
    END IF;
    OPEN C_CES_COMIT;
    LOOP
    FETCH C_CES_COMIT INTO IR_NAME,IR_CODE;
    IF(V_IR_CODE = IR_CODE AND V_IR_NAME = IR_NAME) THEN
    EXIT;
    ELSE
    update COMM_EXSTS_COMIT_AGGR set FR_IR_NAME1 = IR_NAME where FR_IR_CODE = IR_CODE;
    END IF;
    END LOOP;
    CLOSE C_CES_COMIT;
    END LOOP;
    CLOSE C_CES_REP;
    END COMM_EXISTING_REP_TRIGGER;
    The problem is:
    When the synchronization runs the trigger will gets called and the synchronization prc never stops because of the table locks.
    1)     why some tables are getting locks? (I think this is becuse some source is waiting for another to release-deadlock)
    2)     Is there any problem in trigger? (I think there is some problem is trigger)
    3)     When I comment below part then sync procedure works fine
    OPEN C_CES_COMIT;
    LOOP
    FETCH C_CES_COMIT INTO IR_NAME,IR_CODE;
    IF(V_IR_CODE = IR_CODE AND V_IR_NAME = IR_NAME) THEN
    EXIT;
    ELSE
    update COMM_EXSTS_COMIT_AGGR set FR_IR_NAME1 = IR_NAME where FR_IR_CODE = IR_CODE;
    END IF;
    END LOOP;
    CLOSE C_CES_COMIT;
    It menas that there is somr problem in trigger because i am reading and updation is performed on the same table "COMM_EXSTS_COMIT_AGGR ".
    Is this is the problem?
    waitting for ur rply...thx..
    Edited by: 931005 on Apr 30, 2012 2:38 AM

    Welcome to the forum!
    Whenever you post provide your 4 digit Oracle version (result of SELECT * FROM V$VERSION).
    >
    1) why some tables are getting locks? (I think this is becuse some source is waiting for another to release-deadlock)
    >
    Because you have an UPDATE statement in your inner loop that may lock one or more rows that are updated.
    >
    2) Is there any problem in trigger? (I think there is some problem is trigger)
    >
    Many problems
    1. The outer query queries the same table that the update trigger is updating. So some rows may never get seen; rows inserted or updated by other sessions. This means the DISTINCT results may not be distinct at all.
    2. The cursors select into SCALAR variables so if either cursor returns more than one row the trigger will raise an exception.
    3. The nested cursor loops could be replaced by a simple update statement.
    4. The original issue of updating the same table queried by your cursor.
    Whatever it is you are trying to do - this isn't the way to do it.

  • I updated my iPad 2 OS to iOS 6.0..after that I am unable to download or update anything from the App Store. The MSG I get is "id not valid for US store. Go to Indian store for purchase"..never faced this problem earlier before the update to OS 6..help!!

    I updated my iPad 2 OS to iOS 6.0..after that I am unable to download or update anything from the App Store. The MSG I get is "id not valid for US store. Go to Indian store for purchase"..never faced this problem earlier before the update to OS 6..help!!

    Apple's response to my email:
    "I understand that you can't update your apps using your iPad.
    Apple is currently working toward a resolution for the issue you have reported. You will receive an email after the matter has been investigated and further information is available.
    Thank you for your patience. Apple wants your iTunes experience to be as enjoyable as possible. Have a great day!"

  • Deactivate delta update before deleting the request from ODS

    Hi all,
    Happy New Year wishes to all.
    I have a scenario, where I am feeding the data to ODS from flat file and from ODS to Cube. Here ODS is a Data mart. Flat file to ODS full update and ODS to Cube First Initialization and Delta.
          I deleted the latest request from ODS, at the I got the message dialog box and it is saying that
    “Request 98888 already retrieved by data target BWVCLNT”
    “Delta update in data target BWVCLNT must be deactivate before deleting the request
    “Do you want to deactivate the delta update in data target BWVCLNT?
    So I pressed Execute changes, then after I loaded the data in to ODS and when I am trying to load the data into Cube, once I pressed execute button it is displaying the message dialog box like
    “Delta request is incorrect REQXXXXXXX in the monitor”
    “A repeat needs to be requested”
    “Data target still include delta request REQXXXXX”
    “If the repeat is now loaded, then after the load”
    “There could be duplicate data in the data targets”
    “Request the repeat?”
    After execute changes it is showing only “zero” Records only.
    What is that mean and why zero records it is displaying instead of delta records.
    Anybody faces this type of problem please let me know. This is somewhat urgent to me
    Thanks and Regards
    Satish Chowdary

    <i>Hi Satish,
    First Switch off the ODS ( automatic Update of Datatarget ) , though not really necessary. delete the Req from the Infocube, then delete from the ODS . Now delete the Init Req from the Infopackage for datamart infopackage.then Do an Init without datatransfer into Infocube. Later load data into ODS and then go for delta update to Infocube.
    I hope this helps.
    Thanks,
    Krish
    Dont Forget to assign Points.</i>
    Dude, you just repeated my answer I gave a few hours ago. Are you hungry for points?

  • Should I update to the newest iPhoto from Mavericks, before installing Yosemite?

    I have a 13" MacBook Pro with a 2.4GHz Intel Core Duo processor, 16 GB memory (1607 MHz DDR3), and a 1 TB Samsung SSD hard drive.  I have Mavericks 10.9.5 on it, and iPhoto 8.1.2 (iPhoto '09).  I'm about to update to Yosemite, but I've read about people having problems with iPhoto and iPhoto Library after the update.  Should I update to the newest version of iPhoto before updating to Yosemite?  Is there anything else I should know about installing these updates?

    I'm puzzled about why there aren't more questions like mine ("No similar content found")
    Two possibilities there: one is that you've phrased the question in a way different from other posters with the same issue or not very many people have the issue.
    and why Apple hasn't put more info/help files out there about the havoc that can be wrought upon iPhoto libraries if app and system software updates are not done in the correct order.
    I'm really not sure what you're referring to here. You can't update to iPhoto 9.6 unless you're already on 10.10. There simply is no way to do it in the 'wrong order'. And there is no evidence that the order of updating makes a whit of difference to a Library anyway. You may have read about people having problems after an update - read more. There are always people who have issues after updates - updates of any app on any OS. The reasons can vary widely - everything from pre-existing issues on the host machine, faulty download, faulty installer, minor directory and disk damage. So, I really would not read too much into it.

  • How can i say yes to automatic updates when they stop my wireless dlink to Virgin home broadband from getting on the internet and then i have to do a system restore to the day before the update to get it back to normal?!? Frustrated

    how can i say yes to automatic updates when they stop my wireless dlink to Virgin home broadband from getting on the internet and then i have to do a system restore to the day before the update to get it back to normal?!? Frustrated
    == This happened ==
    Not sure how often
    == automatic updates go on my computer, say if i click yes to update when shutting down

    You have 10.6 on that machine, I suggest you stick with it for performance, third party hardware and software reasons as long as possible.
    Consider 10.8 (not 10.7) when it's released, because 10.7 and 10.8 will require a new investment in software and newer third party hardware as it requires newer drivers the old machines won't have. (forced upgrade because of software, really nice of them)
    http://roaringapps.com/apps:table
    Far as your Safari problem do these things until it's resolved:
    1: Software Update fully under the Apple menu.
    2: Check the status of your plug-ins and update (works for all browsers) also install Firefox and see if your problems continue. You should always have at least two browsers on the machine just in case one fails.
    https://www.mozilla.org/en-US/plugincheck/
    Flash install instructions/problem resolution here if you need it.
    How to install Flash, fix problems
    3: Install Safari again from Apple's web site
    https://www.apple.com/safari/
    4: Run through this list of fixes, stopping with #16 and report back before doing #17
    Step by Step to fix your Mac

  • Had a problem with newest update and the advice from turingtest2 resolved my problem just to say thanks! Had never used this route before so was less painful than thought it would be again thanks.

    Had a problem with newest update and the advice from turingtest2 resolved my problem just to say thanks! Had never used this route before so was less painful than thought it would be again thanks.

    how can i find out what the fix is that works..please

  • I have a problem to update iMovie 9.0.9. The OS is running really slow and halts from time to time. In the update procedure it says it's one minute left. That was one hour ago... What can I do?

    I have a problem to update iMovie 9.0.9. The OS is running really slow and halts from time to time. In the update procedure it says it's one minute left. That was one hour ago... What can I do?

    I have a problem to update iMovie 9.0.9. The OS is running really slow and halts from time to time. In the update procedure it says it's one minute left. That was one hour ago... What can I do?

  • Update showing up in "Compliance 5 - Specific Computer" Report even after removing the update from the Software Update before creating Group and Package

    So I've created a Software Update Group and I did NOT want anything in there dealing with Internet Explorer 11 since the organization is currently stuck at using 10 as the highest. So I made sure that Internet Explorer was NOT in the list and then I deployed
    the package. 
    After running my Overall Compliance report it shows that the systems are compliant, but when I view the "Compliance 5 - Specific Computer" I see that "Internet Explorer 11 for Windows 7 for x64-based Systems" is listed in the report. 
    This is just a testing phase right now and I have not created a WSUS like Domain level GPO. I understand that the SCCM client creates a local policy on the clients for the location of the Software Update Point (Specify
    Intranet Microsoft update service location), but the "Configure Automatic Updates" policy is set to Not Configured, which it looks like when this
    is set, the "Install updates automatically (recommended)" at 3AM is the default. 
    Is the reason why the "Internet Explorer 11 for Windows 7 for x64-based Systems" update is showing up in the list due to the fact that the "Configure
    Automatic Updates" policy is set to Not Configured
    and therefore it is still reaching out to check Windows Update online? 
    So, if I do create a Domain level GPO to Disable the "Configure
    Automatic Updates" policy, then the "Internet Explorer 11 for Windows 7 for x64-based Systems" update would not show up in the "Compliance 5 - Specific Computer" report?
    By the way, I have a Software Update Maintenance Window configured for the hours of 1AM-4AM so the 3AM default time falls within this time frame, therefore, I am assuming the SCCM 2012 client will not allow the Windows Update Agent to install the "Internet
    Explorer 11 for Windows 7 for x64-based Systems" update, even though it has detected it is "Required". 
    Thanks

    But, don't you need a Deployment Package in order to deploy the Software Update Group? The Software Update Group uses the downloaded updates contained in the Deployment Package located in, wherever the Package Source is, right?
    One more quick question that you will know right off hand, because, well, you just will I'm sure.
    No. The software update group really has nothing to do with any update packages. The update group assigns updates to clients and in turn clients use update packages to download assign and applicable updates from. There is no connection between the two though
    as the client can download an update from any available update package. Thus, it's more than possible to updates in an update package that are not in any update groups and it is also possible for an update to be in an update group without being in any update
    package.
    If the "Configure Automatic Updates" policy is set to "Not Configured" and since this keeps the 3AM Automatic Updates default, if I was to remove the Software Update Maintenance Window from being between 1AM-4AM, will the WUA agent install updates
    at 3AM, or no because the SCCM 2012 client still manages and oversees it and basically blocks that from occurring?
    No, ConfigMgr does not in any way block the WUA; however, the WUA can only autonomously install updates it downloads directly from WSUS. Thus, since there are no updates approved or downloaded in your WSUS instance, there's nothing for it to download and
    install. If you happen to actually be going into WSUS and approving updates (which you should not be doing as its unsupported), then yes, it actually would install updates -- this is outside of ConfigMgr's control though. Generally, disabling the WUA via a
    GPO is the recommended to prevent any accidental installations or reboots (as the WUA wil also check for initiate pending reboots outside of ConfigMgr).
    Lots more info in these two blog posts:
    - http://blog.configmgrftw.com/software-update-management-and-group-policy-for-configmgr-what-else/
    - http://blog.configmgrftw.com/software-updates-management-and-group-policy-for-configmgr-cont/
    Jason | http://blog.configmgrftw.com

  • There are 13GB "other" data that I cannot account for that simply did not exist before the update. Where is it coming from and how can I get rid of it?

    After the update, 13GB of "other" data mysteriously shows up on my phone when it tries to sync; It's literally more than half the available space on my phone. I've deleted SEVERAL apps (including the apps it tried to sync from my iPad), I've removed most of my music and videos.
    I can account for the rest of the data on the phone EXCEPT for the 13GB of "other".
    Is anyone else experiencing this?

    Yes, I have the same 13 GB "other" after updating from IOS 4 to IOS 5.
    I posted the follow-up question, which is:
    What can I do about this? Can I clear it without doing a restore?
    If I do a restore, can I then re-install my apps and music from my iMac?

Maybe you are looking for

  • Can I hotsync more than one user calendar on my Centro?

    I have a Macbook and just acquired a Centro (ATT). I have about 3 users in my Palm Desktop program and would like to hotsync them all to my Centro. Possible? How? and if so, how do I switch between them to view them? TIA, Tim  Post relates to: Tungst

  • Application Server Control in SOA not working

    Hi All, I want to start the bpel services and was able to start only two services : Processes in Instance: BPELDEV.ghoapd01.boardwalk.corp --------------------------------------------------------------+--------- ias-component | process-type | pid | s

  • Half the internet unavailable, i.e. google no, hal...

    Hi, I'm having trouble connecting to most websites google, ebay, saainsbury's, festive-sparkle, but this one is ok, I know through facebook that someone else in the near locality is also having the same issues. Location is Bridgwater Somerset. 1x har

  • Captivate 4 export to Flash CS4

    Hi, I am encountering a few problems with Adobe Captivate 4: - In the previously version it was possible to export a project into different smaller swf files. Is this also possible in Captivate 4? - I am trying to export my project to Flash CS4 but I

  • Xcelsius - Bex Query

    Hi all, How can create Dashboards by using SAP Bex Query (without using universe ) How can get SAP Netweaver BI Connection type in Xcelsius