Module Triggers
Module Overview
- In this module you will learn how to write PL/SQL and T-SQL triggers
Objectives
After completing this module you will be able:
- to develop, test and debug Oracle PL/SQL triggers
- to develop, test and debug MS SQL Server T-SQL triggers
Lab
You have to run every script in this module and understand each line of code before you can start this lab assignment.
Q1: Refine the Example 4 from PL/SQL in way so that updating does not change value of ID column. Provide a screenshot of your trigger with compilation results.
Test the trigger with the following queries with expect the following result.
Q2: You would revise a trigger created in Example 2 of T-SQL. Frist, drop the transTrigger then redefine just like before, except when adding balance in account, 10% interest would be added up on the old balance. See formula below:
balance=balance*1.1 + @amount
You need to provide the code of your trigger, with screenshot of compilation.
To test you need to issue the following command:
You can compare your results before and after running the trigger:
Before
You will need to make some changes to generated code before you can run it in Oracle.
Feedback:
Difficulty (-2 - too easy ... 0 - just right ... 2 - too hard)
Interest level (-2 - low interest ... 0 - just right ... 2 - high interest)
Time to complete (min):
Suggestion to improve (if any):
Attachment:- Procedural_SQL_PartIII.rar