Solved

AddNew and Update Methods

Posted on 2000-04-20
3
303 Views
Last Modified: 2010-05-02
Is it possible to fire a trigger on an Oracle database using the .AddNew and .Update methods or do you have to use INSERT - SQL statements.

Cheers...
0
Comment
Question by:DarrenD
  • 2
3 Comments
 
LVL 43

Expert Comment

by:TimCottee
ID: 2734090
The trigger should fire regardless of the method used to actually insert the data. As far as the Oracle DB is concerned, data has been inserted into the table and the appropriate trigger(s) will be fired. The .AddNew and .Update methods merely provide a mechanism to handle the creation of an implicit INSERT statement.
0
 

Accepted Solution

by:
mbkurtz earned 20 total points
ID: 2738408
When you call .AddNew in your VB code, Oracle will not fire any triggers.  This is because the new record is not actually added to the database until the .Update method is called.  
However, Oracle does have BEFORE INSERT and AFTER INSERT triggers that fire when .Update is called.  Since the before insert trigger is fired before the new record is added, you can use it to do any validation or anything you may have wanted to do when the .AddNew method was called.  It is also a great place to populate a PK field with a value from a sequence.
Once the record has been added to the database, the after insert trigger will fire.
0
 

Expert Comment

by:mbkurtz
ID: 2743903
mbkurtz changed the proposed answer to a comment
0

Featured Post

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question