1 start with checksalary trigger explain below on triggers

Assignment Help Database Management System
Reference no: EM13350558

1) Start with CHECK_SALARY trigger explain below on triggers. Show that that trigger creates MUTTATING TABLE error. In order to circumvent that problem, write a combination of a BEFORE statement trigger and a modified BEFORE ROW trigger. Use the before statement trigger to record values of v_maxsalary and v_minsalary as packaged variables. In the row trigger perform the needed range check using those packaged variables. Add an AFTER statement trigger that would set those packaged variables to NULL, making it required for the BEFORE statement trigger to fire and act properly for the business rule to be enforced. Show that the above error is not raised. This is a standard way of eliminating mutating table errors.

MutatingTable:Example

SQL>CREATEOR REPLACETRIGGERcheck_salaryBEFOREINSERT OR UPDATEOFsal,job ONempFOREACH ROW

WHEN (new.job<> 'PRESIDENT') DECLARE

v_minsalaryemp.sal%TYPE;

vmaxsalaryemp.sal%TYPE;

BEGIN

SELECT MIN(sal),MAX(sal)

INTO   v_minsalary,v_maxsalary

FROM   emp

WHEREjob= :new.job;

IF:new.sal<v_minsalary OR

:new.sal>v_maxsalaryTHEN RAISE_APPLICATION_ERROR(-20505,

'Out of range');

;

END IF;

END;

SQL>UPDATEemp

SETsal=1500

WHEREename= 'SMITH';

*

ERRORatline2

ORA_4091:TableEMPismutating,trigger/functionmaynotseeit

ORA_06512:atline4                                   

ORA_04088:errorduringexecutionoftrigger'check_salary';

This trigger, CHECK_SALARY, tries to guarantee that whenever a new employee is added to the EMP table or an existing employee's salary or job title is changed, the employee's salary falls within the established salary range for the employee's job

2) Suppose Entity Title on slide below of Lecture note. Implement that entity as a database table with two subtypes, Games and Movie. Let both subtypes have their own unique ids, e.g. movie_id and game_id. Create another entity (table) Rented_Item that records rented items. Let that table reference movies and games from table (entity) Title. Implement the referential integrity using triggers. Populate both tables with various rows and shows that the referential integrity may be maintained.

Reference no: EM13350558

Questions Cloud

Questiona rectangular loop has 85 turns with an area of : questiona rectangular loop has 85 turns with an area of 0.225 m2 and lies in a uniform magnetic field of 0.28 t.
Question1a small immersion heater can be used to heat a cup : question1a small immersion heater can be used to heat a cup of water for coffee or tea. if the heater can heat 180ml
Question1a long solenoid with 70 turns of wire per : question1a long solenoid with 70 turns of wire per centimeter carries a current of 0.16. the wire that makes up
Questionthe executives at cbc want to realise how they are : questionthe executives at cbc want to realise how they are doing in ratings against the other networks as well as how
1 start with checksalary trigger explain below on triggers : 1 start with checksalary trigger explain below on triggers. show that that trigger creates muttating table error. in
Question1if you drop a rock from a height of 71 m it : question1if you drop a rock from a height of 7.1 m it accelerates at g and strikes ground 1.20374 s later.if you drop
Question1a 8kg mass moves in a circular path of 4m radius : question1a 8kg mass moves in a circular path of 4m radius on a frictionless horizontal table. it is attached to a
Questionresearch an article on a current event that centres : questionresearch an article on a current event that centres on some sort of question or controversial issue. then
Question1imagine you are on a planet similar to earth where : question1imagine you are on a planet similar to earth where an acceleration of gravity is approximately 10 ms2.the

Reviews

Write a Review

Database Management System Questions & Answers

  Display the averaged measurements every time

The application uses hash tables - for a brief introduction, refer tothese slides . While the approach used by the simulator is very basic (using a dilated simulation clock), it is has been deemed sufficient for the purpose at hand.

  What is file organization

What is file organization? what are file organization techniques.explain in detail? explain random file organization technique, multikey file organization technique?

  Key functions of organization-map to strategic information

From information system point of view, we should take the key functions of organization and map them to strategic information. Do your companies follow this process or are steps skipped?

  Draw an entity relationship diagram for the system

Draw an Entity Relationship diagram for the system and Identify the table design for the database displaying all the fields/attributes. Ensure that all tables are in 3NF. You also need to identify the primary keys and foreign keys, where applicable..

  Create library database schema structure

The library System stores 3 type of informations: Users ( USID, USNAME, USMob, USEmail, USDept,USStartDate, NofBooks). Create the library database schema Structure.

  Write procedure to construct character frequency table

Write the procedure named Get_frequencies which constructs character frequency table. Input to procedure must be a pointer to the string, and pointer to array of 256 doublewords.

  Write a monitor using to implement readers-writers problem

Suppose that we replace the wait and signal operations of monitors with a single construct await(B), where B is a general Boolean expression. Write a monitor using this scheme to implement the readers--writers problem.

  Define database systems and data warehouses

Describe how that firms likely use or should use Management Information Systems, Information Systems and Information Technology as it relates to the various topics covered in the class.

  The packing list describes the ideal contents

The packing list describes the ideal contents of each package, but it is not always possible to include the ideal number of each item. Therefore, the actual items included in each package should be tracked. A package can contain many different ite..

  Design tables in 3nf various codes for at least three fields

Create tables in 3NF. As you create the database, include different codes for at least three of the fields. Use sample data to populate fields for at least three records in each table.

  Design of a data warehouse

Enterprises are accumulating substantial amounts of data that are necessary for their business operations.

  Explaining weak relationship and weak entity

What is meant by a weak relationship? Provide an example. What is meant by weak entity? What do you understand by relationship degree?

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