Procedural constraint enforcement (triggers) , PL-SQL Programming

Procedural Constraint Enforcement (Triggers)

SQL has an alternative method of addressing database integrity, involving event-driven procedural code. The special procedures that can be used for this purpose are called triggers and the events that activate them are specified update operations. For example, suppose it is required for every row in IS_CALLED to have a matching row on StudentId in IS_ENROLLED_ON, enforcing a business rule to the effect that every registered student must be enrolled on at least one course. Then a triggered procedure might be activated every time INSERT is used to add a row to IS_CALLED, checking to see if a matching row exists in IS_ENROLLED_ON and raising an exception if there isn't one. But that wouldn't be sufficient to address the requirement.

Further triggers would be needed, activated by UPDATE statements on IS_CALLED and IS_ENROLLED_ON that cause changes to StudentId values in either of those tables, and by DELETE statements on IS_ENROLLED_ON. As this simple example demonstrates, use of triggered procedures for constraint enforcement can be complicated and error-prone. As one practitioner told me, "It quickly gets so complicated that it's almost impossible for a human not to make errors..., and even when you're not facing a 'complicated' case, the work to be done is tedious and boring".

Posted Date: 1/18/2013 7:25:02 AM | Location : United States







Related Discussions:- Procedural constraint enforcement (triggers) , Assignment Help, Ask Question on Procedural constraint enforcement (triggers) , Get Answer, Expert's Help, Procedural constraint enforcement (triggers) Discussions

Write discussion on Procedural constraint enforcement (triggers)
Your posts are moderated
Related Questions
Rollback Behavior When a FORALL statement fails, the database changes are rolled back to an implicit savepoint marked before each of the SQL statement execution. The Changes t

Calling Constructors: The Calls to a constructor are allowed wherever the function calls are allowed. Similarly to the functions, a constructor is called as a section of an ex

Accessing Attributes: You can refer to an attribute only by its name not by its position in the object type. To access or modify the value of an attribute, you can use the dot

Using a join on 2 tables, select all columns and 10 rows from the 2 tables without the use of a Cartesian product. Query: SELECT * FROM EMPLOYEE1 E JOIN STAFF S ON E.EMP_

INSERT Command in SQL Loosely speaking, INSERT takes the rows of a given source table and adds them to the specified target table, retaining all the existing rows in the targ

Dynamic SQL: The Most PL/SQL programs do a predictable, specific job. For illustration, a stored procedure may accept an employee number and salary increase, and then update t

Using EXTEND To enlarge the size of a collection, use EXTEND. This process has 3 forms. The EXTEND appends one null element to a collection. And the EXTEND(n) appends n null e

Using Cursor Attributes: Every cursor has 4 attributes: %NOTFOUND, %FOUND, %ISOPEN, and %ROWCOUNT. If appended to the cursor name, they return the helpful information about

Parameter Modes   To define the behavior of formal parameters you use the parameter modes. The 3 parameter modes, IN, OUT, & IN OUT, can be used with any subprogram. Though, a

Projection in SQL - correct version Student StudentId is enrolled on some course. SELECT DISTINCT StudentId FROM IS_ENROLLED_ON In more complicated examples it is someti