Dml triggers can be defined for a combination of dml

Assignment Help Database Management System
Reference no: EM13818915

DML triggers can be defined for a combination of DML events by linking them together with the OR keyword. When a trigger is defined for multiple DML events, event-specific code can be defined using the INSERTING, UPDATING, DELETING flags.
Row level triggers can access new and existing values of columns using the ":NEW.column-name" and ":OLD.column-name" references, bearing in mind the following restrictions.

• Row-level INSERT triggers: Only ":NEW" references are possible as there is no existing row.

• Row-level UPDATE triggers: Both ":NEW" and ":OLD" references are possible. ":NEW" represents the new value presented in the DML statement that caused the trigger to fire. ":OLD" represents the existing value in the column, prior to the update being applied.

• Row-level DELETE triggers: Only ":OLD" references are possible as there is no new data presented in the triggering statement, just the existing row that is to be deleted.

Triggers can not affect the current transaction, so they can not contain COMMIT or ROLLBACK statements. If you need some code to perform an operation that needs to commit, regardless of the current transaction, you should put it in a stored procedure defined as an autonomous transaction.

DML triggers have four basic timing points for a single table.

• Before Statement: Trigger defined using the BEFORE keyword, but the FOR EACH ROW clause is omitted.

• Before Each Row: Trigger defined using both the BEFORE keyword and the FOR EACH ROW clause.

• After Each Row: Trigger defined using both the AFTER keyword and the FOR EACH ROW clause.

• After Statement: Trigger defined using the AFTER keyword, but the FOR EACH ROW clause.

Oracle allows you to have multiple triggers defined for a single timing point, but it doesn't guarantee execution order unless you use the FOLLOWS clause available in Oracle 11g.

Oracle allows more than one trigger to be created for the same timing point, but it has never guaranteed the execution order of those triggers. The Oracle 11g trigger syntax now includes the FOLLOWS clause to guarantee execution order for triggers defined with the

same timing point.

With the exception of Compound Triggers, the triggers for the individual timing points are self contained and can't automatically share state or variable information. The workaround for this is to use variables defined in packages to store information that must be in scope for all timing points.

Oracle 11g introduced the concept of compound triggers, which consolidate the code for all the timing points for a table, along with a global declaration section into a single code object. The global declaration section stays in scope for all timing points and is cleaned down when the statement has finished, even if an exception occurs.

A compound trigger allows code for one or more timing points for a specific object to be combined into a single trigger. The individual timing points can share a single global declaration section, whose state is maintained for the lifetime of the statement. Once a statement ends, due to successful completion or an error, the trigger state is cleaned up. In previous releases this type of functionality was only possible by defining multiple triggers whose code and global variables were defined in a separate package, but the compound trigger allows for a much tidier solution.

The triggering actions are defined in the same way as any other DML trigger, with the addition of the COMPOUND TRIGGER clause. The main body of the trigger is made up of an optional global declaration section and one or more timing point sections, each of which may contain a local declaration section whose state is not maintained.

Reference no: EM13818915

Questions Cloud

Determine components that pre-departure training will need : Determine four to six components that the pre-departure training will need to cover. Provide a rationale for the use of using the training components in question.
Auditing process and profession : Ethics plays a major role in the auditing process and profession. Discuss the ethical theories that can be utilized to deal with issues that can arise during the audit process. Address the following topics:
Discuss the benefits of using the expenditure : List and discuss the benefits of using the expenditure approach to measuring GDP. What does it measure well, and what things are not measured by GDP but are still important in our lives?
Presentation of interest on ted : Find a presentation of interest on TED and critique its content, visuals, and the presenter's skills (if applicable). Use this week's lecture to aid your analysis. Provide a citation to the presentation in APA format.
Dml triggers can be defined for a combination of dml : Normal 0 false false false EN-US X-NONE X-NONE DML triggers can be defined fo..
Determine two possible legal implications for a company : Determine two possible legal implications for a company in regard to employee benefits overall. Suggest two actions that a company should take in order to address these legal implications.
The best certification of a firm : ISO audits result in certifications that are done by first, second, or third parties. Which of the following result in the best certification of a firm?
Current market rate of interest impact time value of money : How does the current market rate of interest impact time value of money calculations? How can this aspect alter your current spending, savings, and budgeting patterns? How have you previously used the time value of money in your own personal financia..
Code of ethics and accounting : This topic, fraud, is an ongoing concern in any profession. Each profession needs to have a code of ethics and accounting seems to be the target to have very high ethics for the reason that they numbers that are presented to the public can affect ..

Reviews

Write a Review

Database Management System Questions & Answers

  How to use spool command

How to interactively query a database by using SQL statements and SQL*PLUS commands and how to use spool command to save an interactive session within SQL*PLUS.

  Order results by customers last name in ascending order

Only demonstrate those customers that have the word/partial word "mail" somewhere in the EmailAddress. Order the results by the customer's last name in ascending order.

  Find names of students who have higher gpa from table

List the students ID, name, GPA, and course Number such that all students have GPA greater than 3 . 5 and enrolled in a course in Jan 1, 2011. Find the names of all students who have GPA greater than 3.

  Prepare fully attributed data model

Use the results of the transcripts of an interview with IT consultant. Prepare a Fully Attributed Data Model. Add the data attributes for each entity."

  Return the empid firstname lastname for the employee

Return the empid, firstname, lastname, and city for the employee with empid 9. Return a list of employee id's, last names, and first names for employees hired on or after January 1, 2004. Retrieve the product name and unit price of all products that ..

  Database management challenge than relational database

What is it about a 200 MB video or audio file which makes it so much more of database management challenge than relational database the same size?

  Design scheme for determining wine bottle which poisoned

Design a scheme for determining exactly which one of the wine bottles was poisoned in just one month's time while expending O(logn) taste testers.

  How long is a clock cycle

Consider the timing diagram of Figure 12.10 in the 8th edition (or 14.10 in the 9th edition). Assume that there is only a two-stage pipeline (fetch, execute). Redraw the diagram to show how many time units are now required for four instructions.

  Write and execute a variety of queries

Write and execute a variety of queries, based on the introduction to SQL in this to test the functionality of the database. Provide a document listing the SQL query statement and a screenshot of the results. Submit a minimum of 8 queries and the r..

  Prepare a dfd and context diagram for the system

Journal entries have to be reconciled with the spreadsheet on a daily basis - Prepare a context diagram for the system and also prepare a diagram 0 DFD for the system

  Write functional dependencies in table concerns invoicing

Write the functional dependencies in the following table that concerns invoicing (an application Premiere Products in considering adding to its database), subject to the specified conditions.

  Create an entity-relationship diagram and design

create an entity-relationship diagram and design accompanying table layout using sound relational modeling practices

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd