User Tools

Site Tools


kurs:p_cursor_feature

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

kurs:p_cursor_feature [2014/09/10 21:22]
kurs:p_cursor_feature [2014/09/10 21:22] (current)
Line 1: Line 1:
 +<​code>​
 +PROCEDURE P_CURSOR_FEATURES
 +   IS
 +cursor cur_dep_emp is
 +  SELECT ​  ​employees.first_name,​ employees.last_name,​
 +         ​departments.department_name
 +    FROM employees, departments
 +   WHERE (    (departments.department_id = employees.department_id)
 +          AND (departments.department_name = '​Sales'​)
 +         )
 +  ORDER BY employees.last_name ASC;
  
 +   type emp_dep_record_type IS RECORD
 +     ​(first_name ​     employees.first_name%TYPE,​
 +      last_name ​      ​employees.last_name%TYPE,​
 +      department_name departments.department_name%TYPE);​
 +
 +   ​emp_dep_rec emp_dep_record_type;​
 +BEGIN
 +    open cur_dep_emp;​
 +    for i in 1..5 loop
 +      fetch cur_dep_emp into emp_dep_rec;​
 +      dbms_output.put_line(emp_dep_rec.first_name || ' ' ||
 +                           ​emp_dep_rec.last_name ​ || ' ' ||
 +                           ​emp_dep_rec.department_name);​
 +    end loop;
 +    close cur_dep_emp;​
 +END; -- Procedure
 +</​code>​
kurs/p_cursor_feature.txt ยท Last modified: 2014/09/10 21:22 (external edit)