Question
1. Create a stored procedure called Add_User that will add an employee to a company 2. The stored procedure has two parameters a. A parameter
1. Create a stored procedure called Add_User that will add an employee to a company
2. The stored procedure has two parameters
a. A parameter (UserId)that the stored procedure is called it will contain the primary key value that should be used to add the row.
b. A parameter(UName) that the stored procedure can read only - it contains the new employee's username.
c. A parameter (Result) that the stored procedure can write to. If the new record is added successfully, the parameter will be set to the value 'Entered Successfully'. If the add fails the parameter is set to the value 'Unsuccessful'
3. Declare an exception name EMPLOYEE_NOT_ADDED. Associate the number -20444 with this exception
4. Execute an insert statement to add the row to the table. Use the values of the passed parameters on the insert statement. Today's date should be used for the Created_Date column.
5. If the userID is added:
a. Set the parameter 'Result' to 'Entered Successfully'.
b. Commit the changes
6. Add exception processing to the stored procedure.
a. For all exceptions set the parameter 'Result' to 'Unsuccessful'
b. If the EMPLOYEE_NOT_ADDED exception occurs, display the message 'New UserId already exists on the table.'
c. For any other error, display the error number and the message associated with that error number
Note: question 1 and 2 are already answered, please start from question 3.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started