Answers
Question B1
a) The two types of parameters that have been used in the declaration of the procedure are the IN parameter and the OUT parameter.
IN parameter:
These types of parameters are used to send values to stored procedures. This type of parameter is a read only parameter. We can assign the value of IN type parameter to a variable or use it in a query, but we cannot change its value inside the procedure.
OUT parameter:
The OUT parameters are used to send the OUTPUT from a procedure or a function. This is a write-only parameter i.e, we cannot pass values to OUT parameters while executing the stored procedure, but we can assign values to OUT parameter inside the stored procedure and the calling program can receive this output value.
b) A trigger is a procedure that is automatically invoked by the DBMS in response to specified changes to the database.
Data Integrity: This refers to the accuracy and consistency of data stored in a database, data warehouse, data mart or other construct.
Triggers help to enhance data integrity when there is a referential integrity constraint on the tables or data we are working with and these tables are present in different nodes or servers.
Example: consider a medicine ordering system which contains data from two different servers say server ‘A’ and server ‘B’
Server A contains a database which consists of the tables that store details about the customer orders and the status of order.
Server B contains a database that stored the details about the orders ,products ordered, their availability.
And suppose a product is not available in the stock then the order that is placed for that product is deleted in the server B. So, when the order is deleted in the server B then the order deletion must also reflect in orders status in the the server A so that the data integrity is maintained.otherwise the customer will be waiting for the completion of that order.So here in such cases we use TRIGGERS to enhance data integrity by creating a trigger that updates the order status in the server A whenever a deletion of order happens in server B.
.