Ubd 7
Ubd 7
Ubd 7
7
Observație!
Scrieți rezolvarea direct în acest document!
Creating Procedures
1. Create, save and execute a procedure which updates the salary of employees in employees_dup
according to the following rules:
You will need to include three UPDATE statements, one for each of the above rules. Execute your
procedure from an anonymous block and verify that the updates have been performed correctly.
BEGIN
UPDATE employees_dup
UPDATE employees_dup
UPDATE employees_dup
END change_salary;
Apelare procedura:
BEGIN
change_salary;
END;
FROM employees_dup;
A. Create a procedure that accepts a country_id as a parameter and displays the name of the country
and its capitol city. Name your procedure get_country_info. Save your procedure definition for later
use.
BEGIN
get_country_info(90);
END;
C. Re-execute the procedure from the anonymous block, this time using country_id 95. What
happens?
BEGIN
get_country_info(95);
END;
D. Retrieve your procedure code from Saved SQL and modify it to trap the NO_DATA_FOUND
exception in an exception handler. Re-execute the procedure using country_id 95 again. Now what
happens?
v_country_name wf_countries.country_name%TYPE;
v_capitol_city wf_countries.capitol%TYPE;
BEGIN
FROM wf_countries
WHERE country_id=p_country_id;
EXCEPTION
department id.');
END;
BEGIN
get_country_info(95);
END;
Passing Parameters
1. Create and test a procedure which accepts a department id as an IN parameter with a default
value of 50, and returns (using OUT parameters) the last name and salary of the employee in that
department who has the highest salary. The SELECT statement in the procedure should use a
subquery. Test your procedure twice from an anonymous block, the first time using department
id 80, the second time using the default value.
BEGIN
FROM employees e
END;
DECLARE
v_last_name employees.last_name%TYPE;
v_salary employees.salary%TYPE;
BEGIN
END;
DECLARE
v_last_name employees.last_name%TYPE;
v_salary employees.salary%TYPE;
BEGIN
END;
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: