This shows you the differences between two versions of the page.
— |
kurs:einfache_cursor [2014/09/10 21:22] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | <code> | ||
+ | PROCEDURE P_CURSOR | ||
+ | IS | ||
+ | cursor emp_per_dep is | ||
+ | select * from ( | ||
+ | SELECT department_name, count(employee_id) cc | ||
+ | FROM departments, employees | ||
+ | WHERE ((departments.department_id = employees.department_id)) | ||
+ | group by department_name | ||
+ | ) | ||
+ | where cc > 3 | ||
+ | order by cc desc; | ||
+ | | ||
+ | v_name varchar2(100); | ||
+ | BEGIN | ||
+ | |||
+ | -- imlpizit cursor open + definition von passendem rec type | ||
+ | |||
+ | for emp_per_dep_rec in emp_per_dep loop | ||
+ | dbms_output.put_line(emp_per_dep_rec.department_name||' '||emp_per_dep_rec.cc); | ||
+ | end loop; | ||
+ | |||
+ | for emp_name in (select last_name from bonus) loop | ||
+ | dbms_output.put_line(emp_name.last_name); | ||
+ | end loop; | ||
+ | |||
+ | END; -- Procedure | ||
+ | </code> |