I am trying to create a pipelined function bur facing below issue, please help in correcting it.
CREATE OR REPLACE PACKAGE pipeline_demo
AS
TYPE rtype_employees
IS
RECORD
(
dept_id employees.department_id%TYPE,
f_name employees.first_name%TYPE);
TYPE ttype_employees
IS
TABLE OF rtype_employees;
FUNCTION pipeline_function(
iv_input IN VARCHAR2)
RETURN ttype_employees pipelined;
END pipeline_demo;
/
CREATE OR REPLACE PACKAGE body pipeline_demo
AS
FUNCTION pipeline_function(
iv_input IN VARCHAR2)
RETURN ttype_employees pipelined
IS
lv_employees ttype_employees;
BEGIN
FOR i IN
(SELECT department_id, first_name FROM employees WHERE department_id = iv_input
)
LOOP
lv_employees.dept_id := i.department_id;
lv_employees.f_name := i.first_name;
pipe row(lv_employees);
END LOOP;
RETURN;
END pipeline_function;
END pipeline_demo;