Murach’s Oracle SQL and PL/SQL, C16© 2014, Mike Murach & Associates, Inc.Slide 1 Thursday, March 12, 12:30 – 13:30PM. MIDTERM.

Slides:



Advertisements
Similar presentations
Murach’s SQL Server 2008, C6© 2008, Mike Murach & Associates, Inc.Slide 1.
Advertisements

SQL for SQL Server, C6© 2002, Mike Murach & Associates, Inc.Slide 1.
Murach's PHP and MySQL, C3© 2010, Mike Murach & Associates, Inc.Slide 1.
Murach’s SQL Server 2008, C1© 2008, Mike Murach & Associates, Inc.Slide 1.
Murach’s Java SE 6, C2© 2007, Mike Murach & Associates, Inc.Slide 1.
Murach’s Java SE 6, C1© 2007, Mike Murach & Associates, Inc.Slide 1.
Murach’s SQL Server 2008, C4© 2008, Mike Murach & Associates, Inc.Slide 1.
Murach’s Beg. Java 2, JDK 5, C17© 2005, Mike Murach & Associates, Inc.Slide 1.
Murach’s Beg. Java 2, JDK 5, C11© 2005, Mike Murach & Associates, Inc.Slide 1.
Murach’s Java Servlets/JSP (2 nd Ed.), C19© 2008, Mike Murach & Associates, Inc.Slide 1.
Murach’s Beg. Java 2, JDK 5, C13© 2005, Mike Murach & Associates, Inc.Slide 1.
Murach’s Java Servlets/JSP (2 nd Ed.), C15© 2008, Mike Murach & Associates, Inc.Slide 1.
Murach’s JavaScript, C5© 2009, Mike Murach & Associates, Inc.Slide 1.
Murach’s Java Servlets/JSP (2 nd Ed.), C24© 2008, Mike Murach & Associates, Inc.Slide 1.
Murach’s Java Servlets/JSP (2 nd Ed.), C17© 2008, Mike Murach & Associates, Inc.Slide 1.
Murach’s JavaScript, C2© 2009, Mike Murach & Associates, Inc.Slide 1.
Murach’s JavaScript, C13© 2009, Mike Murach & Associates, Inc.Slide 1.
Murach’s Java Servlets/JSP (2 nd Ed.), C23© 2008, Mike Murach & Associates, Inc.Slide 1.
Murach’s Beg. Java 2, JDK 5, C19© 2005, Mike Murach & Associates, Inc.Slide 1.
Murach’s JavaScript, C1© 2009, Mike Murach & Associates, Inc.Slide 1.
Murach's C# 2012, C7© 2013, Mike Murach & Associates, Inc.Slide 1.
Murach’s Java Servlets/JSP (2 nd Ed.), C14 © 2008, Mike Murach & Associates, Inc.Slide 1.
Murach’s Beg. Java 2, JDK 5, C18© 2005, Mike Murach & Associates, Inc.Slide 1.
Murach’s Java SE 6, C7© 2007, Mike Murach & Associates, Inc.Slide 1.
SQL for SQL Server, C13© 2002, Mike Murach & Associates, Inc.Slide 1.
SQL for SQL Server, C4© 2002, Mike Murach & Associates, Inc.Slide 1.
©Silberschatz, Korth and Sudarshan5.1Database System Concepts - 6 th Edition Triggers Chapter 5.
SQL for SQL Server, C7© 2002, Mike Murach & Associates, Inc.Slide 1.
Murach’s SQL Server 2008, C10© 2008, Mike Murach & Associates, Inc.Slide 1.
SQL for SQL Server, C16© 2002, Mike Murach & Associates, Inc.Slide 1.
ASP.NET, C11© 2003, Mike Murach & Associates, Inc.Slide 1.
Murach's ASP.NET 4.5/C#, C3© 2013, Mike Murach & Associates, Inc.Slide 1.
Murach's ASP.NET 4.5/VB, C5© 2013, Mike Murach & Associates, Inc.Slide 1.
Murach’s ASP.NET 3.5/C#, C20© 2008, Mike Murach & Associates, Inc.Slide 1.
© 2008, Mike Murach & Associates, Inc.
© 2016, Mike Murach & Associates, Inc.
© 2010, Mike Murach & Associates, Inc.
Murach's Java Programming, C6© 2011, Mike Murach & Associates, Inc.Slide 1.
© 2002, Mike Murach & Associates, Inc.
© 2002, Mike Murach & Associates, Inc.
© 2014, Mike Murach & Associates, Inc.
© 2010, Mike Murach & Associates, Inc.
© 2002, Mike Murach & Associates, Inc.
© 2014, Mike Murach & Associates, Inc.
© 2014, Mike Murach & Associates, Inc.
© 2010, Mike Murach & Associates, Inc.
© 2002, Mike Murach & Associates, Inc.
© 2014, Mike Murach & Associates, Inc.
PL/SQL Programing : Triggers
© 2002, Mike Murach & Associates, Inc.
© 2002, Mike Murach & Associates, Inc.
© 2014, Mike Murach & Associates, Inc.
© 2010, Mike Murach & Associates, Inc.
© 2002, Mike Murach & Associates, Inc.
© 2014, Mike Murach & Associates, Inc.
© 2014, Mike Murach & Associates, Inc.
© 2014, Mike Murach & Associates, Inc.
© 2014, Mike Murach & Associates, Inc.
© 2002, Mike Murach & Associates, Inc.
© 2002, Mike Murach & Associates, Inc.
© 2014, Mike Murach & Associates, Inc.
© 2014, Mike Murach & Associates, Inc.
© 2014, Mike Murach & Associates, Inc.
© 2002, Mike Murach & Associates, Inc.
© 2014, Mike Murach & Associates, Inc.
© 2014, Mike Murach & Associates, Inc.
© 2007, Mike Murach & Associates, Inc.
© 2014, Mike Murach & Associates, Inc.
© 2014, Mike Murach & Associates, Inc.
© 2008, Mike Murach & Associates, Inc.
Presentation transcript:

Murach’s Oracle SQL and PL/SQL, C16© 2014, Mike Murach & Associates, Inc.Slide 1 Thursday, March 12, 12:30 – 13:30PM. MIDTERM

Murach’s Oracle SQL and PL/SQL, C16© 2014, Mike Murach & Associates, Inc.Slide 2

Triggers A trigger is a statement that is executed automatically by the system as a side effect of a modification to the database. To design a trigger mechanism, we must: –Specify the conditions under which the trigger is to be executed. –Specify the actions to be taken when the trigger executes. Introduced to SQL standard in SQL:1999, Supported even earlier using non-standard syntax by most DBMSes. –Syntax illustrated here is for Oracle 11g.

Murach’s Oracle SQL and PL/SQL, C16© 2014, Mike Murach & Associates, Inc.Slide 4

Murach’s Oracle SQL and PL/SQL, C16© 2014, Mike Murach & Associates, Inc.Slide 5

Murach’s Oracle SQL and PL/SQL, C16© 2014, Mike Murach & Associates, Inc.Slide 6

Murach’s Oracle SQL and PL/SQL, C16© 2014, Mike Murach & Associates, Inc.Slide 7

Murach’s Oracle SQL and PL/SQL, C16© 2014, Mike Murach & Associates, Inc.Slide 8

Murach’s Oracle SQL and PL/SQL, C16© 2014, Mike Murach & Associates, Inc.Slide 9

Murach’s Oracle SQL and PL/SQL, C16© 2014, Mike Murach & Associates, Inc.Slide 10

Murach’s Oracle SQL and PL/SQL, C16© 2014, Mike Murach & Associates, Inc.Slide 11

Murach’s Oracle SQL and PL/SQL, C16© 2014, Mike Murach & Associates, Inc.Slide 12

Murach’s Oracle SQL and PL/SQL, C16© 2014, Mike Murach & Associates, Inc.Slide 13 Triggers are commonly used to monitor events occurring in a database. AFTER Triggers

Murach’s Oracle SQL and PL/SQL, C16© 2014, Mike Murach & Associates, Inc.Slide 14

Murach’s Oracle SQL and PL/SQL, C16© 2014, Mike Murach & Associates, Inc.Slide 15

Murach’s Oracle SQL and PL/SQL, C16© 2014, Mike Murach & Associates, Inc.Slide 16

Murach’s Oracle SQL and PL/SQL, C16© 2014, Mike Murach & Associates, Inc.Slide 17 Triggers for Views Recall updateable views?

Murach’s Oracle SQL and PL/SQL, C16© 2014, Mike Murach & Associates, Inc.Slide 18

Murach’s Oracle SQL and PL/SQL, C16© 2014, Mike Murach & Associates, Inc.Slide 19

Murach’s Oracle SQL and PL/SQL, C16© 2014, Mike Murach & Associates, Inc.Slide 20

Murach’s Oracle SQL and PL/SQL, C16© 2014, Mike Murach & Associates, Inc.Slide 21 Triggers on DDL Statements What’s a DDL statement?

Murach’s Oracle SQL and PL/SQL, C16© 2014, Mike Murach & Associates, Inc.Slide 22

Murach’s Oracle SQL and PL/SQL, C16© 2014, Mike Murach & Associates, Inc.Slide 23

Murach’s Oracle SQL and PL/SQL, C16© 2014, Mike Murach & Associates, Inc.Slide 24 Disable/Enable Triggers Why would I want to disable a trigger?

Murach’s Oracle SQL and PL/SQL, C16© 2014, Mike Murach & Associates, Inc.Slide 25

Murach’s Oracle SQL and PL/SQL, C16© 2014, Mike Murach & Associates, Inc.Slide 26

Murach’s Oracle SQL and PL/SQL, C16© 2014, Mike Murach & Associates, Inc.Slide 27 Compound Triggers Why do we need another type of trigger? It solves an well-known problem in Oracle. Contains code that executes: BEFORE the triggering statement executes. BEFORE the row is modified. AFTER the row is modified. AFTER the triggering statement has finished.

Murach’s Oracle SQL and PL/SQL, C16© 2014, Mike Murach & Associates, Inc.Slide 28

Murach’s Oracle SQL and PL/SQL, C16© 2014, Mike Murach & Associates, Inc.Slide 29

Murach’s Oracle SQL and PL/SQL, C16© 2014, Mike Murach & Associates, Inc.Slide 30

Murach’s Oracle SQL and PL/SQL, C16© 2014, Mike Murach & Associates, Inc.Slide 31

Murach’s Oracle SQL and PL/SQL, C16© 2014, Mike Murach & Associates, Inc.Slide 32

Murach’s Oracle SQL and PL/SQL, C16© 2014, Mike Murach & Associates, Inc.Slide 33

Murach’s Oracle SQL and PL/SQL, C16© 2014, Mike Murach & Associates, Inc.Slide 34

Murach’s Oracle SQL and PL/SQL, C16© 2014, Mike Murach & Associates, Inc.Slide 35

Murach’s Oracle SQL and PL/SQL, C16© 2014, Mike Murach & Associates, Inc.Slide 36

Murach’s Oracle SQL and PL/SQL, C16© 2014, Mike Murach & Associates, Inc.Slide 37

Murach’s Oracle SQL and PL/SQL, C16© 2014, Mike Murach & Associates, Inc.Slide 38