Solved

AddNew and Update Methods

Posted on 2000-04-20
3
304 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

791 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