Practice 1 Solutions 1. Initiate a SQL*Plus session using the user ID and password provided by the instructor. 2.SQL* Plus commands access the database. False 3. Will the SELECT statement executes successfully? True SQL> SELECT ename, job, sal Salary 2 FROM emp; 4. Will the SELECT statement executes successfully? True SQL> SELECT * 2 FR OM sal gra de ; 5. There are four coding errors in this statement. Can you identify them? SQL> SELECT 2 3 FROM empno, ename salary x 12 ANNUAL SALARY emp; The EMP table does not contain a column called salary. The column is called sal. The multiplication operator is *, not x, as shown in line 2. 3. The ANNUAL SALARY alias cannot include spaces. The alias should read ANNUAL SALARY or be enclosed in double quotation marks. 4. A comma is missing after the column, ENAME. 1. 2. 6. Show the structure of the DEPT table. Select all data from the DEPT table. SQL> DESCRIBE dept SQL> SELECT * 2 FROM dept; Show the structure of the EMP table. Create a query to display the name, job, hire date, and employee number for each employee, with employee number appearing first. Save your SQL statement to a file named plq7 .sql. SQL> DESCRIBE emp SQL> SELECT empno, ename, job, hiredate 2 FROM emp; SQL> SAVE plq7.sql Created file plq7.sql Introduction to Oracle: SQL and PL/SQL A-2 Practice 1 Solutions (continued) 1. Run your query in the p l q 7 . s q l file. SQL> START p l q 7 . s q l 2. Create a query to display unique jobs from the EMP table. SQL> SELECT DISTINCT job 2 FR OM emp ; If you have time, complete the following exercises: 10. Load p l q 7 . s q l into the SQL buffer. Name the column headings Emp #, Employee, Job, and Hire Date, respectively. Rerun your query. SQL> GET p l q 7 . s q l 1 SELECT empno, ename, job, hiredate 2* FROM emp SQL> 1 SELECT empno "Emp #", ename "Employee", SQL> i 2i job "Job", hiredate "Hire Date" 3i SQL> SAVE p lq 7 . s q l REPLACE Created file p l q 7 . s q l SQL> START plq7.sql 11. Display the name concatenated with the job, separated by a comma and space, and name the column Employee and Title. SQL> SELECT 2 FROM enamelP, 'Iljob "Employee and Title" emp; Introduction to Oracle: SQL and PL/SQL A-3 Practice 1 Solutions (continued) If you want extra challenge, complete the following exercise: 12. Create a query to display all the data from the EMP table. Separate each column by a comma. Name the column THE OUTPUT. SQL> SELECT empno I I ' , ' I I ename I I ' , ' I I j o b I I ' , ' I I 2 3 mgr I I ' , ' I I hiredate I I ' , ' I I sal I I comm II ',' II deptno THE_OUTPUT II 4 FROM emp; Introduction to Oracle: SQL and PL/SQL A-4 s q1. .sql 2.sql SELECT FROM WHERE ename.'DD-MON-YYYY') 6 ORDER BY hiredate. job. Modify p2 ql . Save your SQL statement to a file named p2 q1 . Resave your SQL statement to a file named p2q3 . 3. hiredate emp hiredate BETWEEN 4 TO DATE('20-Feb-1981'.sql.sql Created file p2q1. SQL> SELECT 2 FROM 3 WHERE ename. and start date of employees hired between February 20. 1981. SQL> SELECT 2 FROM 3 WHERE ename. Create a query to display the name and salary of employees earning more than $2850. Rerun your query. SQL> SAVE p2q1. deptno emp e mpno = 7566. Run your query. sal emp sal > 2850.Practice 2 Solutions 1. SQL> EDIT p2q1. sql to display the name and salary for all employees whose salary is not in the range of $1500 and $2850. SQL> SELECT 2 FROM 3 WHERE ename.'DD-MON-YYYY') AND 5 TODATE('01-May-1981'. 1981. sal emp sal NOT BETWEEN 1500 AND 2850 SQL> START p2q3.sql Display the employee name. Create a query to display the employee name and department number for employee number 7566. and May 1. job. Order the query in ascending order by start date. Introduction to Oracle: SQL and PL/SQL A-5 . 30) SQL> START p2q6. sal "Monthly Salary" FROM emp WHERE AND sal > 1500 deptno IN (10. SQL> EDIT p2q3. salary. SQL> SELECT ename. SQL> SELECT ename. Rerun your query. SQL> SELECT ename. 30) 4 ORDER BY ename. hiredate 2 FROM emp 3 WHERE hiredate LIKE '%82'. deptno 2 FROM emp 3 WHERE deptno IN (10. 6. comm DESC. job 2 FROM emp 3 WHERE mgr IS NULL. Sort data in descending order of salary and commissions.sql SELECT ename "Employee". Label the column Employee and Monthly Salary. 8. Resave your SQL statement to a file named p2q6 . Display the name. sal. respectively. Introduction to Oracle: SQL and PL/SQL A-6 .Practice 2 Solutions (continued) 5. comm 2 FROM emp 3 WHERE comm IS NOT NULL 4 ORDER BY sal DESC. sql.sql to list the name and salary of employees who earn more than $1500 and are in department 10 or 30. SQL> SELECT ename.sql Display the name and hire date of every employee who was hired in 1982. Modify p2q3 . Display the employee name and department number of all employees in departments 10 and 30 in alphabetical order by name. and commission for all employees who cam commissions. Display the name and title of all employees who do not have a manager. 3000. complete the following exercises. and salary for all employees whose job is Clerk or Analyst and their salary is not equal to $1000. Display the names of all employees that have two Ls in their name and are in department 30 or their manager is 7782. 5000). job. Resave your query as p2q13 . Rerun your query. 12. sql. or $5000. Note: There are two underscores ( before the A in the WHERE clause. 10. job. and commission for all employees whose commission amount is greater than their salary increased by 10%.sql to display the name. Display the names of all employees where the third letter of their name is an A. comm emp comm > sal * 1. $3000. 13. complete the following exercises. sal "Monthly Salary". salary.sql SELECT FROM WHERE ename "Employee".Practice 2 Solutions (continued) If you have time.sql Introduction to Oracle: SQL and PL/SQL A-7 . SQL> EDIT p2q6. sal emp job IN ('CLERK'. SQL> SELECT 2 FROM 3 WHERE 4 AND ename.1 SQL> START p2q13. 1 1. SQL> SELECT ename FROM 3 WHERE 4 AND 5 OR 2 emp ename LIKE '%L%L%' deptno = 30 mgr = 77 82. Modify p2q6 . Display the name. If you want extra challenge. 'ANALYST') sal NOT IN (1000. SQL> SELECT ename 2 FROM 3 WHERE emp ename LIKE ' A%'. Introduction to Oracle: SQL and PL/SQL A-8 . 0) "New Salary" 3 FROM emp.sql Created file p3q2.15. s ql to add a column that will subtract the old salary from the new salary. hiredate. Display the employee's name. Run your query in the file p 3 q2 . s q l 6. SQL> SELECT empno. Modify your query p 3 q2 . "the" Ddspth "of" Month. sa l. and salary review date. 0) . ROUND(sal * 1. - SQL> SELECT ename.sq l 5. 'fmDay.15.Practice 3 Solutions 3. 1981". Label the column Date. Label the column REVIEW. salary.15. ename. the Seventh of September. s q l SELECT empno. Format the dates to appear in the format similar to Sunday.sql. ename. Label the column Increase.sal "Increase" FROM emp SQL> START p 3 q 2 . 6). Display the employee number. SQL> EDIT p 3 q 2 . 0) "New Salary". SQL> SELECT sysdate "Date" 2 FROM dual. hire date. 2 ROUND(sal * 1. which is the first Monday after six months of service. SQL> SAVE p3q2.sql 5. sal. ROUND(sal * 1. 'MONDAY'). 4. 2 3 4 TO CHAR(NEXT DAY (ADD MONTHS(hiredate. sql. Save your SQL statement to a file named p3q2. name. SQL> START p 3 q 2 . Label the column New Salary. and salary increase by 15% expressed as a whole number. Write a query to display the current date. Rerun your query. YYYY') REVIEW 5 FROM emp. For each employee display the employee name and calculate the number of months between today and the date the employee was hired. 7. for all employees whose name starts with J. Introduction to Oracle: SQL and PL/SQL A-9 .00 ' ) monthly but wants ' CHAR(sal * 3. Label the column Dream Salaries. Create a query to display name and salary for all employees. ROUND (MONTHS_BETWEEN (SYSDATE. Round the number of months up to the closest whole number.999. ' $ ' ) SALARY emp. SQL> SELECT ename. SQL> SELECT 2 3 FROM 4 ORDER BY ename. hiredate). 'fm$99. 2 3 FROM LPAD (sal . 9. Write a query that produces the following for each employee: <employee name> earns <salary> monthly but wants <3 times salary>.00') "Dream Salaries" II TO II '. hiredate)) MONTHS _ WORKED emp MONTHS BETWEEN(SYSDATE. If you have time. 2 LENGTH(ename) "Length" 3 FROM emp 4 WHERE ename LIKE 'J%' 5 OR ename LIKE 'M%' 6 OR ename LIKE 'A%'. or M. SQL> SELECT INITCAP(ename) "Name". complete the following exercises: 8. left-padded with $. 15. SQL> SELECT ename 2 3 4 5 6 FROM II ' earns ' II TO II ' CHAR (sal .Practice 3 Solutions (continued) 6. Label the column SALARY. Format the salary to be 15 characters long. Label the column MONTHS_WORKED. Order your results by the number of months employed. A. Give each column an appropriate label. Write a query that will display the employee's name with the first letter capitalized and all other letters lowercase and the length of their name.' emp. ' fm$99.999. and day of the week on which the employee started. Order the results by the day of the week starting with Monday. as per the table shown below JOB PRESIDENT MANAGER ANALYST SALESMAN CLERK Noneatheabove GRADE A B C D E 0 6 7 FROM emp. SQL> SELECT rpad(ename. If the employee does not earn commission. 'd'). hire date. 'DAY') DAY 3 FROM emp 4 ORDER BY TO CHAR(hiredate . hiredate. SQL> SELECT ename.Practice 3 Solutions (continued) 10.'CL ERKT. Label the column EMPLOYEE AND THEIR SALA RIES. put "No Commission". If you want extra challenge. Sort the data in descending order of salary. 13. complete the following exercises: 11. Label the column COMM. 2 3 FROM NVL(TO CHAR(comm). Display the name. 'SAL ESMA N'. 2 TO CHAR(hiredate. SQL> SELECT ename. '*') 2 EMPLOYEE AND THEIR SALARIES 3 FROM emp 4 ORDER BY sal DESC. Create a query that will display the employee name and commission amount. decode 2 3 4 5 . 'No Commission') COMM emp. 12.1. 8) II' 'II rpad(". Create a query that displays the employees' names and indicates the amount of their salaries through asterisks. Each asterisk signifies a hundred dollars. 'ANA SQL> SELECT job. (job. Label the column DAY. sal/100+1. Write a query that displays the grade of all employees based on the value of the column JOB. LYST', 'MANAGER', 'PRESIDENT', ,ET 'D', 'C', ,B, , , 'A', '0')GRADE Introduction to Oracle: SQL and PL/SQL A 10 - Practice 4 Solutions 1. Write a query to display the name, department number, and department name for all employees. SQL> SELECT 2 FROM 3 WHERE e.ename, e.deptno, d.dname emp e, dept d e.deptno = d.deptno; 2. Create a unique listing of all jobs that are in department 30. Include the location of department 30 in the output. SQL> SELECT 2 FROM 3 WHERE 4 AND DISTINCT e.job, d.loc emp e, dept d e.deptno = d.deptno e.deptno = 30; 3. Write a query to display the employee name, department name, and location of all employees who earn a commission. SQL> SELECT 2 FROM 3 WHERE 4 AND e.ename, d.dname, d.loc emp e, dept d e.deptno = d.deptno e.comm IS NOT NULL; Display the employee name and department name for all employees who have an A in their name. Save your SQL statement in a file called p 4 q4 . sql. SQL> SELECT 2 FROM 3 WHERE 4 AND e.ename, d.dname emp e, dept d e.deptno = d.deptno e.ename LIKE '%A%'; Write a query to display the name, job, department number, and department name for all employees who work in DALLAS. SQL> SELECT 2 FROM e.ename, e.job, e.deptno, d.dname emp e, dept d e.deptno = d.deptno Introduction to Oracle: SQL and PL/SQL A -11 3 WHERE 4 AND d.loc = 'DALLAS'; Practice 4 Solutions (continued) 6. Display the employee name and employee number along with their manager's name and manager number. Label the columns Employee, Emp#, Manager, and Mgr#, respectively. Save your SQL statement in a file called p4q6 . sql. SQL> SELECT e.ename "Employee", e.empno "Emp#", 2 m.ename "Manager", m.empno "Mgr#" 3 FROM emp e, emp m 4 WHERE e.mgr = m.empno; SQL> SAVE p4q6.sql Created file p4q6.sql 7. Modify p 4q6 .sql to display all employees including King, who has no manager. Resave as p4q7 . sql. Run p4q7 . sql. SQL> EDIT p4q6.sql SELECT e.ename "Employee", e.empno "Emp#", m.ename "Manager", m.empno "Mgr#" F R O M e mp e, e mp m WHERE e.mgr = m.empno(+) SQL> START p4q7.sql If you have time, complete the following exercises. 8. Create a query that will display the employee name, department number, and all the employees that work in the same department as a given employee. Give each column an appropriate label. SQL> SELECT e.deptno department, e.ename employee, 2 3 4 5 6 c.ename colleague FROM emp e, emp c WHERE e.deptno = c.deptno AND e.empno <> c.empno ORDER BY e.deptno, e.ename, c.ename; Introduction to Oracle: SQL and PL/SQL A-12 emp. Display all employees' names and hire dates along with their manager's name and hire date for all employees who were hired before their managers. 2 m.sal. m.mgr = m. e. Manager. department name.hiredate "Mgr Hiredate" 3 FROM emp e. s. SQL> SELECT emp. salgrade s 3 WHERE e. job. Show the structure of the SALGRADE table. d.dname.empno 5 AND e. emp m 4 WHERE e.ename = 'BLAKE' 4 AND blake.sal BETWEEN s. and Mgr Hiredate. Introduction to Oracle: SQL and PL/SQL A -13 . complete the following exercises: 10.grade 2 FROM emp e.deptno = d. Create a query that will display the name.hiredate. salary. e.Practice 4 Solutions (continued) 9. SQL> SELECT e.ename.ename "Manager".hiredate 2 FROM emp. respectively. emp blake 3 WHERE blake. dept d.ename. Emp Hiredate.losal AND s. Label the columns Employee.job. If you want extra challenge.hiredate "Emp Hiredate". 11.hisal. Create a query to display the name and hire date of any employee hired after employee Blake.deptno 4 AND e.hiredate < m. SQL> DESCRIBE salgrade SQL> SELECT e. and grade for all employees. e.hiredate.hiredate < emp.ename "Employee". SQL> SAVE p5q4. ROUND(AVG(sal). False. ROUND (MIN (sal ) 0 ) "Minimum". use the NVL function. lowest. 1. ROUND( SUM( sal ) . OsM Uaa Nli X ROUND(MIN(sal).0) "Maximum". sum. sql. sql to display the minimum. SQL> EDIT p5q6. Group functions include nulls in calculations. Minimum. ROUND(SUM(sal). sum. Save your SQL statement in a file called p5q4 . Label the columns Maximum. and average salary of all employees. The WHERE clause restricts rows prior to inclusion in a group calculation.sql SELECT jD)x o(.m bM0u . Resave to a file called p5q5 .sql Introduction to Oracle: SQL and PL/SQL A-14 .0) "Sum". Round your results to the nearest whole number. and Average. If you want to include null values.sql Created file p5q4.Practice 5 Solutions Determine the validity of the following statements. True 2. SQL> SELECT 2 3 4 5 FROM ROUND(MAX (sal) . Sum. 3. maximum.A)" R(". 0) "Average" emp. True 4. sql. Display the highest.0) "Average" FROM emp GROUP BY job SQL> START p5q5. 0) "Sum" ROUND (AVG (sal ) .sql 5. Rerun your query. Circle either True or False. respectively. Group functions ignore null values.0) "Minimum". Group functions work across many rows to produce one result. and average salary for each job type. Modify p5q4 . COUNT(*) 2 FROM emp 3 GROUP BY job. 10. 2 ROUND(AVG(sal). Write a query to display the number of people with the same job. d. MIN(sal) FROM emp WHERE mgr IS NOT NULL GROUP BY mgr HAVING MIN(sal) > 1000 ORDER BY MIN(sal) DESC. Label the column Number of Managers. Sort the output in descending order of salary. Write a query to display the department name.MIN(sal) DIFFERENCE emp. COUNT(*) "Number of People". Exclude any groups where the minimum salary is less than $1000. Display the manager number and the salary of the lowest paid employee for that manager.deptno = d.loc. dept d 4 WHERE e. Exclude anyone whose manager is not known. and Salary. Label the column DIFFERENCE. 7.loc.deptno 5 GROUP BY d. loc. SQL> SELECT 2 FROM COUNT(DISTINCT mgr) "Number of Managers" emp. SQL> SELECT job. number of employees. Write a query that will display the difference between the highest and lowest salaries. Round the average salary to two decimal places. Label the columns dname. complete the following exercises. Determine the number of managers without listing them.2) "Salary" 3 FROM emp e. SQL> SELECT 2 FROM MAX(sal) . d. If you have time.dname. location name. 9.Practice 5 Solutions (continued) 6. SQL> SELECT 2 3 4 5 6 mgr.dname. respectively. Introduction to Oracle: SQL and PL/SQL A-15 . SQL> SELECT d. Number of People. and the average salary for all employees in that department. and 1983. sal)) "Dept 20". SUM(DECODE(deptno. complete the following exercises: 11. SUM(sal) "Total" emp job. sal)) "Dept 10". 6 SUM(DECODE(TO CHAR(hiredate.0))"1980". SUM(DECODE(deptno. 30. 10. 20. SQL> SELECT COUNT(*) total. and the total salary for that job for all departments. 'YYYY'). Give appropriate column headings.1. the salary for that job based on department number. 4 SUM(DECODE(TO_CHAR(hiredate. 1982. 'YYYY'). Create a matrix query to display the job. 'YYYY'). 'YYYY'). 7 1982. Create a query that will display the total number of employees and of that total the number who were hired in 1980. 5 1981. sal)) "Dept 30". 9 1983. 8 SUM(DECODE(TO CHAR(hiredate. giving each column an appropriate heading. SUM(DECODE(deptno. 12.0))"1982".1.1.0))"1983" 10 FROM emp. 2 SUM(DECODE(TO CHAR(hiredate. SQL> SELECT 2 3 4 5 6 FROM 7 GROUP BY job "Job".0))"1981".1.Practice 5 Solutions (continued) If you want extra challenge. 1981. Introduction to Oracle: SQL and PL/SQL A-16 . 3 1980. ename 2 FROM emp 3 WHERE deptno IN (SELECT 4 FROM 5 WHERE SQL> SAVE p6q3. Write a query that will display the employee number and name for all employees who work in a department with any employee whose name contains a T. Sort the results in descending order of salary. Introduction to Oracle: SQL and PL/SQL A-17 . deptno emp ename = 'BLAKE') Create a query to display the employee number and name for all employees who earn more than the average salary. Display the employee name. job emp deptno IN (SELECT FROM WHERE deptno dept loc = 'DALLAS'). and job title for all employees whose department location is Dallas. Exclude Blake.sql deptno emp ename LIKE '%T%'). 4. 3.Practice 6 Solutions 1. Save your SQL statement in a file called p6q3 . SQL> SELECT empno. ename 2 FROM emp 3 WHERE sal > (SELECT AVG(sal) 4 FROM emp) 5 ORDER BY sal DESC. hiredate emp deptno = (SELECT FROM WHERE ename != 'BLAKE'. deptno. department number. SQL> SELECT 2 FROM 3 WHERE 4 5 ename.sql Created file p6q3. SQL> SELECT 2 FROM 3 WHERE 4 5 6 AND ename. sq l. SQL> SELECT empno. Write a query to display the employee name and hire date for all employees in the same department as Blake. job 2 FROM emp 3 WHERE deptno IN (SELECT deptno 4 FROM dept 5 WHERE dname = 'SALES'). Modify p6q3 . name.sql SELECT empno.sql emp ename LIKE '%T%') Introduction to Oracle: SQL and PL/SQL A-18 . If ti ou have time. sql to display the employee number. and salary for all employees who eam more than the average salary and who work in a department with any employee with a T in their name.Practice 6 Solutions (continued) 5. complete the following exercise: 7. and job for all employees in the Sales depai itent. SQL> SELECT deptno. ename. name. Display the employee name and salary of all employees who report to King. sal 2 FROM emp 3 WHERE mgr = (SELECT empno 4 FROM emp 5 WHERE ename = 'KING'). Display the department number. sal FROM emp WHERE sal > (SELECT AVG(sal) FROM emp) AND deptno IN (SELECT deptno FROM WHERE SQL> START p6q7. ename. sql. Resave as p6q7 . SQL> EDIT p6q3. SQL> SELECT ename. 6. Rerun your query. department name. sal emp e. depagytiuent number. 0 ) (SELECT FROM WHERE emp ename = ' SCOTT ' ) 4.0)) IN sal. dept d e.deptno d. and salary of any employee whose department number and salary match the department number and salary of any employee who earns a commission. S QL> S ELEC T 2 FROM 3 WHERE 4 5 ename.Practice 7 Solutions 1. NV L (c o m m . sal emp (sal.0)) IN s a l. 7 AND SQL> SELECT 2 FROM 3 WHERE 4 5 6 ORDER BY Introduction to Oracle: SQL and PL/SQL A-19 sal DESC. deptno emp comm IS NOT NULL).loc = 'DALLAS'). sal emp (sal. NVL(comm. hire date. job. Create a query to display the name. Display the name. Write a query to display the name. deptno) IN (SELECT FROM sal. NVL(comm. 8 SQL> SELECT 2 FROM 3 WHERE 4 5 AND ename. sal emp sal s a l > A L L ( S E L E C T emp FROM WHERE job = 'CLERK') . 2. 3 AND 4 5 6 WHERE 3. deptno.0) (SELECT FROM emp e. and salary of any employee whose salary and 6 commission match the salary and commission of any employee located in Dallas.deptno = d. results != 'SCOTT'. NVL(comm. ename. hiredate. and salary for all employees who have the 7 same salary and commission as Scott. Sort theename on salary from highest to lowest.deptno = d.deptno (sal. Create a query to display the employees that earn a salary that is higher than the salary of 6 all of the clerks. WHERE SQL> SELECT 2 FROM WHERE ename. dname. dept d e. False The ACCEPT command is a SQL*Plus command. Introduction to Oracle: SQL and PL/SQL A-20 . it will pick up the value in the predefined variable. separated by a space and comma. If fact. job. 'MM/DD/YYYY') AND TO DATE('&hig171 date'. Save the script file as p 8 q 3 . 3.sql. job EMPLOYEES. A single ampersand substitution variable prompts at most once. It is issued at the SQL prompt. Use the format MM/DD/YYYY. then the single ampersand substitution variable will not prompt at all. and label the column Employees. SET ECHO OFF SET VERIFY OFF ACCEPT low date DATE FORMAT MM/DD/YYYY' PROMPT 'Please enter the low date range ("MM/DD/YYYY"): ACCEPT high_date DATE FORMAT 'MM/DD/YYYY' PROMPT 'Please enter the high date range ("MM/DD/YYYY"): COLUMN EMPLOYEES FORMAT A25 SELECT ename I I ' . Prompt the user for the two ranges using the ACCEPT command. hiredate FROM emp WHERE hiredate BETWEEN TO DATE('&low date'. Write a script file to display the employee name.Practice 8 Solutions Determine whether the following statements are true or false: 1. s ql. and hire date for all employees who started between a given range. Concatenate the name and job together. 'MM/DD/YYYY') UNDEFINE low date UNDEFINE high_date COLUMN EMPLOYEES CLEAR SET VERIFY ON SET ECHO ON SQL> START p8q3. 2. if the variable is defined. The ACCEPT command is a SQL command. False However. deptno = d.deptno AND LOWER(d. Write a script to display the employee name. Save the script file as p8q4 .loc) LIKE LOWER('qs&p_location%') UNDEFINE p_location COLUMN ename CLEAR COLUMN dname CLEAR SET VERIFY ON SET ECHO ON SQL> START p8q4. The search condition should allow for case-insensitive searches of the department location.ename. and department name for a given location. d. SET ECHO OFF SET VERIFY OFF ACCEPT p_location PROMPT 'Please enter the location name: ' COLUMN ename HEADING "EMPLOYEE NAME" FORMAT A15 COLUMN dname HEADING "DEPARTMENT NAME" FORMAT A15 SELECT e. sql. job.dname FROM emp e. dept d WHERE e.sql Introduction to Oracle: SQL and PL/SQL A-21 .job. e.Practice 8 Solutions (continued) 4. e.deptno AND LOWER(d.sql Introduction to Oracle: SQL and PL/SQL A -22 .loc) LIKE LOWER('%&p_location%') ORDER BY dname UNDEFINE p_ location COLUMN dname CLEAR COLUMN ename CLEAR COLUMN hiredate CLEAR COLUMN sal CLEAR COLUMN asal CLEAR CLEAR BREAK SET VERIFY ON SET FEEDBACK ON SET ECHO ON SQL> START p8c15. dept d WHERE e. e. SET ECHO OFF SET FEEDBACK OFF SET VERIFY OFF BREAK ON dname ACCEPT p_location PROMPT 'Please enter the location name: COLUMN dname HEADING "DEPARTMENTINAME" FORMAT A15 COLUMN ename HEADING "EMPLOYEEINAME" FORMAT A15 COLUMN hiredate HEADING "STARTIDATE" FORMAT A15 COLUMN sal HEADING "SALARY" FORMAT $99. Modify p 8 q4 . EMPLOYEE NAME. placing the labels on multiple lines.sal.sal * 12 asal FROM emp e. s ql to create a report containing the department name.990. Resave the script as p8q5.sql. e. Label the columns DEPARTMENT NAME. hire date.Practice 8 Solutions (continued) 5.deptno = d.990. SALARY and ANNUAL SALARY. START DATE.00 COLUMN asal HEADING "ANNUALISALARY" FORMAT $99. employee name. e. and each employees' annual salary for all employees in a given location. salary.00 SELECT d. Prompt the user for the location.dname.hiredate.ename. last_name. 'Betty'.Practice 9 Solutions Insert data into the MY_EMPLOYEE table. Introduction to Oracle: SQL and PL/SQL A-23 . Confirm your addition to the table. list the columns explicitly in the INSERT clause. 'Ralph'. Add the first row of data to the MY_ EMPLOYEE table from the following sample data. Do not list the columns in the INSERT clause. 'bdancs'. first_name. SQL> SELECT 2 FROM my employee. salary) 3 VALUES (2. ID LAST NAME Patel Danes Biri Newman Ropeburn FIRST NAME Ralph Betty Ben Chad Audry USERID rpatel bdancs bbiri cnewman aropebur SALARY 795 860 1100 750 1550 1 2 3 4 5 SQL> INSERT INTO my_employee 2 VALUES (1. 'rpatel'. 2 userid. 795). Populate the MY_EMPLOYEE table with the second row of sample data from the preceding list. SQL> START lab9 1. Run the lab 9 1 s q 1 script to build the MY_EMPLOYEE table that will be used for the lab. SQL> DESCRIBE my employee 3. 'Dancs'. 4.sql 2. Describe the structure of the MY_ EMPLOYEE table to identify the column names. This time. 'Patel'. 860). 1. SQL> INSERT INTO my_employee (id. 5. 9.sql SQL> START loademp. '&p_last_name'. SQL> START loademp. Concatenate the first letter of the first name and the first seven characters of the last name to produce the userid. Populate the table with the next two rows of sample data by running the script that you created. first name.Practice 9 Solutions (continued) 1. lower(substr('&p_first_name'. l&p_first_name'. Make the data additions permanent. Prompt the user for the employee's id. SET ECHO OFF SET VERIFY OFF ACCEPT p_id PROMPT 'Please enter the employee number: ' ACCEPT p_first_name PROMPT 'Please enter the employee"s first name: ' ACCEPT p last_ name PROMPT 'Please enter the employee"s last name: ' ACCEPT p salary PROMPT 'Please enter the employee"s salary:' INSERT INTO my_employee VALUES (&p_id. Create a script named loademp . last name. sql to load rows into the MY _ EMPLOYEE table interactively. Introduction to Oracle: SQL and PL/SQL A-24 . 1. 7)).sql Confirm your additions to the table. &p salary) SET VERIFY ON SET ECHO ON 2. SQL> SELECT 2 FROM * my_employee. SQL> COMMIT. 1. 1) II substr(T&p last name'. and salary. 10.sql Introduction to Oracle: SQL and PL/SQL A-25 . salary 2 FROM my employee. SQL> SELECT last name. SQL> UPDATE my employee 2 SET last name = 'Drexler' 3 WHERE id = 3. 16. SQ L> COM MIT. 3. 4. SQL> START loademp. Verify your changes to the table. Commit all pending changes. Confirm your changes to the table. Change the last name of employee 3 to Drexler. 2. Control data transaction to the MY EMPLOYEE table. SQL> UPDATE my_employee 2 SET sa lar y = 1 0 0 0 3 WHERE salary < 900.Practice 9 Solutions (continued) Update and delete data in the MY EMPLOYEE table. 1. SQL> DELETE 2 FR OM my emp lo ye e 3 WHERE last name = 'Dancs' 4 AND first name = 'Betty'. Populate the table with the last row of sample data by running the script that you created in step 6. Change the salary to 1000 for all employees with a salary less than 900. SQL> SELECT * 2 FROM m y employee. 11. Delete Betty Danes from the MY_EMPLOYEE table. Confirm that the table is empty.Practice 9 Solutions (continued) 1. 23. Discard the most recent DELETE operation without discarding the earlier INSERT operation. SQL> ROLLBACK TO SAVEPOINT a. Confirm your addition to the table. 2. SQL> DELETE 2 FROM my_employee. Introduction to Oracle: SQL and PL/SQL A-26 . SQL> SELECT * 2 FROM my_employee. SQL> SELECT * 2 FROM my employee. SQL> SAVEPOINT a. Empty the entire table. Make the data addition permanent. 6. 3. SQL> COMMIT. 5. Confirm that the new row is still intact. 4. Mark an intermediate point in the processing of the transaction. SQL> SELECT * 2 FROM my employee. Column Name Key Type Nulls/Unique FK Table FK Column Datatype Length Number 7 VARCHAR2 25 VARCHAR2 25 Number 7 ID LAST NAME FIRST NAME DEPT ID . Create the DEPARTMENT table based on the following table instance chart. Confirm that the table is created. 3. Populate the DEPARTMENT table with data from the DEPT table. SQL> INSERT INTO department 2 SELECT 3 FROM deptno. sql. s ql.sql CREATE TABLE department (id NUMBER (7) .sql SQL> DESCRIBE department 2. Create the EMPLOYEE table based on the following table instance chart. Column Name Key Type Nulls/Unique FK Table FK Column Datatype Length Number 7 Id Name VARCHAR2 25 SQL> EDIT plOql.Practice 10 Solutions 1. Enter the syntax in a script called p 10 q 1. then execute the script to create the table. dname dept. Enter the syntax in a script called plOq3 . Include only columns that you need. and then execute the script to create the table. Confirm that the table is created. name VARCHAR2 (25)) SQL> START plOql. I ntr oducti o n to Or acl e: SQL and PL/ SQL A-27 . SQL> CREATE TABLE employee2 AS 2 SELECT empno id. SQL> DESCRIBE employee 2. respectively.sql SQL> DESCRIBE employee 1. (Hint: USER TABLES) SQL> SELECT 2 FROM 3 WHERE table_ name user_ tables table name IN ('DEPARTMENT'. Rename the EMPLOYEE2 table to EMPLOYEE. 7. deptno dept id 3 FROM emp. and DEPT_ID. VARCHAR2(25). Name the columns in your new table ID. NUMBER(7)) SQL> START pl0q3. last name first name dept_id _ VARCHAR2(25). SQL> RENAME employee2 TO employee.Practice 10 Solutions (continued) CREATE TABLE employee (id NUMBER(7). LAST NAME. Drop the EMPLOYEE table. Confirm your modification. 'EMPLOYEE'). SQL> DROP TABLE employee. ename last name. Confirm that both the DEPARTMENT and EMPLOYEE tables are stored in the data dictionary. Create the EMPLOYEE2 table based on the structure of the EMP table. Introduction to Oracle: SQL and PL/SQL A-28 . Include only the EMPNO. SQL> ALTER TABLE employee 2 MODIFY (last_name VARCHAR2(50)). Modify the EMPLOYEE table to allow for longer employee last names. ENAME and DEPTNO columns. Drop all the UNUSED columns from the EMPLOYEE2 table. ENAME. SQL> DESCRIBE employee2 Introduction to Oracle: SQL and PL/SQL A-29 .Practice 10 Solutions (continued) 9. SQL> COMMENT ON TABLE department IS 'Department Information' SQL> COLUMN table name FORMAT A15 SQL> COLUMN table_type FORMAT A10 SQL> COLUMN comments FORMAT A40 SQL> SELECT * 2 FROM user tab comments 3 WHERE table name = 'DEPARTMENT' 4 OR table name = 'EMPLOYEE'. Include only the EMPNO. Confirm your modification by checking the description of the table. Confirm your modification by checking the description of the table. SQL> DESCRIBE employee2. Confirm your modification by checking the description of the table. SQL> CREATE TABLE employee2 AS 2 SELECT empno id. and DEPTNO columns. S Q L > AL T E R T A BL E e m p l o ye e 2 2 DROP UNUSED COLUMNS. 12. Confirm your additions in the data dictionary. LAST_NAME. SQL> DESCRIBE employee 11. 10. SQL> COMMENT ON TABLE employee IS 'Employee Information'. Create the EMPLOYEE2 table based on the structure of the EMP table. Name the columns in your new table ID. Mark the DEPT_ID column in the EMPLOYEE2 table as UNSUED. respectively. and DEPT_ID. SQL> ALTER TABLE employee 2 DROP COLUMN LAST NAME. ename last name. deptno dept_id 3 FROM emp 4 / SQL> ALTER TABLE employee2 2 SET UNUSED (dept_id). Drop the column LAST_NAME from the EMPLOYEE table. Add a comment to the DEPARTMENT and EMPLOYEE table definitions describing the tables. SQL> ALTER TABLE employee 2 ADD (salary NUMBER(7)). Add a table-level PRIMARY KEY constraint to the EMPLOYEE table using the ID column.Practice 11 Solutions 1. Notice that the new tables and a new index were created. Save your statement text in a file called pl1q4 . _ If you have time. SQL> SAVE pl1q4. sql. Modify the EMPLOYEE table. SQL> SELECT constraint _ name. constraint _ type 2 FROM user constraints 3 WHERE table name IN ('EMPLOYEE'. The constraint should be enabled at creation. Display the object names and types from the USER_OBJECTS data dictionary view for EMPLOYEE and DEPARTMENT tables. SQL> ALTER TABLE 2 ADD CONSTRAINT employee employee id pk PRIMARY KEY (id). You may want to format the columns for readability. Add a foreign key reference on the EMPLOYEE table that will ensure that the employee is not assigned to a nonexistent department. Introduction to Oracle: SQL and PL/SQL A-30 . object type user objects object name LIKE 'EMPLOYEE' object_name LIKE 'DEPARTMENT%'. Add a SALARY column of NUMBER datatype. SQL> COLUMN object_name FORMAT A30 SQL> COLUMN object_type FORMAT A30 SQL> SELECT 2 FROM 3 WHERE 4 OR object name. The constraint should be enabled at creation. precision 7. Note the types and names of the constraints. 'DEPARTMENT'). Confirm that the constraints were added by querying USER CONSTRAINTS. 3. SQL> ALTER TABLE employee 2 ADD CONSTRAINT employee_dept_id_fk FOREIGN KEY (dept_id) 3 REFERENCES department(id). SQL> ALTER TABLE 2 ADD CONSTRAINT department department id pk PRIMARY KEY(id). 2.sql 5. Create a PRIMARY KEY constraint on the DEPARTMENT table using the ID column. complete the following exercise: 6. deptno department_id FROM emp WHERE deptno = 20 WITH CHECK OPTION CONSTRAINT empdept20. text user views. deptno emp vu. Change the heading for the employee name to EMPLOYEE. Display the contents of the EMP_VU view. Introduction to Oracle: SQL and PL/SQL A-31 . EMPLOYEE. Select the view name and text from the data dictionary USER_VIEWS. Using your view EMP_VU. SQL> COLUMN view name FORMAT A30 SQL> COLUMN text FORMAT A50 SQL> SELECT 2 FROM view_ name. employee name. SQL> CREATE VIEW emp_vu AS 2 SELECT 3 FROM empno. and department number from the EMP table. SQL> SELECT 2 FROM emp vu. enter a query to display all employee names and department numbers. employee name. Create a view called EMP_VU based on the employee number. deptno emp. SQL> SELECT 2 FROM employee. Label the view column EMPLOYEE JD. ename employee. ename employee. 2. and DEPARTMENT JD. Do not allow an employee to be reassigned to another department through the view. Create a view named DEPT20 that contains the employee number. and department number for all employees in department 20. SQL> CREATE VIEW dept20 AS 2 3 4 5 6 SELECT empno employee id.Practice 12 Solutions 1. 1. Display the structure and contents of the DEPT20 view. Create a view called SALARY VU based on the employee name. 3 sal salary.sal between s.deptno = d. If you have time. Introduction to Oracle: SQL and PL/SQL A-32 . grade 4 FROM emp e.hisal. salgrade s 5 WHERE e. dept d.deptno 6 AND e.losal and s. SQL> UPDATE dept20 2 SET department id = 30 3 WHERE employee = 'SMITH'.Practice 12 Solutions (continued) 1. complete the following exercise: 8. respectively. 2. SQL> DESCRIBE dept20 SQL> SELECT * 2 FROM dept20. SQL> CREATE VIEWsalary vu AS 2 SELECT ename employee. Department Salary. department name. Label the columns Employee. and Grade. Attempt to reassign Smith to department 30. salary and salary grade for all employees. dname department. SQL> CREATE SEQUENCE dept_id seq 2 START WITH 60 3 INCREMENT BY 10 4 MAXVALUE 200. maximum value. and last number.sql 3. last_ number user sequences SQL> START pl3q2. Confirm your additions. Name the sequence DEPT_ID_SEQ. FROM increment by. Execute your script. Have your sequence increment by ten numbers. Create a customized prompt to enter the department name. Write a script to display the following information about your sequences: sequence name.sql SET ECHO OFF SET VERIFY OFF ACCEPT name PROMPT 'Please enter the department name: INSERT INTO department (id. name) VALUES (dept id seq. Add two departments named Education and Administration. Introduction to Oracle: SQL and PL/SQL A-33 . SQL> CREATE INDEX employee dept ididx ON employee (dept id). increment size. max value. Write an interactive script to insert a row into the DEPARTMENT table. Be sure to use the sequence that you created for the ID column. Execute your script. The sequence should start at 60 and have a maximum value of 200. Create a non-unique index on the foreign key column (dept_id) in the EMPLOYEE table. sql. SQL> EDIT pl3q3. Name your script p 13 q 3 . s ql . SQL> EDIT p13q2.sql SELECT sequence name.NEXTVAL. '&name') SET VERIFY ON SET ECHO ON SQL> START p13q3.Practice 13 Solutions 1. Name the script p 13 q2 .sql SQL> SELECT * 2 FROM department. Create a sequence to be used with the primary key column of the DEPARTMENT table. SQL> SAVE p13q5. SQL> SELECT index name. Display the indexes and uniqueness that exist in the data dictionary for the EMPLOYEE table. table name.sql Introduction to Oracle: SQL and PL/SQL A-34 . s ql. Save the statement into a script named pl3q5 . uniqueness 2 FROM user indexes 3 WHERE table name = 'EMPLOYEE'.Practice 13 Solutions (continued) 5. Grant another user access to your DEPT table. 7. What would you use to make your job easier? Create a role containing the system privileges and grant the role to the users 5. Team 1 executes the GRANT statement. SQL> GRANT 2 ON select dept 3 TO <u serl>. You are the DBA. You are creating many users who require the same system privileges. What privilege should a user be given to log in to the Oracle Server? Is this a system or an object privilege? The CREATE SESSION system privilege 2.Practice 14 Solutions 1. What privilege should a user be given to create tables? The CREATE TABLE privilege 3. What command do you use to change your password? The ALTER USER statement 6. SQL> SELECT 2 FROM dept . SQL> GRANT 2 ON 3 TO select dept <user2>. WHERE userl is the name of team 1 and user2 is the name of team 2. Query all the rows in your DEPT table. or anyone you have given those privileges to by using the WITH GRANT OPTION. Team 2 executes the GRANT s t a t e m e n t . Have the user grant you query access to his or her DEPT table. who can pass along privileges to other users on your table? You can. If you create a table. . 4. Introduction to Oracle: SQL and PLISQL A-35 . T e a m 1 e x e c u t e s t h i s S E L E C T s t a t e m e n t . DEPT.r2>.z />. SQL> S E L E C T * . Create a synonym for the other team's DEPT table.Practice 14 Solutions (continued) 8. SQL> SELECT 2 FROM 2 team2. Make the changes permanent. SQL> INSERT INTO dept (deptno. DEPT . Team 2 should add Administration as department number 50. S QL> COMMI T. 2 VALUES (50. dname) Team 2 executes this INSERT statement. execu tes th is SELECT Team statement. Team 1 creates a synonym named SQL> CREATE SYNONYM team2 2 FOR <use. team2_ Team 2 creates a synonym named team] . 'Education ') . Team 1 executes thjs INSERT statement. 'A d min is tr a tio n ' ) . - 10. Add a new row to vour DEPT table. SQL> CREAT E SYNONYM teaml 2 FOR <use. 9. Team 1 should add Education as department number 50. Query all the rows in the other team's DEPT table by using your synonym. dname) 2 V A L U E S ( 5 0 . SQL> INSERT INTO dept (deptno. S QL> COMMI T. 2 FROM teaml- IntrocluctxOn to Oracle: SQL ancl PE/SQL A-36 . owner 2 FROM all tables 3 W H E R E o w n e r ! = <y o u r a cco u n t>. SQL> REVOKE select 2 ON dept 3 FROM userl. SQL> SELECT tablename. Introduction to Oracle: SQL and PL/SQL A-37 . Query the USER TABLES data dictionary to see information about the tables that you own. S Q L > S E L E C T ta b l e n a m e 2 FROM user tables. 13. Team 2 revokes the privilege. SQL> REVOKE select 2 ON dept 3 FROM u s e r 2 . Revoke the SELECT privilege from the other team. Query the ALL_TABLES data dictionary view to see information about all the tables that you can access. Team 1 revokes the privilege. 2. Exclude tables that you own.Practice 14 Solutions (continued) 1. VARCHAR2(30). Table name: MEMBER Column_ Name Key Type Null/ Unique Default Value Datatype Length MEMBER ID PK NN. Create the tables based on the following table instance charts. a. Introduction to Oracle: SQL and PL/SQL A 38 - .U NN NN System Date Number 10 VARCHAR2 25 VARCHAR2 25 VARCHAR2 100 VARCHAR2 30 VARCHAR2 15 Date LAST_ NAME FIRST NAME ADDRESS CITY PHONE JOIN DATE CREATE TABLE member (member id NUMBER(10) CONSTRAINT member member id pk PRIMARY KEY. VARCHAR2(100). VARCHAR2(15). last name VARCHAR2(25) CONSTRAINT member last name nn NOT NULL. DATE DEFAULT SYSDATE CONSTRAINT member join date nn NOT NULL). Choose the appropriate datatypes and be sure to add integrity constraints. first_ name address city phone join date VARCHAR2(25).Practice 15 Solutions 1. Practice 15 Solutions (continued) b. 'NC17'. NC17. Introduction to Oracle: SQL and PL/SQL A-39 . description VARCHAR2(400) CONSTRAINT title_ description nn NOT NULL.U NN NN G. Table name: TITLE Column_ Name Key Type Null/ Unique Check TITLE_ ID PK NN. COMEDY. 'COMEDY'. PG. 'CHILD'. R. DOCUMEN TARY VARCHAR2 20 TITLE DESCRIPTION RATING CATEGORY RELEASE_ DATE Datatype Length Number 10 VARCHAR2 60 VARCHAR2 400 VARCHAR2 4 Date CREATE TABLE title (title id NUMBER(10) CONSTRAINT title title id pk PRIMARY KEY. 'SCIFI'. release dateDATE). ACTION. CONSTRAINT title category_ck CHECK (category IN ('DRAMA'. 'PG'. 'DOCUMENTARY')). NR DRAMA. CHILD. SCIFI. 'NR')). 'ACTION'. category VARCHAR2(20). title VARCHAR2(60) CONSTRAINT title title nn NOT NULL. 'R'. rating VARCHAR2(4) CONSTRAINT title rating ck CHECK (rating IN ('G'. DESTROYED. RESERVED FK Ref Table FK Ref Col Datatype Number TITLE TITLE ID Number VARCHAR2 Length 10 10 15 CREATE TABLE title copy (copy_id title id NUMBER(10). NUMBER(10) CONSTRAINT title_copy_title if fk REFERENCES title(title_id).U TITLE ID PK. 'DESTROYED'. title id)).'RENTED'. 'RESERVED')).FK NN.Practice 15 Solutions (continued) c. RENTED. CONSTRAINT title_copy_copy_id_title_id_pk PRIMARY KEY (copyid. . status VARCHAR2(15) CONSTRAINT title copy status nn NOT NULL CONSTRAINT title copy status ck CHECK (status IN ('AVAILABLE'.U STATUS Key Type Null/ Unique Check NN AVAILABLE. Table name: TITLE COPY Column Name COPY_ ID PK NN. I ntr oducti on to Or acle: SQL and PL/SQL A -40 . FK2 ACT RET DATE EXP RET DATE TITLEJD PK FK2 2 days after book date TITLE_ COPY TITLEJD Number 10 CREATE TABLE rental (book date DATE DEFAULT SYSDATE.Practice 15 Solutions (continued) d. Table name: RENTAL Column Name Key Type Default Value FK Ref Table FK Ref Col Datatype Length Date BOOK_ DATE PK System Date MEMBER MEMBER_ ID Number 10 TITLE_ COPY COPYJD Number 10 Date Date MEMBER_ ID PK. title id DATE. Introduction to Oracle: SQL and PL/SQL A-41 . CONSTRAINT rental book_ date_copy_titlepk PRIMARY KEY (book date. member id copy_id NUMBER(10) CONSTRAINT rental member id fk act ret date REFERENCES member(member id).title_id). member id. title id) REFERENCES title copy(copy id. exp_ret_date NUMBER(10). DATE DEFAULT SYSDATE + 2 NUMBER(10). title id)). CONSTRAINT rental copy id title id fk FOREIGN KEY (copy_id.FK1 COPY_ ID PK. copy_id. member id NUMBER(10) CONSTRAINT reservation_ member id REFERENCES member(member id). Introduction to Oracle: SQL and PL/SQL A-42 .U MEMBER_ID PK. CONSTRAINT reservation resdate mem tit pk PRIMARY KEY (res date.FK2 NN TITLE TITLE ID Number 10 Unique FK Ref Table FK Ref Column Datatype Length Date Number 10 CREATE TABLE reservation (res date DATE. Table name: RESERVATION Column_Name Key Type Null/ RES_DATE PK NN. title id)).Practice 15 Solutions (continued) e.FK1 NN. title id NUMBER(10) CONSTRAINT reservation title_ id REFERENCES title(title_id).U MEMBER MEMBER_ID TITLEJD PK. member id. Name the sequence member_id_seq. 'RESERVATION'). increment by.Practice 15 Solutions (continued) 2. table_ name user constraints table_ name IN ('MEMBER'. 4 'TITLE ID SEQ'). SQL> CREATE SEQUENCE title id seq 2 START WITH 92 3 NOCACHE. do not allow caching of the values. Title number for the TITLE table: start with 92: no caching. last_ number 2 FROM user_sequences 3 WHERE sequence_name IN ('MEMBER ID SEQ'. c. b. 3. Name the sequence title_id_seq. a. 'RENTAL'. 'RENTAL'. Member number for the MEMBER table: start with 101. constraint_ type. 'TITLE COPY'. 'TITLE'. 'RESERVATION'). Verify the existence of the sequences in the data dictionary. 'TITLE'. 'TITLE_COPY'. Create sequences to uniquely identify each row in the MEMBER table and the TITLE table. SQL> CREATE SEQUENCE member id seq 2 START WITH 101 3 NOCACHE. SQL> SELECT sequence_name. SQL> COLUMN constraint_ name FORMAT A30 SQL> COLUMN table name FORMAT A15 SQL> SELECT 2 3 FROM 4 5 WHERE constraint_ name. Verify that the tables and constraints were created properly by checking the data dictionary. Introduction to Oracle: SQL and PL/SQL A-43 . SQL> SELECT 2 FROM 3 WHERE 4 table name user tables table_ name IN ('MEMBER'. NEXTVAL. Verify your additions. All of Willie"s friends make a Christmas list for Santa.'DD-MON-YYYY')) INSERT INTO title(title_id. TO DATE( '12-AUG-1995'. rating. My Day Off'. 'G'. category. rating. description. a teenager skips school for a day in New York. Create a script for each set of data to add. but Willie has yet to add his own wish list. Use the sequences to uniquely identify each title. release date) VALUES (title id seq. rating. SQL> EDIT pl5q4a. Remember that single quotation marks in a character field must be specially handled.NEXTVAL. 'CHILD'.NEXTVAL. 'Alien Again'. 'The Glob'.Practice 15 Solutions (continued) 4. rating. Write a script to enter the movie information.'.'DD-MON-YYYY ) 1 INSERT INTO title(title id . description. 'NR'. description. 'R'.'. title. 'With a little luck and a lot ingenuity. TO DATE( '19-MAY-1995'. Add data to the tables. a. TO DATE( '12-JUL-1995'.'DD-MON-YYYY')) INSERT INTO title(title id. release date) VALUES (title id seq. 'Yet another installment of science fiction history. 'COMEDY'. category. Can the heroine save the planet from the alien life form?'.'. 'A meteor crashes near a small American town and unleashes carnivorous goo in this classic. description. Enter the release dates in the DD-MON-YYYY format. TO DATE('05-OCT-1995'.NEXTVAL. Add movie titles to the TITLE table. title.sql SET ECHO OFF INSERT INTO title(title id.'DD-MON-YYYY')) COMMIT Introduction to Oracle: SQL and PL/SQL A -44 . release_date) VALUES (title id seq. 'SCIFI'. 'SCIFI'. title. category. release_date) VALUES (title id seq. Save the script as p 15 q4a sql. category. title. 'Willie and Christmas Too'. 'PG'. .SET ECHO ON SQL> SELECT 2 FROM title title. but Willie has yet to add his own wish list. a young couple find themselves pitted against a vicious gang.Practice 15 Solutions (continued) Title Willie and Christmas Too Alien Again Description All of Willie's friends make a Christmas list for Santa. With a little luck and a lot of ingenuity. Yet another installation of science fiction history. but she discovers that miracles really do exist. Rating G Category CHILD Release_date 05-OCT-1995 R SCIFI 19-MAY-1995 The Glob NR SCIFI 12-AUG-1995 My Day Off PG COMEDY 12-JUL-1995 Miracles on Ice PG DRAMA 12-SEP-1995 Soda Gang NR ACTION 01-JUN-1995 Introduction to Oracle: SQL and PL/SQL A-45 . a teenager skips school for a day in New York A six-year-old has doubts about Santa Claus. After discovering a cache of drugs. Can the heroine save the planet from the alien life form? A meteor crashes near a small American town and unleashes carnivorous goo in this classic. Add data to the MEMBER table. Write a script named p 15 q 4b . city. phone. '&phone'. First_ Name Carmen LaDoris Midori Mark Audry Molly Last_Name Velasquez Ngao Nagayama Quick-toSee Ropeburn Urguhart Address City Phone Join Date 283 King Street Seattle 5 Modrany Bratislava 206-899-6666 08-MAR-1990 586-355-8882 08-MAR-1990 254-852-5764 17-JUN-1991 63-559-7777 07-APR-1990 18-JAN-1991 68 Via Centrale Sao Paolo 6921 King Way 86 Chu Street 3035 Laurier Lagos Hong Kong 41-559-87 Quebec 418-542-9988 18-JAN-1991 SQL> EDIT pl5q4b.sql _ Introduction to Oracle: SQL and PL/SQL A-46 . address. TODATE('&joindate'. '&city'. last name.sql SET ECHO OFF SET VERIFY OFF INSERT INTO member(member id. '&last_name'.Practice 15 Solutions (continued) b. Be sure to use the sequence to add the member numbers. join date) VALUES (member_id_seq. first name. Execute the script. 'DD-MM-YYYY') COMMIT SET VERIFY ON SET ECHO ON SQL> START pl5q4b. '&address'. '&first_name'.NEXTViii. sql to prompt users for the information. 95.Practice 15 Solutions (continued) c. Add the following movie copies in the TITLE COPY table: Note: Have the title id numbers available for this exercise. 'AVAILABLE'). Title Copy_Id Willie and Christmas Too 1 Alien Again 1 2 The Glob 1 My Day Off 1 2 3 Miracles on Ice 1 Soda Gang 1 SQL> 2 SQL> 2 SQL> 2 SQL> 2 SQL> INSERT SQL> INSERT 2 VALUES VALUES INSERT VALUES INSERT VALUES INSERT VALUES INSERT Status AVAILABLE AVAILABLE RENTED AVAILABLE AVAILABLE AVAILABLE RENTED AVAILABLE AVAILABLE SQL> INSERT INTO title_copy(copy_id. 2 VALUES SQL> INSERT 2 VALUES SQL> INSERT 2 VALUES . 2 VALUES (2. ' AVAI LABL E ' ). status) title id. status) title id. 'AVAILABLE' ). title_copy( INTO title copy(copy_id. status) title id. INTO title_copy( copy_id. status) title id. (1. 95. status) Introduction to Oracle: SQL and PL/SQL A-47 . 'AVAILABLE' ). (1. INTO title_copy( copy_id. 93. INTO title_copy( copyid. title id. status) title id. 94. (3. (1. INTO title_copy( copy_id.INTO 'AVAILABLE'). 'RENTED') . 'RENTED'). status) title id. 1. 97. INTO title copy(copy_i d. (1. 92. 'AVAILABLE'). INTO title copy(copy_i d. status) title id. copy_id. 2. 95. 9 3. 'AVAILABLE' ). 96. status) title id. (1. INSERT INTO SQL> COMMIT. Title_ Copy_ Id Id 92 1 Member_ Id 101 101 102 106 Book date 3 days ago 1 day ago 2 days ago 4 days ago Exp_Ret_Date 1 day ago 1 day from now Today 2 days ago Act Ret Date 2 days ago 93 95 97 2 3 1 2 days ago SQL> INSERT INTO 2 SQL> INSERT INTO 2 3 VALUES (92. Add the following rentals to the RENTAL table: Note: Title number may be different depending on sequence number. SQL> 3 VALUES (97. 2 3 VALUES (93.Practice 15 Solutions (continued) d. SQL> INSERT INTO 2 3 VALUES (95. . act ret:date) 1. copy_id. 101. sysdate-2). copy_id. member id. book date. exp_ret_date. NULL).act ret_Iate) 1. copy_id. exp_ret_date. act ret date) — 2. book date. member id. book date. Introduction to Oracle: SQL and PL/SQL A-48 . act_ret:date) 3. sysdate-2. id. 106. sysdate-17 sysdate2).rental(title sysdate. exp_ret_date. rental(title id. sysdate1. member id. 102. rental(title id. 101. sysdate-4. rental(title id. exp ret date. member id. copy_id. sysdate-2. sysdate-3. sysdate1. book date. NULL). 101. c. rating.title.title id c.status.exp_ret_date title t. c. description.copy_id.Practice 15 Solutions (continued) 5. 'Interstellar Wars'. member id. Add a new title. title_copy c. Can the rebels save the humans from the evil empire?" Be sure to add a title copy record for two copies. Query all rows from the view. INSERT INTO title(title id. titleid. 98. r.title id(+). release_date) VALUES (title id seq. 'AVAILABLE') INSERT INTO title copy (copy_id. who wants to rent "Soda Gang. Order the results by title.title id = r.copy_id(+) c. SQL> COLUMN title FORMAT A30 SQL> SELECT 2 FROM title avail 3 OR DER BY ti tl e. The movie is "Interstellar Wars. SQL> CREATE VIEW title avail AS 2 3 4 5 6 SELECT FROM WHERE AND AND t. Enter two reservations. The description is "Futuristic interstellar action movie. status) VALUES (2. title id. 'SCIFI'. 98. ." SQL> INSERT INTO reservation (res _ date." which is rated PG and classified as a sci-fi movie. The release date is 07-JUL-77. status) VALUES (1. rental r t.copy_id = r. 98). One reservation is for Carmen Velasquez. category.title id = c. 1. 'PG'. who wants to rent "Interstellar Wars. Create a view named TITLE AVAIL to show the movie titles and the availability of each copy and its expected return date if rented. Make changes to data in the tables. 'AVAILABLE') 2. 'Futuristic interstellar action movie. cop y_i d.NEXTVAL." The other is for Mark Quick-to-See. '07-JUL-77') INSERT INTO title copy (copy_id. title id) 2 VALUES (SYSDATE. title. Can the rebels save the humans from the evil Empire?'. 97). title id) 2 VALUES (SYSDATE. 104. member_id.SQL> INSERT INTO reservation (res_date. Introduction to Oracle: SQL and PL/SQL A-49 . Veri fy that the rental was recorded b y using the view you created. . . Remove h er r es e r vat i on fo r t h e m o vi e.Practice 15 Solutions (continued) c. Cu st omer Carmen Velas q uez ren t s t h e movi e "In t ers t ellar War s . " c op y 1 . member_id) 2 VALUES (98. The column should have a total length of eight digits and two decimal places. a. reservation 2 FROM 3 WHERE member id = 101. SQL> INSERT INTO rental(title id.101). Rec ord t h e i n fo rm at i on ab ou t t h e ren t a l . Add a PRICE column to the TITLE table to record the purchase price of the video. Verify your modifications. Make a modification to one of the tables. SQL> SELECT 2 FROM title_avail 3 OR DE R BY t it le . SQL> ALTER TABLE title 2 ADD (price SQL> DESCRIBE title NUMBER (8 2) ) . SQL> UPDATE 2 SET 3 WHERE 4 AND SQL> DELETE title_copy status= 'RENTED' title id = 98 copy id = 1. 1. 7. A l l o w t h e d e fau lt value for the expected return date to be used. copy id. co p y id . Introduction to Oracle: SQL and PLISQL l\-50 . Note: Have the title id numbers available for this exercise. sql to update each video with a price according to the following list. SQL> ALTER TABLE title 2 MODIFY (price CONSTRAINT title_price_nn NOT NULL). Introduction to Oracle: SQL and PL/SQL A-51 . constraint_ type. SQL> SELECT constraint_ name. Create a script named pl5q7b . Verify the constraint. Title Price Willie and Christmas Too Alien Again The Glob MV Day Off Miracles on Ice Soda Gang Interstellar Wars SET ECHO OFF SET VERIFY OFF UPDATE SET WHERE 25 35 35 35 30 35 29 title price = &price title id = &title id SET VERIFY OFF SET ECHO OFF SQL> START pl5q7b.Practice 15 Solutions (continued) 1. 2 search condition 3 FROM user_ constraints 4 WHERE table name = 'TITLE'. Ensure that in the future all titles will contain a price value.sql 2. and duration of rentals.member id = m.first namell"Ilm.title id = t. movie rented.Practice 15 Solutions (continued) 8. r. r.sql SET ECHO OFF SET VERIFY OFF SET PAGESIZE 30 COLUMN member FORMAT Al7 COLUMN title FORMAT A25 COLUMN book date FORMAT A9 COLUMN duration FORMAT 9999999 TTITLE 'Customer History Report' BREAK ON member SKIP 1 ON REPORT SELECT m. dates of the rental.title.member id r. sql.book date. Save the script in a file named pl5q8 .book date DURATION FROM WHERE AND ORDER BY member m. rental r r. SQL> EDIT pl5q8.title id member _ _ CLEAR BREAK COLUMN member CLEAR COLUMN title CLEAR COLUMN book date CLEAR COLUMN duration CLEAR TTITLE OFF SET VERIFY ON SET PAGESIZE 24 SET ECHO ON _ Introduction to Oracle: SQL and PL/SQL A-52 .last name MEMBER.r.act ret date . Be sure to include the customer name. title t. Create a report titled Customer History Report. This report will contain each customer's history of renting videos. t. Total the number of rentals for all customers for the reporting period. Evaluate each of the following declarations. Determine which of them are not legal and explain why. Illegal because only one identifier per declaration is allowed 3. DECLARE v birthdate DATE NOT NULL. Illegal because the NOT NULL variable must be initialized 4.Practice 16 Solutions 1. DECLARE v in stock BOOLEAN := 1. 1. 2. vz VARCHAR2 (10 ) . DECLARE v_x . DECLARE v id Legal NUMBER (4) . Illegal because 1 is not a Boolean expression Introduction to Oracle: SQL and PL/SQL A-53 . vy . SYSDATE. 3. v sender := USER ' II TO CHAR (v dept no) .sql G MESSAGE My PL/SQL Block Works Introduction to Oracle: SQL and PL/SQL A-54 . 1. 2. v days to go Number := v due date . 6.Practice 16 Solutions (continued) 2. Illegal. determine the datatype of the resulting expression. PL/SQL cannot convert special symbols from VARCHAR2 to NUMBER 4. : = N UL L . END. In each of the following assignments. Character string v sum := $100.000 + $250. / PRINT grnessage SQL> START p16q3. v n1 Boolean v value := v n2 > (2 * v n3) . VARIABLE grnessage VARCHAR2(30) BEGIN :g_message := 'My PL/SQL Block Works'.000. Create an anonymous block to output the phrase "My PL/SQL Block Works" to the screen. v flag Boolean := TRUE. Any scalar datatype 3. 5. 1. complete the following exercise: 4.1. v char NUMBER (11.2)). END. PRINT g_char PRINT g_num SQL> START p16g4. :g_num := v_num.2) . Save your PL/SQL block to a file named pl6q4 . NUM VARIABLE g_char VARCHAR2 (30) VARIABLE gnum NUMBER DECLARE VARCHAR2 (30) . Create a block that declares two variables.Practice 16 Solutions (continued) If you have time.sgl G CHAR 42 is the answer G NUM 42 . Execute your PL/SQL block. sql. :g_char := v_char. CHAR 2. v num BEGIN := '42 is the answer'. v char v num := TO NUMBER(SUBSTR(v char. Assign the value of these PL/SQL variables to SQL*Plus host variables and print the results of the PL/SQL variables to the screen. NUM Number Assign values to these variables as follows: Variable Value The literal '42 is the answer' The first two characters from V CHAR 1. CHAR Character (variable length) 2. Introduction to Oracl e: S QL and PL/SQ L A -5 5 . END. END. BEGIN /*SUBBLOCK*/ DECLARE v weight NUMBER(3) := 1. Introduction to Oracle: SQL and PL/SQL A-56 . v message VARCHAR2(255) := 'Product 11001'. v new locn VARCHAR2(50) := 'Europe'.Practice 17 Solutions PL/SQL Block DECLARE v weight NUMBER(3) := 600. v message VARCHAR2(255) := 'Product 10012'. v new locn := 'Western ' 11 v new locn. BEGIN v weight := v weight + 1. v message := v message II ' is in stock'. v weight := v weight + 1. v new locn := 'Western ' 11 v new locn. Evaluate the PL/SQL block on the previous page and determine the datatype and value of each of the following variables according to the rules of scoping. The value of V WEIGHT in the main block is: "601" and the datatype is NUMBER. The value of V NEW LOCN in the subblock is: "Western Europe" and the datatype is VARCHAR2. 2. Introduction to Oracle: SQL and PL/SQL A-57 . e.Practice 17 Solutions (continued) 1. The value of V NEW LOCN in the main block is: Illegal because v_new_locn is not visible outside the subblock. The value of V WEIGHT in the subblock is: "2" and the datatype is NUMBER. 3. 4. 1. The value of V MESSAGE in the main block is: "Product 10012 is in stock" and the datatype is VARCHAR2. v „ credit rating. v customer NUMBER(7) := 201. isv name 1' •v credit ratingl _ - Introduction to Oracle: SQL and PL/SQL A-58 . BEGIN 1r customer) 17 name ). v name VARCHAR2(25) := 'Unisports'. END.Practice 17 Solutions (continued) Scope Example DECLARE v customer v credit rating BEGIN DECLARE VARCHAR2(50) := 'Womansport'. VARCHAR2(50) := 'EXCELLENT'. - ------v customer -----END. f The value of VCREDITRATING in the main block is: "EXCELLENT" and the datatype is VARCHAR2. as shown on the previous page. V_CUSTOMER and V_ NAME. e. You also declare two variables. The value of V_CUSTOMER in the main block is: "Womansport" and the datatype is VARCHAR2. in the subblock. V_CUSTOMER and V_CREDIT_RATING. The value of V NAME in the subblock is: "Unisports" and the datatype is VARCHAR2. The value of V_CREDIT_RATING "EXCELLENT" and the datatype is VARCHAR2. in the main block. You declare two variables. The value of V_AME in the main block is: V_NAME is not visible in the main block and you would see an error.Practice 17 Solutions (continued) 2. 2. The value of V CUSTOMER in the subblock is: "201" and the datatype is NUMBER. Determine the values and datatvpes for each of the following cases. Suppose you embed a subblock within a block. 1. 4. . in the subblock is: 3. Introduction to Oracle: SQL and PL/SQL A-59 . 2) := &pnum2. a. The first number should be divided by the second number and have the second number added to the result.2) .2) := &pnuml. /* Printing the PL/SQL variable */ DBMS OUTPUT.PUT LINE (v_result). The result should be stored in a PL/SQL variable and printed on the screen. / SET SERVEROUTPUT OFF SET VERIFY ON SET ECHO ON Note: Solution continued on next page. Introduction to Oracle: SQL and PL/SQL A-60 . BEGIN v result := (v numl/v num2) + v num2.Practice 17 Solutions (continued) 3. Create and execute a PL/SQL block that accepts two numbers through SQL*Plus substitution variables. END. v result NUMBER(9. When a PL/SQL variable is used: SET ECHO OFF SET VERIFY OFF SET SERVEROUTPUT ON ACCEPT pnuma PROMPT 'Please enter the first number: ' ACCEPT pnum2 PROMPT 'Please enter the second number: ' DECLARE v numl v num2 NUMBER(9. NUMBER(9. or the result should be written to a SQL*Plus variable and printed to the screen. / PRINT gresult /* Printing the SQL*Plus variable SET VERIFY ON SET ECHO ON Introduction to Oracle: SQL and PL/SQL A-61 .2) := &pnum2.Practice 17 Solutions (continued) b. NUMBER(9. When a SQL*Plus variable is used: SET ECHO OFF SET VERIFY OFF VARIABLE g result NUMBER ACCEPT pnuml PROMPT 'Please enter the first number: ' ACCEPT pnum2 PROMPT 'Please enter the second number: DECLARE v numl v num2 BEGIN :g result := (v numl/v num2) + v num2. END.2) := &pnuml. NUMBER(9. Practice 17 Solutions (continued) 4. Reminder: Use the NVL function to handle null values. v_bonus NUMBER := &p bonus. BEGIN :g_total := NVL(v_salary. Note: To test the NVL function. / SET VERIFY ON SET SERVEROUTPUT OFF Introduction to Oracle: SQL and PL/SQL A-62 . When a SQL*Plus variable is used: SET VERIFY OFF SET SERVEROUTPUT ON ACCEPT p_salary PROMPT 'Please enter the salary amount: ' ACCEPT p_bonus PROMPT 'Please enter the bonus percentage: ' DECLARE v_salary NUMBER := &p salary. END.put line(TO CHAR(NVL(v salary. - 1. 15 to . and the bonus needs to be converted from a whole number to a decimal (for example. END.15). type NULL at the prompt. Build a PL/SQL block that computes the total compensation for one year.scil 2. set it to zero before computing the total compensation. 0) / 100). 0) * (1 + NVL(v_bonus. / PRINT g_total SET VERIFY ON SQL> START p17g4. BEGIN dbms output. 0) * (1 + NVL(v_bonus. The annual salary and the annual bonus percentage are passed to the PL/SQL block through SQL*Plus substitution variables. 0) / 100))). pressing [Return] results in a missing expression error. v _bonus NUMBER := &p bonus. When a PL/SQL variable is used: SET VERIFY OFF VARIABLE g_total NUMBER ACCEPT p_salary PROMPT 'Please enter the salary amount: ' ACCEPT p_bonus PROMPT 'Please enter the bonus percentage: ' DECLARE v_salary NUMBER := &p_salary. Execute the PL/SQL block. If the salary is null. VARIABLE g_max_deptno NUMBER DECLARE v max deptno NUMBER. PRINT g_max_deptno SQL> START pl8ql.sql.put line(TO CHAR(v max deptno)). Rather than printing the department number retrieved from exercise 1. Leave the location null for now. 2. dbms output. :g_max_deptno := v max deptno. Modify the PL/SQL block you created in exercise 1 to insert a new row into the DEPT table. END. 1. and add 10 to that number and use it as the department number for the new department. END. Save your PL/SQL block to a file named pl8q1.Practice 18 Solutions 1. s ql. Print the results to the screen. c. Use a SQL*Plus substitution parameter for the department name.sql DECLARE v max deptno NUMBER. 2. Introduction to Oracle: SQL and PL/SQL A-63 . Create a PL/SQL block that selects the maximum department number in the DEPT table and stores it in a SQL*Plus variable. Save your PL/SQL block to a file named p 18 q 2 . BEGIN SELECT MAX(deptno) INTO v max deptno FROM dept. BEGIN SELECT MAX(deptno) INTO v max deptno FROM dept. Display the department number. Save your PL/SQL block to a file named p l 8 q 3 sq l .sql Introduction to Oracle: SQL and PL/SQL A-64 . Test the PL/SQL block. dname. COMMIT. SET VERIFY OFF ACCEPT p_deptno PROMPT 'Please enter the department number: ACCEPT p_loc PROMPT 'Please enter the department location: ' BEGIN UPDATE dept SET loc = '&p_loc' WHERE deptno = &p_deptno. loc) VALUES (v max_deptno. Create a PL/SQL block that updates the location for an existing department. 3. 4. 2. Execute the PL/SQL block. SET ECHO ON SET VERIFY ON 1. '&p_dept_name'. Use a SQL*Plus substitution parameter for the department location. SELECT* FROM dept WHERE deptno = :g_max_deptno + 10. department name. SET VERIFY ON SQL> START p18q3. COMMIT.sq1 Display the new department that you created. and location for the updated department.Practice 18 Solutions (continued) SET ECHO OFF SET VERIFY OFF ACCEPT p_dept_name PROMPT 'Please enter the department name: DECLARE v_max_deptno dept. BEGIN SELECT MAX(deptno)+10 INTO v_max_deptno FROM dept. END.deptno%TYPE. NULL). INSERT INTO dept (deptno. Use a SQL*Plus substitution parameter for the department number. 1. SQL> START p18q2. 2. END. Practice 18 Solutions (continued) e. Display the department that you updated. SQL> SELECT* 2 FROM dept 3 WHERE deptno = &p deptno; 4. Create a PL/SQL block that deletes the department created in exercise 2. Save your PL/SQL block to a file named p l 8 q 4 1. 2. sql. Use a SQL*Plus substitution parameter for the department number. Print to the screen the number of rows affected. c. Test the PL/SQL block. SET VERIFY OFF VARIABLE g_result VARCHAR2(40) ACCEPT p_deptno PROMPT 'Please enter the department number: ' DECLARE v_result NUMBER(2); BEGIN DELETE FROM dept WHERE deptno = &p_deptno; v result := SQL%ROWCOUNT; :g_result := (TO CHAR(v result) 11 ' row(s) deleted.'); COMMIT; END; PRINT gresult SET VERIFY ON SQL> START pl8q4.sql ACCEPT p_deptno PROMPT 'Please enter the department number: DECLARE v_result BEGIN DELETE FROM WHERE v_ result NUMBER(2); dept deptno = &p_deptno; := SQL%ROWCOUNT; dbms output.put line(TO CHAR(v result)11 ' row(s) deleted.'); Introduction to Oracle: SQL and PL/SQL A-65 COMMIT; END; Practice 18 Solutions (continued) 3. What happens if you enter a department number that does not exist? If the operator enters a department number that does not exist, the PL/SQL block finishes successfully because this does not constitute an exception. 4. Confirm that the department has been deleted. SQL> SELECT 2 FROM dept 3 WHERE deptno = 50; Introduction to Oracle: SQL and PL/SQL A -66 Commit before the end of the block. 5. Note: The employee will have a NULL salary. SQL> SELECT 2 FROM messages. 1. set the commission amount for the employee to 10% of the salary. set the commission amount for the employee to 0. excluding 6 and 8. SQL> STA R T l ab 1 92 . Write a PL/SQL block to insert numbers into the MESSAGES table. If the employee's salary is between $1. Insert the numbers 1 to 10. If the employee's salary is NULL. Accept the employee number as user input with a SQL*Plus substitution variable. 6. Introduction to Oracle: SQL and PL/SQL A-67 . g.500.. 6. Select from the MESSAGES table to verify that your PL/SQL block worked. If the employee's salary is less than $1. ELSE INSERT INTO messages(results) VALUES (i) .000. c. Commit.000 and $1. 3. sql to create the MESSAGES table. 4. BEGIN FOR i IN 1.500. sql 2.Practice 19 Solutions 1. Create a PL/SQL block that computes the commission amount for a given employee based on the employee's salary. set the commission amount for the employee to 15% of the salary. END. 2. COMMIT.10 LOOP IF i = 6 or i = 8 THEN null. Run the script labl9 1. END LOOP. END IF. set the commission amount for the employee to 20% of the salary. sql to insert a new employee into the EMP table. If the employee's salary exceeds $1. Run the script labl9 2 . CREATE TABLE messages (results VARCHAR2 (60)) 5. 0) * v comm WHERE e m p n o = v e m p n o .10. BEGIN SELECT sal INTO v sal FROM emp WHERE empno = v_empno. END. Test the PL/SQL block for each case using the following test cases.20. ELSIF v sal > 1500 THEN v comm ELSE v comm END IF. IF v_sal < 1000 THEN v comm := . COMMIT.comm%TYPE. := 0.15.Practice 19 Solutions (continued) ACCEPT p_empno PROMPT 'Please enter employee number: DECLARE v empno emp. v comm emp. _ _ := . and check each updated commission. Employee Number 7369 Salary 800 Resulting Commission 80 195 320 0 7934 7499 8000 1300 1600 NULL Introduction to Oracle: SQL and PL/SQL A 68 - . v sal emp.sal%TYPE. UPDATE emp SET comm = NVL(sa1. h.empno%TYPE := &p_empno. ELSIF v_sal BETWEEN 1000 and 1500 THEN _ _ v comm := . 7499. If the employee has a salary amount of $1250. Add a new column. 2) = 0 THEN INSERT INTO messages (results) VALUES ('Number is even'). ELSE INSERT INTO messages (results) VALUES ('Number is odd'). IF mod(v_num. Update the STARS column for the employee with the string of asterisks. v num NUMBER(11. DECLARE v_char VARCHAR2 (30) .Practice 19 Solutions (continued) SQL> SELECT 2 FROM 3 WHERE 4 ORDER BY empno. END. into the MESSAGES table. if the employee has a salary amount of $800. sal. Append an asterisk to the string for every $100 of the salary amount. Accept the employee ID as user input with a SQL*Plus substitution variable. Initialize a variable that will contain a string of asterisks. Query the MESSAGES table to determine if your PL/SQL block worked. 1." depending on whether the value is odd or even. BEGIN v_ char := '42 is the answer'. 3. 7934. Introduction to Oracle: SQL and PL/SQL A-69 . 2. v num := TO NUMBER(SUBSTR(v char. complete the following exercises: 3. comm emp empno IN (7369. If you have time. 2. STARS of datatype VA RCHAR2 and length 50 to the EMP table for storing asterisk (*). SQL> SELECT * 2 FROM messages.2). Save your PL/SQL block to a file called pl9q5.2)).1. END IF. the string of asterisks should contain 13 asterisks. sql file to insert the text "Number is odd" or "Number is even. SQL> ALTER TABLE emp 2 ADD stars VARCHAR2 (50) .sql. 4. For example. Modify the pl6q4 . Create a PL/SQL block that rewards an employee by appending an asterisk in the STARS column for every $100 of the employee's salary. 8000) comm. 1. the string of asterisks should contain eight asterisks. UPDATE emp SET stars = v asterisk WHERE empno = v empno. COMMIT. 0) INTO v_sal FROM emp WHERE empno = v empno. FOR i IN 1. SET VERIFY ON SQL> START p19q5. Commit. SET VERIFY OFF ACCEPT p empno PROMPT 'Please enter the employee number: DECLARE v empno emp.Practice 19 Solutions (continued) e.stars%TYPE := NULL. stars 2 FROM emp 3 WH E R E em p n o I N ( 7 9 34 . v asteriskemp. v_sal emp. BEGIN SELECT NVL(ROUND(sa1/100).sql SQL> SELECT empno.sal%TYPE.empno%TYPE := &p_empno. f Test the block for employees who have no salary and for an employee who has a salary. 8 0 00 ) . END LOOP.. 1 END. . sal.v sal LOOP v asterisk := v asterisk 11 *'. I ntr oducti on to Or acle: SQL and PL/SQL A-70 . Practice 20 Solutions 1. 1.v count LOOP DBMS OUTPUT.v count LOOP SELECT dname INTO my_dept_table(i) FROM dept WHERE deptno = i*10. using DBMS_OUTPUT. END LOOP.PUT LINE (my_dept_table(i)). Create a PL/SQL block to retrieve the name of each department from the DEPT table and print each department name to the screen. 2. Write a PL/SQL block to print information about a given order. Using another loop.dname%TYPE INDEX BY BINARY INTEGER.. MY_DEPT_TABLE. 1. FOR i IN 1. v count NUMBER (2). BEGIN SELECT COUNT(*) INTO v count FROM dept.PUT_LINE. END. c. 2. Use DBMS OUTPUT. Using a loop. retrieve the name of all departments currently in the DEPT table and store them in the PL/SQL table. c. PUT_ LINE and print selected information about the order. Declare a PL/SQL table. SET SERVEROUTPUT ON DECLARE TYPE dept_table_type is table of dept. Each department number is a multiple of 10. 2. Introduction to Oracle: SQL and PL/SQL A-71 . FOR i IN 1. retrieve the department names from the PL/SQL table and print them to the screen. incorporating a PL/SQL table. Declare a PL/SQL record based on the structure of the ORD table. END LOOP. my_dept_table dept_tabletype.. Use a SQL*Plus substitution variable to retrieve all information about a specific order and store that information into the PL/SQL record. to temporarily store the name of the departments. If you have time. END. Each department number is a multiple of 10. Using a loop.999. 2. complete the following exercise.orderdate) II ' and shipped on ' II TO_CHAR(ord_record. incorporating a PL/SQL table of records.total. 1. and location of all the departments. c.Practice 20 Solutions (continued) SET SERVEROUTPUT ON SET VERIFY OFF ACCEPT p_ordid PROMPT 'Please enter an order number: ' DECLARE ord record ord%ROWTYPE. to temporarily store the number. BEGIN SELECT * INTO ord record FROM ord WHERE ordid = &p_ordid. Modify the block you created in practice 1 to retrieve all information about each department from the DEPT table and print the information to the screen. DBMS OUTPUT. retrieve all department information currently in the DEPT table and store it in the PL/SQL table.PUT_LINE. using DBMS_OUTPUT. MY_DEPTTABLE. name. 3.PUT LINE ('Order ' II TO CHAR(ord record. Introduction to Oracle: SQL and PL/SQL A-72 .99')). retrieve the department information from the PL/SQL table and print it to the screen. Using another loop.shipdate) II ' for a total of ' II TO CHAR(ord record.'$99.ordid) II ' was placed on ' II TO_CHAR(ord_record. Declare a PL/SQL table. my_dept_table dept_tabletype..Practice 20 Solutions (continued) SET SERVEROUTPUT ON DECLARE TYPE dept_table_type is table of dept%ROWTYPE INDEX BY BINARY_ INTEGER. FOR i IN 1. v_count NUMBER (2).v_count LOOP SELECT * INTO my_dept_table(i) FROM dept WHERE deptno = i*10. BEGIN SELECT COUNT(*) INTO v_count FROM dept. FOR i IN 1.v_count LOOP DBMS OUTPUT.PUT LINE ('Dept.deptno I I f ' I I my_dept_table(i). ' I I my_dept_table(i). I END LOOP.loc).dname I I ' is located in ' I I my_dept_table(i). END. Introduction to Oracle: SQL and PL/SQL A-73 .. END LOOP. salary) VALUES (v ename. NUMBER(11. Run the script lab 2 1 1. In a loop. e. Create a PL/SQL block that determines the top employees with respect to salaries.2)). OPEN emp_cursor. WHERE ORDER BY B G N EI INTO v ename. such as n = 0 or where n is greater than the number of employees in the EMP table. Assume that no two employees have the same salary. FETCH emp_pursor INTO v ename. 1.Practice 21 Solutions 1. COMMIT. sal CURSOR emp SELECT sal IS NOT NULL FROM sal DESC. emp. CLOSE emp_pursor. v_sal. SET ECHO OFF ACCEPT p_num PROMPT 'Please enter the number of top money makers: DECLARE NUMBER(3) := &p_num. 2. Accept a number n as user input with a SQL*Plus substitution parameter. v sal. v num v ename emp. v sal). END LOOP. s ql to create a new table for storing employees and salaries. 4. 2. FETCH emp cursor WHILE emp cursor%ROWCOUNT <= v num AND emp_cursor%FOUND LOOP INSERT INTO top_dogs (name.ename%TYPE. SQL> CREATE TABLE top_dogs 2 (name 3 salary VARCHAR2(25). Test a variety of special cases. DELETE FROM top_dogs.sal%TYPE. 3. Store the names and salaries in the TOP DOGS table. Introduction to Oracle: SQL and PL/SQL A -74 . v_sal emp_cursor IS ename. Empty the TOP_DOGS table after each test. get the last names and salaries of the top n people with respect to salary in the EMP table. END. SELECT * FROM top_dogs. SET ECHO ON . FETCH emp_cursor INTO v_ename. v_current_sal). Delete all rows from TOP DOGS and test the practice. Introduction to Oracle: SQL and PL/SQL A-75 .Practice 21 Solutions (continued) 3. If the user enters a value of 3. salary) VALUES (v_ename. v last sal emp. if the user enters a value of 2 for n. IF v last sal = v current sal THEN v num := v num + 1. c. v current sal emp. v last sal := v current sal. 1. END. then King. Ford. CURSOR emp_cursor IS SELECT ename. If one person is listed. sal FROM emp WHERE sal IS NOT NULL ORDER BY sal DESC. END IF.sal%TYPE. Ford. Scott. then all people who have the same salary should also be listed. then King. COMMIT. v_current_sal. and Scott should be displayed.ename%TYPE. CLOSE emp_cursor. v_ename emp. (These employees are tied for second highest salary. and Jones should be displayed. v_current_sal. SELECT * FROM top_dogs. WHILE emp_cursor%ROWCOUNT <= v_num AND emp_cursor%FOUND LOOP INSERT INTO top_dogs (name.) 2. DELETE FROM top_dogs. BEGIN OPEN emp_cursor. ACCEPT p_num PROMPT 'Please enter the number of top money makers: ' DECLARE v num NUMBER(3) := &p_num. For example.sal%TYPE. FETCH emp_cursor INTO v_ename. END LOOP. Consider the case where several employees have the same salary. CURSOR empcursor(vdeptno NUMBER) IS SELECT ename. v line varchar2(100).sal%TYPE. Pass the department number to another cursor to retrieve from the emp table the details of employee name.Practice 22 Solutions 1. SET SERVEROUTPUT ON DECLARE CURSOR dept_cursor IS SELECT deptno. hiredate.v_current dname. v current dname dept. v hiredate emp. v current deptno dept.hiredate%TYPE. IF emp cursor%ISOPEN THEN II II . v mgr emp. and salary of all the employees who work in that department.dname%TYPE.job.deptno%TYPE. LOOP FETCH dept cursor INTO v current deptno.job%TYPE. job.PUT LINE ('Department Number : v current deptno II ' Department Name : v current dname). DBMS OUTPUT. dname FROM dept ORDER BY deptno. EXIT WHEN deptcursor%NOTFOUND. BEGIN v line := ' OPEN dept_cursor. DBMS OUTPUT. v ename emp.sal FROM emp WHERE deptno = v_deptno. Use a cursor to retrieve the department number and the department name from the dept table.PUT LINE(v_line).ename%TYPE. v sal emp.mgr%TYPE.hiredate. v job emp. END IF. Introduction to Oracle: SQL and PL/SQL A-76 .CLOSE emp cursor. Note: Solution continued on next page. vsal. EXIT WHEN empoursor%NOTFOUND.PUT LINE(v_line).vjob. LOOP FETCH empoursor INTO vename. DBMS OUTPUT.PUT LINE (v ename II ' ' II v_job II ' II v hiredate II " II v_sal). END LOOP.Practice 22 Solutions (continued) OPEN emp cursor (v current deptno). CLOSE dept cursor. IF empcursor%ISOPEN THEN CLOSE emp cursor. END. DBMS OUTPUT.vhiredate. END LOOP. END IF. IF emp cursor%ISOPEN THEN CLOSE empcursor. SET SERVEROUTPUT OFF Introduction to Oracle: SQL and PL/SQL A -77 . END IF. empno%TYPE := &p_empno. v asterisk emp.sal LOOP v asterisk END LOOP. CURSOR emp_cursor IS SELECT empno.. 8 0 0 0 ) .emprecord. UPDATE emp SET stars = v asterisk WHERE CURRENT OF emp_cursor.sql SQL> SELECT empno. BEGIN FOR emp_record IN emp_cursor LOOP FOR i IN 1. Introduction to Oracle: SQL and PL/SQL A-78 . _ _ END LOOP. stars 2 FROM emp 3 WHERE empno IN ( 7 8 4 4 . COMMIT.stars%TYPE := NULL. Modify p 1 9q5 s qi to incorporate the FOR UPDATE and WHERE CURRENT OF functionality in cursor processing. 0) sal FROM emp WHERE empno = v_empno FOR UPDATE. _ _ := v asterisk _ 117*'. 7 9 0 0 . NVL(ROUND(sa1/100). END. SET VERIFY OFF ACCEPT pempno PROMPT 'Please enter the employee number: ' DECLARE v_empno emp. v asterisk := NULL.Practice 22 Solutions (continued) 2. sal. / SET VERIFY ON SQL> START p22q2. sal%TYPE := &p_sal. EXCEPTION WHEN no data found THEN INSERT INTO messages (results) VALUES ('No employee with a salary of 'II TO_CHAR(v_sal)). WHEN others THEN INSERT INTO messages (results) VALUES ('Some other error occurred. 1. If the salary entered returns more than one row." name and the salary amount. INSERT INTO messages (results) VALUES (v ename I I ' . insert into the MESSAGES table the employee's 4. Write a PL/SQL block to select the name of the employee with a given salary value. END. SET VERIFY OFF ACCEPT p_sal PROMPT 'Please enter the salary value: ' DECLARE v ename emp." exception handler and insert into the MESSAGES table the message No employee with a salary of <salary> . SET VERIFY ON SQL> START Introduction to Oracle: SQL and PL/SQL A-79 p23q1.ename%TYPE.Practice 23 Solutions 1. handle the exception with an appropriate exception handler and insert into the MESSAGES table the message "More than one employee with a salary of <salary>. v_sal emp. If the salary entered returns only one row. WHEN too many rows THEN INSERT INTO messages (results) VALUES ('More than one employee with a salary of ' I I TO CHAR(v sal)). Handle any other exception with an appropriate exception handler and insert into the MESSAGES table the message Some other error occurred. 2. handle the exception with an appropriate 3. If the salary entered does not return any rows.')." e. Test the block for a variety of test cases.sql .' I I v sal). BEGIN SELECT ename INTO v ename FROM emp WHERE sal = v sal. sql SQL> START p23q1.sql .SQL> START p23q1. Modify p 18 q 3.Practice 23 Solutions (continued) 2. 2. Write an exception handler for the error to pass a message to the user that the specified department does not exist. 1. SET VERIFY OFF VARIABLE gmessage VARCHAR2(40) ACCEPT p_deptno PROMPT 'Please enter the department number: ' ACCEPT p_loc PROMPT 'Please enter the department location: ' DECLARE e invalid dept EXCEPTION. COMMIT. SET VERIFY ON PRINT gmessage SQL> START p23q2. Execute the PL/SQL block by entering a department that does not exist. s ql to add an exception handler. EXCEPTION WHEN e invalid dept THEN :gmessage := 'Department TO_CHAR(v_deptno) II ' is an invalid department'. END.deptno%TYPE := &p deptno. IF SQL%NOTFOUND THEN raise e invalid dept. END IF. BEGIN UPDATE dept SET loc = '&p_loc' WHERE deptno = v_deptno.sql Introduction to Oracle: SQL and PL/SQL A-80 . v_deptno dept. Practice 23 Solutions (continued) SET VERIFY OFF ACCEPT p_deptno PROMPT 'Please enter the department number: ACCEPT p_loc PROMPT 'Please enter the department location: ' DECLARE e invalid dept EXCEPTION. IF SQL%NOTFOUND THEN raise e invalid dept. v deptno dept. END IF.put_line('Department 11 TO CHAR(v deptno) ' is an invalid department').deptno%TYPE := &p deptno. SET VERIFY ON Introduction to Oracle: SQL and PL/SQL A-81 . — EXCEPTION WHEN e invalid dept THEN dbms output. COMMIT. 1 II END. BEGIN UPDATE dept SET loc = '&p_loc' WHERE deptno = v_deptno. emp. the message should indicate how many employees are in that salary range. c. EXCEPTION WHEN e_ no emp returned THEN :g message := 'There is no employee salary between ' II TO CHAR (v low sal) I I ' and 'I I TO CHAR(v high sal). Introduction to Oracle: SQL and PL/SQL A 82 - and v high sal. Handle any other exception with an appropriate exception handler.sal%TYPE := v_sal . VARIABLE g_message VARCHAR2(100) SET VERIFY OFF ACCEPT p_sal PROMPT 'Please enter the salary: ' DECLARE v_sal v low sal v high sal v no emp emp.1 0 0 . 1. 1. 2. n o emp returned EXCEPTION. The message should indicate that some other error occurred. 1. print a message to the user indicating that is the case. emp. . If there is no employee within that salary range.Practice 23 Solutions (continued) I Write a PL/SQL block that prints the number of employees who make plus or minus $100 of the salary value entered. sal no between v low no emp > 0 THEN e more than one emp.sal%TYPE := &psal. Use an exception for this case. NUMBER(7).sal%TYPE := v sal + 100. BEGIN SELECT INTO FROM WHERE IF v no RAISE ELSIF v RAISE END IF. count(ename) v no emp emp emp = 0 THEN e sal emp returned. WHEN e_ more than one emp THEN :g message := 'There is/are 'I I TO_CHAR(v_no_emp) I I ' employee(s) with a salary between TO CHAR(v low sal) I I ' and 'I I TO CHAR(v high sal). more th an one e mp EXCEPTION. If there are one or more employees within that range. END. / SET VERIFY ON PRINT g_message SQL> START p23q3.sql . ELSIF v no emp > 0 THEN RAISE e more than one emp. WHEN others THEN dbms output. v low sal emp. v no emp NUMBER(7).').sal%TYPE := &p_sal. e_ more than one_ emp EXCEPTION. EXCEPTION WHEN e no emp returned THEN dbms output.put_line('There is no employee salary between ' I I TO_CHAR(v_low_sal) I I ' and 'll TO CHAR(v high sal)).sal%TYPE := v_sal .100.put line('There is/are ' I I TO_CHAR(v_no_emp) II ' employee(s) with a salary between 'll TO CHAR(v low sal) I I ' and ' I I TO CHAR(v high sal)). / SET VERIFY ON Introduction to Oracle: SQL and PL/SQL A-83 . e no emp_returned EXCEPTION. END IF. BEGIN SELECT count(ename) INTO v no emp FROM emp WHERE sal between v low sal and v high sal. v high sal emp. IF v no emp = 0 THEN RAISE e_ no emp returned.sal%TYPE := v_sal + 100.put line('Some other error occurred.Practice 23 Solutions (continued) SET VERIFY OFF ACCEPT p_sal PROMPT 'Please enter the salary: DECLARE v_sal emp. END. WHEN e _ more than one emp THEN dbms output. Introduction to Oracle: SQL and PL/SQL A-84 . B Table Descriptions and Data . 9 43 9 4 7. 0 $ " .3/ !.397 4/:. . $ " . 90 #* ! :2-07 :2-07 #%%7039.90 202-07/ .45/990/1 # .90 %%* ! %% :2-07 ..45*/ 990/ ##$ 990.9.8. -44/.9 709 /...45 / 990/ 3974/:.90 .90*.20 0 %50 01.90 #* !* ! ! %#% % !#% % /.90 %% ! # %%* ! .!7.90##$202-07 202-07/ 05*709*/.4393:0/ /%.-0 #01 4 .202-07/1 .-03.90 %&%$$% 202-07/ .1907 -44/..45*/ &# $%#%7039.9.950 039 * % ! $8902 .45 .3/!.0$".:0 #01 %.-44*/.0$4:9438 .:9 '.20#% 4:23 .90 &# 990/ % %&%$$% &# $%#%7039.45*9905 !## -44/.45*/ 990*/ $%#%7039.94394 7. $" . 20#$#'% 4:23*.-03.4393:0/ 0%.!7.0$4:9438 .9..20 0 %50 :. 94394 7.90 202-07/ 990/ 3974/:.90% 202-07/&# $%#%70807.943990*/ ##$990 990*/ $%#%70807.-0 #01 4:23 . #$*% ! & #* ! & # #* %% ! %% %% :2-07 &36:0 #01 %.950 039 .943*202-07/ ##$202-07 202-07/ 990/&# $%#%70807.3/!.0$"..9.943708/.943 708/...90 :2-07 #%%70807.90202995!## 708/... $" . 20 #% $" &9.04190806:03.70.-03.-08 9..43897.-0*3.!7.90/574507-.08 # 806:03.-03.943.89*3:2-07 # :807*806:03.943.9.-0*3.390/.43897.799 /4349./.20 :8079.-0 .9.39*3.08390/.94394 7..9909.4393:0/ '0719.43897.0 990*/*806 $"#%$"&990/806 $%#%% .3/!.2090806:03.4.0*3.43897.20 # #% %% %%* ! #$#'% $" &.7 $"$% # # 9..'0719008903..3.20 #% $"$% # # .9.20 .39*950 9.90806:03.0$".:08.79934.20 # #% %% %% ! #$#'% 70.702039- .20 3.34190 .0.0202-07*/*806 $"#%$"&202-07/806 $%#%% -%903:2-0714790%%9.0*3.0$4:9438 .2090806:03.43897.398 9.-08.-0.-089.0894:36:0/03910..7 $"$%806:03.-089.39*3..02-073:2-0714790#9.-0*3./.398070.3/..3/90%%9.74390#9.20 :807.20 #$" %%$" 3974/:.. $" . 2039418.856.93 ..90.990390790700../..44 147 .3047 ! % % & % 5.9047 700.80*/.8.//843889 % % % $#%% 990 990/ 990 /08..86&8090806:03.// .7892..0$4:9438 .9047 700.9.-0870.474:8 44398.03.-0790.4393:0/ ///.3 09.94... 209047.80*/.7591470.907 10/2:89-0850.7.808 30.031472.//9438 $"%56.90 '&$ 990/806%' 03.65. 9003.9#0202-079.090 8.94909.099089490%%9.51#&$.3/7892.309174290..90 '&$ 990 / 806%' .889147 $.75943 7. 990 :.93 ..!7.39.6"9..88.3/ .207..//24.80941/.80/...80994.943$.93 .80 /.01.03&$.7.82.3943 .390 074308.908390 1472.9047 700.9047 700.0905.783.9432.8%44 41081703/82.75943 7.90 '&$ 990/806%' %04.0.8.75943 7.80/.34907 389.90 '&$ 990/806%' 0.75943 7. -:90..07 858 8.9. 11 9 .86 $% $#%% 990 990/ 990 /08.9438947.0894:36:0/03910.759.03101472 # $ % % $#%% 990 990/ 990 /08..73.3/0/'0714:7.9610. 49 303:9 ..93 .7. .808.98306:49. # $ % % & $#%% 990 990*/ 990 /08.9..75994039079024.3/:30. . $% $"$% # 990 990 . 44147.08 70.-4:9$..0$".!7.4.943 8947 ..39..0 1.3 90 07430 8.3/!.88.4.9.8/4:-98 .. 9.3/ 7892.9047 #00..3943.889147 $.07 8588.0.085990/ .0 90 5.90 % 09 .94394 7.80830.309 174290...0 41/7:8 .3/ :30. 11 ! & 7.4:50 13/90280.3 # $ %04- $ & .03101472 209047.389..7 4/.75943 410 81703/8 2..4:8./. -:90.4:3.34907 389../4089 1907/8.4393:0/ %90 0 .:8-:980 /8.3/.49 41303:9 .7..207.39..93 ...03.3 # % & 3974/:.0 ! # $! $4/..943 41 # 8..474:844 398.0789.//843889 #..8 %44 03.073.808.3 08.3 047 8 0..80*/.7892.80994 .7.927.0843 .0$4:9438 .73.9003.990:. 82. $" . //90202-07 3:2-078 789* ..7593.9.990 4/7.//7088 .. * 3974/:.7203 .9.89*3.. ":.4393:0/ -///.0$".-0790.98.9 5430 % % 43/.:707 .90 % $%'# $% $"$%#%56-86 .893 .86:0 ..9430.75908:7094:8090806:03.20 .94394 7.3/!.7 :/7 4 $"%56-86 $% $%'# $#%% 202-07 202-07/ 1789 3. :$97009 .44 3 .0397. 94 $00 #450-:73 &7:..90 3$97009 $0.2.!7.3 7.0$4:9438 . 2 0 .9 5430 43/.478 /47 .8.79 9 !430 43.:90908.20 //7088 '0.48 4343 ":0-0. # # & !# '.094.90 '&$ 202-07*/*806%' 1789*3.20/5 6- 8694574259:8078 1479031472.20 .20 .20 .//7088 ..4!.9490#9.4 .89*.0 $. $" . 3 %04- ..0$4:9438 .-014798007.9:8 ' ' #% ' ' ' #% ' ' ..9..3 $"$#%'&$ $"$#% '&$ $"$#% '&$ $"$#% '&$ $"$#% '&$ $"$#% $"$#%% 990*.45 .-0 490.4393:0/ .4508390%% !9..//90144324.80 %90 45*/ 0..45*/ '&$ ' '&$ $"$#% '&$ $"$#% '&$ $9.0..!7.090990/3:2-078.3/7892.8%44 03. 11 7.0 $4/..0843. 45*/ #% % 990 / 89.45*/ 990 / 89.45 .45 .9:8 990*.9:8 .% ' 990*.9:8 990*.45 .45 % 990.45*/ .94394 7.9:8 % 990 990 / 89.45 .45*/ 990/ 89.9:8 #% % 990 .45 .9:8 3974/:.45 ..45* / 990 / 89.9:8 ' % 990 / 89.3/!.0$".9:8 ' 990 / 89.9:8 990 / 89.45* / 990/ 89.45/ ' % 990*.45*/ ' ' % 990*.45 . $" . 4 /.8.4 $ " $#%% $" $#%% '&$ $" $#%% '&$ % $" '&$ $" $#%% '&$ ..9#09.90 /.4 /.8.89490#%9.-0 490%903:2-072.8.90 /..03:2-07 %90* 45* / / 02-07* / 44/.-0/1107039/0503/343806:03.4 5*#09*. /.4393:0/ ///9014437039.9.!7.4 /.8.8.4 .0$4:9438 .174234 %4/.4 /..8.4 /.90 /. 90 .45*/ 202-07 / 202-07/ -44/.90 ..90 3974/:.90 ..45*/ 7039.0$".90 88/. 990 / .3/!.45*/ 202-07/ -44/.90 7039.90 & 7039.9709/.88/.90 . 990 / .45*/ 202-07/ -44/.9*709/.9709*.90 88/.90 88/..90 88/.90 88/.90 05*709*/.90 88/.90 05709 /..90 88/.90 05*709*/. 990 / .9 709 /.90 88/.94394 7.90 & 7039.90 -44/.. 990 / .90 88/.90 05*709*/. $" . 78 :9:789.90 9909 990*. 124.94324...90170390/":07.2570 ! $ & $#%% 990.0 7/0790708:98 -990 $"#%'990.9.9:8 '&$ ' $#%% 990..//.93 ..89.9. 8..4393:0/ 70.3907890..45*/ 990/ 89.0%0700.990/7990/ $" &990 #% $"$% # 990. 7039.3/98050..3 $"$#%% 70807.398947039 3907890.0.94324.0.9047 700.3907890.083907890.45 ..7 9990/.7..943 708 */..7.4508 $#%% 990 990/ 990 /08.75943 7.9438147.09908.39070-088.7.!7..9:8 705*709*/.78 .090:2.03.7203'0...90 202-07/ 990/ '&$ $$% .-08 //..4570.45 */ .90/!.9438 3070807.86:0 4.0257008:7094.45.$ $% # # 9990 .9:8 '&$ ' 39079470807.45.7":.. 94 $00 4..7.90.78%049078147.390 70-088..30990%024.45*/ 990/ 89.990 .45*/7.80/..45*/ .87.3/.759438:9:789.90/709:73/.45*/ .80*/.381742900.3909.30894/.47/14794.381742900.8..90 '&$ 990/806%' 3907890.0$4:9438 ..7 .398947039$4/.8810/.908 & %0/08.45 .990/ ... ## 99 0 .-941 0.3/90.748174290.20/ %%'94849024..0.090:2.. 3/!.0$".90 202-07*/ 990/ '&$ $$% 3974/:.943 708*/..$"$#%% 70807.94394 7.. $" . 47/905:7. 0 39 0 7 89 0 .. 5.3/ 94 /0.9 43 # # 202-07/ $"$% # 990*. 4 7/ 9 0 3 1 4 7 2.9438 $"%#%990 57.9 9 0 70 39 . 4 9 0 / 0 1. 7 20 3 '0 .4 :9 9 0 70 39 . 7 .//.9 0/ 70 9 :73 /. 47/ 0 / - :8 3 9 0 .9:8 #% 9 90 / .9439443041909..90/ $"$#%% 7039. # # 99 0 .9 0 9 4 -0 :80 / '0 7 19 . :0 1479 0 0 50 ...8057.#9. 949. 9 4 3 .45/ 7 0 8 07 .65: 065.../04%0 .24/1.-08 .45/ 202-07* / '&$ $"&!% $% # $ " % 990*.4:239490%%9.0&63.0. 86 :0 70 39 8 9 0 24 .2.0 $"$#990 &# .0. : 89 4 20 7 . 9 43 1 4 7 9 0 24 . 70 .04190. 8 70 .-09470.. 0 4:.45 89. 990/ . : 9 .!#.4:23 84:/ .51 . .08 '071 4:7 24/1. 0 # 0 . 039 41 09 /98 . 4 5 # 0 24.0 0 7 70 80 7 ..0 .45 / . 7 8 . . . . 3/!$" .0$"..3974/:.94394 7. .7.0$".20 %% 3974/:..78 $% $%'# &!% $% # 990 57.!7..43897.0 $4/.3 %04- '.090990/3:2-078.3/7892.43897.0843.0.4393:0/ 70.0*33 %& $"$% .9908.900..:0'07190.439.57..398 # 9./049.-03.94394 7.0 $%#%990*57..7..39 $"%#% 990 57.0 0.39*3.20 .0$4:9438 .. 11 7.80 %90 !7.3.8%44 03..47/39490 144389 490.93901:9:70..3/!.39*950 80.0 57..20/56- 86 94:5/..9.90.0.8.43/943 # :807*.3 3907890.43897.7593..57..43897.0 990/ 990/ $%'# $% $"$%#% 56-86 38:709.-014798007. $" . :8942078147907054793 5074/$.943417039.4393:0/ 70..:/090./04808:70943.!7.943# %%% $%'# $%!$ $% * 3974/:.9709/..94394 7...:8942073. ..3/!.90.439.20/5686 $"%5686 $% $%'# $%!$ &202-07 #% &990 #% &-44/.90# &/:7.90 7-44 /.202.8147..3//:7.0908.0$4:9438 ..0$".893.903:2-07417039.:894207 8 89474170393.7593.705479990/:8942078947#05479%8705479.103.90 #% &/:7.070390/ /.7 7202-07/2202-07/ 7990/9990/ 202-07 * * ## &202-07# &990# &-44 /.20# 9990 7-44 /.90 7.90&#% # # ## 202-072 9909 7039.9084190 7039.20 24.30.943 #% %%% :8942078947#05479 # 202-07$! #! #% $% 217893.9.8%49. $" . .440.0/ # . - 7 9/.-0.3/05.900.:8090 %&.:808349.41902. / 0..'## 0. # &# .9. 0.94394 7..41901443/0.-0.3/!.94380907230..!7.3894.-0..7.0$".9438.* .305708843 3974/:.7.:8043430/039107507/0.703490.3 #.:...7.90 % %& 0..0$4:9438 .. ..-02:89-039..40/ # . $" . 4393:0/ 30.90 $$% .0$4:9438 .803/07&$# .!.9.41901443..88320398 /090723090/./05934 ./.!7.9078973 % # .7..9504190708:9305708843 .8:2 0.9.8944 :2-07 .. /:0/. 43..34324:8-4.90. 1.. 3 ..80!.3 .079850.:0 & 38.$".950 70. 3 .9. 440.7/.3349.3 %#& .944:95:99057.3 440...82-481742'##94&# ..3. 47894908.7003 '# 73088.0 !.0'## *2088.$"4. $"4.478 . 0 $"$%#%5686 $$ !. !#%73088. .0$".94394 7.$"4.3/!.478 3974/:. $" . 70894.425090901443007.7.9.-0888390.90.4393:0/ 14:.80 70....!7..0$4:9438 .-4..:0419080!.0920 .9.9/0. -08.-0894 $" !:8489.3/573990708:984190!..7.$".7.. 70030..:90 4:7!.7.$".-0894908. 04:7!.$.$"-4.. .*. 890...7 *3:2..-08.3807 & ..7.7....7.7 &# ..907 .7 !#%*3:2 $"$%#%58 # 890.3807 .20/5686 #.-0039 & : 2.*3:2 !#%*.7 ..94..90781742'# # & '# *..:0 %0907.-0 '.7.3:2% &# $&$%# ..3:2 890.7.7'## '# 3:2&# # '## .103.07 883.3807 %0178994.:08949080.$"-4.7...81448 '.7 *.. 03 &$.961 0. 5.6 "9.65. 51 #&$ . . 9.!7..0$4:9438 !. $"4.2088.09&# .0'## !74/:.9 . # . $& . 3 089073 .0$".2088.09.09 .9 ..2088.304.3/!.3 3974/:.2088.3 .09 .09&# .304.304.304.3'## :7450 .0'## !74/:.0 83894.3 089073 .304.94394 7.09. . # .0. $" . 9.4393:0/ .!7..0$4:9438 .9090!.:.. 3/90/.950. :041'$$3902.8 .453 %0..3/.7.3/90/.9.47/394907:08418..:041' 3908:--4.8!74/:.4:85.:041'%3902.3/90/..38349..9 83894.94394 7.8 089073:7450.:041' 3902.9.:0410.. 41901443.*30*4.8 0. 3974/:.9508&# %0..9508'## 0%0..9.-0.3/90/..:041'%3908:--4..9.3/!.4390570.-08.. 3-4.8-04:98/0908:--4.8 .3-4.9.9508&# %0.0.3-4..3//090723090/.0$"..9508'## %0..:80.$"-4. $" . .:894207 3.93 * 3974/:.4393:0/ $.20 % .3..3/!.70/9 7.385479 '## % ....9.93 .250 # .0$"..70/97.70/97.0$4:9438 .:894207 8.450.20'## &3854798 7.!7.94394 7.:894207&# ..3.93 # '## 42.:894207 .20 .. $" . :041'*3902..4:8 5.9508'## %0.9. -4.-08 '*&$% #.9.8 %..808 %0.84 /0.7.9508'## %0.70 94 ..3/90/.9508'## 0%0..3-4.9.3/'* 3908:--4.3-4.3/90/...9.9.-08 '*&$% # .3-4.3/90/.9508'## .3 -4.8 .0.:041'3 908:--4.8 42.3-4.8 843 43 90 570.41901443.:041'&$% #3908:--4.:041'*&$% #3902.508 1470. 93 .9. 8:--4.307747 1%0.3/90/.385479....#9.3/4:4:/800.3/ /. 4: .3/90/.51 $:55480 4: 02-0/ ..:041'#%#%3902.3/ '*#%*#% 3 90 2.8-03902.9508&# %0.7..8 &3854798.0&63.70 94 .:041'*#%*#%3908:--4.:08.090723090.8 %.. .0 4: /0...65: 06 5.9.8 '*8349. 3/!.94394 7.0$".3974/:.. $" . !7..4393:0/ 70.90.!.:90.9.0$4:9438 .3/00. .$"-4./0/-9080.!..43/3:2-07.9.9..//0/9490708:9%0708:984:/-089470/3.3/..-08%017893:2-0784:/-0/.09080.0598943:2-078974:$" !:88:-899:943 .7.43/ 3:2-07. 3/57390/94908.3/57390/4390 8.7003 .$".-0.-0.7.7..$" !:8.03.!.70034790708:984:/-07990394.. 708:9&# .3:2.3:2 &# 53:2 &# 53:2 .80039079080.43/3:2-07 # .-08:80/ $% $%'# $%$#'# &%!&% !%53:2.80039079017893:2-07 !%53:2!# !% !0.!# !% !0.708:9 ..3:2 .7.$". .3:2 .3:2 . !739390!. 7.-0 .$".. *708:9 . $ &%!&%!&% . 0 3974/:.0$".4393:0/433095. $%$#'# &%!&% $%'# $% 490$4:943.3/!..94394 7. $" . 80 03907 90 1789 3:2-07 !% 53:2 !# !% !0.7.!7.3:2.43/ 3:2-07 # .4393:0/ -03.-08:80/ $% $%'# '#708:9&# !% 53:2 !# !% !0.80 03907 90 80.3:2 ..3:2 708:9 .$" !:8.9.0$4:9438 .. 3:2 ..3:2 &# 53:2 &# 53:2 . !#%708:9. !739390$" !:8.7...3/!.94394 7.-0 $%'# $% 3974/:.0$". $" . 0$4:9438 .!7..9.!.4393:0/ :/. 425038.425:90890949.9.$"-4.9431474300.880/9490!.0..-43:8507.3/90.705.33:.8.9.7 .039..33:.7%0. 783: 809994074-01470.2. .$"-4.9430.974:$" !:8 8:-899:943.425038.250 94 1908.0790/1742..3/90-43:8300/894-0.:9090!.-08.7. 1470.43./0.403:2-0794.425:9390949.. . 28830570884307747 03.94394.943950&.:08 490%4908990'1:3.$"-4.3/03: .#023/07&8090'1:3.990574259570883#09:73(708:983.!. 7 ' .7!# !% !0.*-43:8&# 5-43:8 *949.*-43:8 ...0 # .$".-08:80/ $%'# '#*949.&# !%5*8.*8..8003907908.24:39 !%5*-43:8!# !% !0..7..7&# 5*8.*8.039.800390790-43:8507.7 .' .7.. . ... !#% *949.800390790-43:8507.8003907908.-08:80/ $%'# $%$#'# &%!&% !%5*8.039.7!# !% !0.7.. *-43:8&# 5-43:8 /-284:95:95:930 % # ' .7 ' .0 # .24:39 !%5*-43:8!# !% !0.*-43:8 .8..*8.7 .$" !:8..7.7&# 58. 03. $% '# $" $%#% 58. . 94394 7. $%'# $%$#'# &%!&% 3974/:.3/!.0$".. $" . .90.!7.9.!.0$4:9438 70. 98902.3/894708 93.9800.-0.04:7!.9.2:2/05..-0!73990708:9894908.7.$"-4.$" !:8.7003$..7920393:2-07390!%9. /05934 # /059 /-284:95:95:930 % # .2.103./05934 # /059 *2.*/05934&# # .20/ 5686 '#*2.*/05934.2./05934&# $% /05934 % .*/05934 $"$%#%5686 # .2./05934&# $% /05934 % .$"-4.2.2.2./05934 !#%*2./05934 4/190!.94. 70.$"-4.3074 39490!%9.809438079..4:.90/3007.-0$.0 4:7!. 94.7.$" !:88:-899:9435.7920393.3/!.0904.35739390/05.3/:809.94394 7.103..9433:14734 3974/:.80 .792039 &80.20 .93:2-07 .0$"..3/.7920393:2-0770970.20/5686 #..890/05.0/1742007.$"-4.9079.2090714790/05.// 949.0.7920393:2-071479030/05. $" . 9.800390790/05.20 % $% $%'# & 0.*2.20!# !% !0..*2.20 # .!7.4393:0/ $% $%'# !%5*/059*3.0$4:9438 .*/05934 # /059 $#%% /059 /05934 /3.*/05934/059/05934%! $% /059 34 % .7920393.2.:9090!.20 4. '&$ .*/05934 5*/059*3. 70.90.!. $"$%#%5686 85.*/05934 70.9030/05.7920399.90/ $% # /059 #/05934*2.94:.$"-4. 30893/05..04:7!.792039$.943147.$"-4.908904.9:5/..9. $"-4.20/5 6 8 6 &80.2090714790/05.$" !:88:-899:9435.7.2090714790/05.103.943 %08990!.7.7920393:2-07 &80.$" !:88:-899:9435.7920394.. 94. $"-4..90/05.3/!.800390790/05.94394 7.943 &!%/059 $%4.94314790:5/. 85.90//05.7920394.7920393.20 .!# !% !0. #/05934 5*/05934 % $%'# $"$%#%5686 3974/:.800390790/05.7920393:2-07/05.0$". 5*4..792039 $%'# !%5*/05934!# !% !0.7920393:2-07 !%5*4..3/4. $" . 90.90/05.!..9.4393:0/ 085.7920399.90/ $"$% # /059 #/05934 5/05934 70.94::5/.!7.0$4:9438 . 70..$"-4.792039.04:7!.9.90/3007.9/0090890/05.80$. 7.$"-4.%08990!.7003903:2-0741748.94. 103.$" !:88:-899:9435.20/5 6 8 6 &80.90/ .2090714790/05.7920393:2-07 !73994908.110. 0$"..7920393:2-07 # .*708:9&# % # /059 # /05934 5*/05934 .3/!.800390790/05.708:9$"# &% *708:9 % # .708:9 74 8 /0090/ % !#%708:9 $%'# $"$%#%5686 !%5*/05934!# !% !0. $%'# '#*708:9'## !%5*/05934!# !% !0.$"-4.800390790/05.7920393:2-07 # .708:9 74 8 /0090/ 3974/:.94394 7.*708:9&# % # /059 # /05934 5*/05934 .*708:9$"# &% /-284:95:95:930 % # . $" . % . 7920393:2-079.4393:0/ .9../05.9/408349089 1904507.9/408349089 90!.0$4:9438 .9./05.!7.5503814:03907.947039078.7920393:2-079. 0881:-0.0$".792039.30.3/!..990/05. 138088:..:8098/408349.94394 7..05943 431729.$"-4.43899:90.8-003/0090/ $"$% # /059 # / 05 934 3974/:. $" . 9.!.9090$$$9.70.0$4:9438 #:3908.-0790.759..-8694.!7. 3/ 4229-014709003/4190-4.9174290$$$9.08 708:98 '&$ % ! .$00.$"-4. # ! 47% 3: $ $#%% 2088.94:7!.08 708:98'## 38079903:2-07894 0.-094.-0 #%%2088.0719.:/3.9438079 3:2-07839490$$$9. !.$"-4.08 70.90.470/ $"$% # 2088. ..24:39147.7 190025400 88.70.4228843.24:391479002540094 4229 3974/:.8:80735:99.24:391479002540094 41908.9.-0 490%0025400.3/ 80990.80/ 4390025400 88..7 #:3908...4228843..$"-4.4228843.0$".24:3914790 0254009441908.7.03025400-.94394 7.780889.....0.7 190025400 88.&8..$" !:88:-899:943.00/8 80990.425:90890.- 86 .-0 190025400 88.-869438079..78-09003 .7 190025400 88.78& 80990.759..4228843.9.24:3914790025400 94 41908.059900254003:2-07.3002540039490!9.4228843.3/!..7 $" $%# % .3 80990. $" . % . % .*8. . % . .3/ % .8.9.422 ' 8.% .422 $.. .422 $.*8. 0 25 3 4 % * * * * %08990!..422 025.!7. .0$4:9438 .%! .422 # 0 2 5 3 4 .8.422 &!%025 $%.8. # 025 #02534.4393:0/ !%5*02534!# !% !0.02534 02502534%! 5*02534 .*02534 .422%! $%8. 0258. .80039070254003:2-07 # .422 $ .. 1470. :5/.90/.0$".$"-4..7 #08:934228843 & 3974/:...4228843 25400:2-07 $.3/.0...3/!.80:839014439089..808 .94394 7.0.. $" . -0":0790 $$$9.808 4/190 5686 10943807990909:2-0784//47:2-0780.-094/090723014:7!.0920 .425090901443007.:084//470.51 $"$% # # ## 02534 8.422 025 02534 .65: 065.422 14:.0.03 39490$$$9..#9..0&63.03 /0503/343090790. . .950'##.3:2&# .!..3:2% &# $&$%# .-014789473 .30..08 708:98 '&$ :2-0780.$"-4.03 $ $#%% 2088.90.9.*3:2 % $#%% 2088.4:23 $%#$41/.470/ # .08 708:98 '&$ :2-0784// $"$% # 2088.7 890.78'## 70.08 //.3807 .7'## ..89078 $"%#%025 89.7 24/ .*.* .3/039 9490!9. .$"-4.970.89078390$%#$ ..9.5503/3.7/8.4:231470.07 4190025400 88.3.04:7!.3025400-.7$. 890788 3974/:.89078949089731470.8.7.07 41908..7..439.0$".0.9.8.9090$%#$.890788 &5/..439.3/!.89078884:/.439.$" !:88:-899:943.7.-09.3.8907881 90025400.7..8.$"-4..24:3941 90897341.89078884:/..3.7.24:39470..890788 5503/.250 190 025400.8:80735:99..-0 39.309.05990025400.94.. 10 .4:2314790025400990897341.897341.8.94394 7.0/ 5686 .3.24:3941 90897341. $" . ..0348.4393:0/ 04229 1%08990-4.9.8003907900254003:2-07 # .*8.02534 02502534%! 5*02534 .%! $%' # & 8.8. 0258.8907802589..0$4:9438 .3/147.!7.7 $%'# !%502534!# !% !0.30254004.14702540084...8.78%!& .7.. 02534 #.89078 ! &!%025 $% 89. # 025 #02534. . ! . 02534 % $%'# $"$%#%5686 $"$%02534 8.8.*8. % .89078. 89...78 # 025 #02534 .78 .89078 # 02534 . 9 43 9 4 7.397 4/:. .3/ !. 0 $ " . $ " . 90.#9.0.!.0&63.65: 70. 0903.9470970./05.-0.7003 3.93.3/57390.2094908. /05.20410.$"-4..792039174290!%9..7920393.47547.!. -0 0..!.70.$"9. :77039390!%9.$"9.2041.789470903.7920398 &83.445 70970.204190/05.-0.7920398.0903.-0 *!%*% 94902547./05.3/894709023 90!. /05.090/05.7920393:2-078.208174290!.&83..$"9.7920393.2:95041 .-0.34907445 70970. 4:39 ! $%/3.-0 # /059 #/05934 ! #.4:39 ! $ &%!&%!&% 2*/059*9..-0 ! 790.-0950 .4:39 &# $% &% % .-041/059/3.-0.7003 :83$* &%!&%!&%* $%$#'# &%!&% # %!/059*9.-0/059*9.$"9....20 % 2*/059*9.!.4:39 # /059 #.3/57399029490 8.20%! #%# 2*/059*9.-0*95089. -4:9.$"-4.!.943.0347/07 0...70.94573931472. 47/-.9:704190 #9.3/ 894709.-4:9.31472..$"70.943.-09470970.0.850.80/4390897:.-0 &80.94339490!.931472.47/07.$" !:88:-899:943.7.1. 3/!.&80$ &%!&%!&%*.90/31472.3/5739800..0$".943.47/ .-4:99047/07 3974/:.$"70.94394 7. $" . ./05.4:.94394908.47/47/07/.!.0.93.-4:90.3/57399031472..949.425090901443007.70.4393:0/ $%$#'# &%!&% $%'# !%5*47//!# !% !0.47/ # 47/ #47// 5*47// $ &%!&%!&% 7/07 % # 47/70.7003 3.47547..47/ 47/# %! $% % 47/70. 14:.9.347/073:2-07 # 47/70.9..792039 174290!%9.0/43 % *# 47/*70.31472.-0.90 147.!7.0 $4:9438 .09470970.85.0920 .41 % # 47/70.47/949.47/85/.943.90/357.90 ..8003907.47/47// .3/8550/43 % *# 47/*70.80 4/190-4. 47/8 0.70.$"9.-041 70..!. 789470903:2-07 3.79203931472.-0.7920398 &83.3/8947093 90!.:77039390!%9.94341.-0 *!%% 94902547.90/05.3/ 4.943../05.20 .$"9.0.445 70970. 3490744570970.090/05.79203931472.$"9.-0.7920393:2-078./05.&83..943174290!.2:95041 . $"9.3/57399 94908.-0.3/!..94394 7.0$".7003 :83$* &%!&%!&%* 3974/:. $" . 4:39 # /059 #.-0 # /059 #/05934 ! #..3/!..-0 /05934 1 2*/ 05 9*9 .-0 4.-041/059# %! #*%# 2*/059*9.0$".#9.*.4:39 ! $% % 2*/059*9..4:39 &# $% &% % .94394 7.*.-0/059*9.*.*.0 / 3.-0*95089.-0950 .2 0 8 4 .0&63.0. 90/ 3 2*/059*9.65: 065. ! 3974/:.4:39 ! $ &%!&%!&% 059 2*/059*9.51 $%$#'# &%!&% # %!/059*9. $" . -0147894730254008.759.309.7 '## &# 70..90.3/8.70.!7.708 $"#%%945*/48 3.-8694..90.0$4:9438 #:3908..9.20 8.!. 7 '&$ .078 # &# 5*3:2 02503.9079.0908.208.03&$.9/09072308909450254008970850.03.3:2 .7084190945350450970850.20 .83 470703870.$"-4.$ %& # 8.%! 025*.03. %025*5:7847% ..20 8.7390 !9..19070.3:2 025*.808 8:.059.8..65.8003907903:2-0741945 24302.70941850.893.3903:2-07 410254008390!9.-0...-0 $9470903.9089 %# 945*/48 $% !% 5*3:2 !# !% !0..:7847# &%.$" !:88:-899:9435.3/8..9948. ! $025*5:7847 % 5.20%! .9610.708 .20 ..9.:7847 %025.03..51#&$. &#$ # 025 $% 8...208.03.:7847 & ! $#%% 945*/48 3.$ # ## % ..708390% ! $9.7 0%089.20 8.445 0990.20 0258.-025990% !* $9..*8.-0 88:209.7.934940254008.6"9.:7847$ .. !025*.:7847 025.20907 3.9948.8:80735:99.20 .8.*8.208. 03..3/8.3:2-073. . $% # 945*/48 $% . $ !025*..7 '&$ .:77039*8.8007080.7481742% ! $.3:2 ! $025*..$ %& ## 8..0$".20 8.*.:0411473 9033 47/.:770398.0.208.3/430884:/-0/85.*.0&63.:7847 % $% # 945*/48 ! 3974/:.20 .208.3:2 &# 5*3:2 .3/90899057.8003907903:2-074194524302.499 ..:7847% .:77039*8.:77039*8.3:2.898.:770398.*03.20 02503. 0090.*.898.:7847 %025*.20 8.94394 7.898..49984:/-0 /85.:041 9033 47/ $.84-0890/ 470.0 %# 945*/48 !%5*3:2!# !% !0.784:/.7090/14780.3/$..43/0898..20%! ..0/ %0800254008.:770398.% .%! &#$ #025*. 0258.9.*03. 025*..*03.51 438/0790..20 ..3/!. # 025 # 8.7 190:807039078.. . %025*.07.:7847 & $#%% 945*/48 3..0/.714305078438890/903 .*3:2025*..0908.:7847$ $% 03...0254008. ..:7847% .0908..:7847# &%.20 . 0258.#9.*03.504504.078 # ..%! .65: 065.250 190:807039078... $" . -0 !.*.90%! .70/.:77039/3..03.90 .:78479470970.:7847 .01742900259..3/90/05.20174290/0599.20/059/3.7920393:2-0794.. # 025 # /05934.841 0254003.0.8890/05..:7847$ $%/05934 /3.*30 025..20 4. .20 $ &%!&%!&% .-090/09.90 8.9/05..70/.:77039/05934/059/05934%! .792039:2-07 .4-0254-%! .90025400844739.: 7 70 39 /0 59 3 4 0 5.0&63.:77039/05934 .7920393:2-07.:7847$ !% .70/.%! .:78479470970..20%! .20 4.090/05.2002503.*/05934 .20%! .792039 $%$#'# &%!&% # &#$ #/059*.20 %/059..30.20 # /059 ## /05934 &#$ #025.:7847 ! %/059.3/8.:77039/3.34907.741.7 .:7847% .8.#9.:77039/3.9002570/.7920393.65: &80.0258.:7847 % & $ &%!&%!&% 05. 7 92 03 9 .2702527%! .30 !/059*.7. 20 ./05934&# $ $%03. 0 3974/:.4393:0/433095.94394 7.. $025.3/!.:7847 490$4:943.0$". $" . 7 0 / . ! 025.03&$.0&63..:77039/05934 ! %0254:7847% .4. * 8 .0.65.03.:7847$ !% $025.#9. 9 0 . .51#&$.:7847 $/059.70/.6"9.:7847 .20 .*30 ! 025. %0254:7847 % & $ &%!&%!&% .:7847 $ &%!&%!&% .:7847$ !% $025.8. * 4 .03..51 !025.90 .20 .65: 065.:7847 $%$#'# &%!&% 5.9610. . 0$4:9438 .3/#&##% 1:3.:7847$ $%02534 ' # & 8.:7847574... .9.78%!& &#$ #025*.*02534 02502534%! 5*02534 .0883 $%'# !%502534!# !% !0.8003907900254003:2-07 # .9090 #&!%.8907802589.943.4393:0/ 4/15686943.!7.47547.93. 47/8. .:7847 ! #02570.:7847 .*02534 #&!% #025*70.89078. .47/025*. .89078& 8.89078 ! &!%025 $%89. # 025 #02534. * * * * * % .89078 #&##% 025*. .78. ! . ! $%'# $"$%#%5686 $"$%02534 8.78 # 025 #02534 3974/:.3/!.0$".94394 7. 89.. $" . !.0$4:9438 790.!7..9. !# !% !0.20 % .20.8.90 0.08 708:98 '&$ 4709.059439..557457.3..*8.7418.8. 2 0 .147..$"-4.3.709419089.557457. 8 .7039070//408349709:73.741 % *# .2041900254009.. 9442.3/0900..34300254009.3/3807939490$$$9.059439..7.8003907908...0$".20 # 025 # 8.-090025400 8 3.04709. $%03.:770/ 0%08990-4.7.:0 # .94800.3.7 1908.05943..-0902088...7418..9.3/3807939490 $$$9.808 $%'# !%5*8.90 0.349070.741 % # .3748 .. !% 34/.14:3/% $#%% 2088.557457.3/908.059439..08 708:98 ' & $ .3/3807939490$$$9. 49078% $#%% 2088.3/07.8.2002503.*8.7.:770/ $%'# $" $%#% 3974/:..03.0$4204907077474.:0 1908...9903.3/0900..-0902088. 8.05943.8.%! 5*8..040254009.24:39 .8.20%! .038.7 1908..03.-0902088..08 708:98 '&$ $4204907077474. 0 3 .7039070/709:73824709.94394 7.3/07..3/0.3/!. $#%% 2088.900.3/07.343074 .08 708:98 '&$ 40254009.3748% $#%% 2088.3430 0254009.05943.7039070/709:7384343074 3807939490$$$9. 0258. $" . 5686 $" $%#% 5686 $" $%#% 5686 . 990850.0&63.51 4/1568694.05943.:9090!.0.65: 065.2088.30.//.88.3/07 790.05943.09490:8079.30.792039/408349089 0.#9.3/071479007747945.10/ /05. .792039 % *# .-039073. 5*4..800390790/05.0$".//059% 2088..$"-4.7920394./05..*/05934 /059/05934%! 5/05934 &!%/059 $%4.0 05.7920393:2-07 !%5*4.//059 % !% 03.800390790/05.//059 !% .3/!.94394 7.*/05934 8.8003.*/05934 $" % &% 7.0 $"$%#%5686 3974/:..7920399.!# !% !0..792039 $%'# !#%2088.//05.33.943 # 03.0'## !%5*/05934!# !% !0. #/05934.9/408349089 $%'# '#2088. $" . 7920393:2-07 !%5*4.#9.792039 % # ..3/!.0$".65: 065./05934 8.94394 7.792039 $%'# 3974/:.800390790/05.0.943 # 03.//059% /-284:95:95:9*30 05.51 $%'# !%5*/05934!# !% !0...*/05934 $" % &% 7.8003.//059!% . /05934 /059/05934%! 5/05934 &!%/059 $%4.800390790/05.!# !% !0. #/05934.//059 % !% 03. 5*4.7920394....//05.33.0&63. $" . #9.0&63.!.51 790.65: 065.0. 98.3/.7.084:/ 3/.349070.984204907077474.90 42.77.059439.34025 % #$024709.8.8.0 %0708340254008..48.900.3/0.2088.0'## $%'# !%5*8..98.909.09490:8073/.*8..%!.. 0258.3/07%02088.084:/3/..!# !% !0.20 $% % ..:0039070/ 19070834025400939. 0258.7 # ..97.34025 # # 025 .704304724700254008939. &# 34025709:730/!% 24709.*8.7-09003 % # .$"-4.30254008.34025 % #$034025709:730/ $. ..7039.%!.957398903:2-0741025400842.9890.30.%! 58. .9. ..3430025% 2088.80 19070.48.05:84723:8 41908.8003907908.30 902088.93 9.80&80.30 5739.0594314798.34025 0258.30 .3.3/ % # ..77. .0 %0708.3 4300 25 !% .3430025 !% 0* 34025709:730/% 2088.557457..05943.:770/ '#*2088.8. 0*24709.8.4:39 03. ... 94394 7. 3974/:...8.8.*34*025 025400 8 9..3/!.3/ % # . .0$".48.7-09003 % # .70 % *# . $" . . $%'# !#%*2088.0 $"$%#%5686 . .51 $%'# !%5*8.%!.%! 5*8.8003907908.#9. .65: 065.4:39 03.34025 % #$02470 9.34025 % #$0*34025709:730/ $.3430025 !% 034025709:730/% /-284:95:95:9*30 %0708340254008. 0 *24709.0&63. 0258. .3430025% /-284:95:95:930 %0708.48.7 # .-09003. 0258.. . 0258.. .8.*8.8.7 -09003 % *# .3/.34025 # 025 # 8.*4*8.3430*025!% $% .*8.8.34025 &# 034025*709:730/!% 0*24709.3/ % # .20 % .0.%!.!# !% !0. .48.*8. 4 8 .8. 3/ % # .8.*34*025 025400 8 9. 49078% /-284:95:95:930 .70 % *# ...7-09003 % # . . :770/ 3974/:.3/!. $%'# $4204907077474..0$".94394 7.. $" . 3/!.0$".94394 7.3974/:.. $" . .3/.-008.9.759438 . %.