Question: This is a make believe question CREATE OR REPLACE PROCEDURE show_emps_def (p_emp_id IN NUMBER) IS v_name emps.name%TYPE; v_dept_id emps.department_id%TYPE; v_dept_name emps.department_name%TYPE; v_sal emps.salary%TYPE; BEGIN SELECT
This is a make believe question
CREATE OR REPLACE PROCEDURE show_emps_def (p_emp_id IN NUMBER) IS v_name emps.name%TYPE; v_dept_id emps.department_id%TYPE;
v_dept_name emps.department_name%TYPE; v_sal emps.salary%TYPE;
BEGIN
SELECT name, department_id, department_name, salary INTO v_name, v_dept_id, v_dept_name, v_sal FROM emps
WHERE employee_id = p_emp_id;
DBMS_OUTPUT.PUT_LINE('The employee details are: ' || v_name
|| ' ' || v_dept_id || ' '|| v_dept_name || ' ' || v_sal);
EXCEPTION
WHEN NO_DATA_FOUND THEN
DBMS_OUTPUT.PUT_LINE('No data found for employee id: ' || p_emp_id || '. Sorry, please enter another number and try again.'); END;
CREATE OR REPLACE PROCEDURE show_emps_inv (p_emp_id IN NUMBER)
AUTHID CURRENT_USER IS v_name emps.name%TYPE; v_dept_id emps.department_id%TYPE;
v_dept_name emps.department_name%TYPE; v_sal emps.salary%TYPE;
BEGIN
SELECT name, department_id, department_name, salary INTO v_name, v_dept_id, v_dept_name, v_sal
FROM emps
WHERE employee_id = p_emp_id;
DBMS_OUTPUT.PUT_LINE('The employee details are: ' || v_name || ' ' || v_dept_id || ' ' || v_dept_name || ' ' || v_sal);
EXCEPTION
WHEN NO_DATA_FOUND THEN
DBMS_OUTPUT.PUT_LINE('No data found for employee id: ' || p_emp_id || '. Sorry, please enter another number and try again.'); END;
1. Write the syntax to DESCRIBE both procedures. If the procedures existed, this would allow you to verify that you can see them in your account. Remember to prefix the procedure name with the schema name, and remember that the schema/procedures don't exist (we are using our imaginations).
2. Write the syntax to execute a SQL statement to try to select directly from the table used in the procedures. Remember that the schema/procedures don't exist (we are using our imaginations).
3. Explain the differences between the two procedures in regards to definer's rights compared to invoker's rights.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
