User Tools

Site Tools


kurs:pipelined_function_mit_oracle_data_type

This is an old revision of the document!


FUNCTION get_emp_per_dep
  ( p_departement_name in varchar2)
  RETURN emp_list pipelined
  is
  t_emp_list emp_list := emp_list();
  c boolean := false;
  e_no_emp_found exception;

  pragma EXCEPTION_INIT
     (e_no_emp_found, -20001);
  
BEGIN
  for emp in (select first_name||' '||last_name name
          from employees e, departments d where
          e.department_id = d.department_id and
          department_name = p_departement_name) loop
  c := true;
--  t_emp_list.extend;
--  t_emp_list(t_emp_list.last) := emp.name;
    pipe row(emp.name);
  end loop;
  
  if c = false then
      raise_application_error(-20001, 'NO emp found in dep ' || p_departement_name);
  end if;
  return;
END;
kurs/pipelined_function_mit_oracle_data_type.1410376975.txt.gz · Last modified: 2015/04/23 13:02 (external edit)