User Tools

Site Tools


kurs:nested_tables_und_collection_operator
PROCEDURE hr.multiset
is
cursor c_emp_salary_lt(cp_min_salary employees.salary%type) is
select first_name||' '||last_name||' '||salary
  from employees
  where salary > cp_min_salary;

-- nested table
type t_emp is table of varchar2(100);


emp1 t_emp;
emp2 t_emp;
emp_multi t_emp;
BEGIN

open c_emp_salary_lt(5000);
fetch c_emp_salary_lt bulk collect into emp1;
close c_emp_salary_lt;

open c_emp_salary_lt(15000);
fetch c_emp_salary_lt bulk collect into emp2;
close c_emp_salary_lt;

-- multiset funktioniert NUR mit nested table
emp_multi := emp1 multiset intersect emp2;

for c in 1..emp_multi.last loop
  dbms_output.put_line(emp_multi(c));
end loop;
END; -- Procedure
kurs/nested_tables_und_collection_operator.txt · Last modified: 2014/09/10 21:22 (external edit)