Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

PIPELINED Function issue

Orcl ApexAug 30 2016 — edited Aug 30 2016

Hi All,

I am trying to create a pipelined function bur facing below issue, please help in correcting it.

Error message -

  • Error(13,7): PL/SQL: Statement ignored
  • Error(13,20): PLS-00302: component 'DEPT_ID' must be declared
  • Error(14,7): PL/SQL: Statement ignored
  • Error(14,20): PLS-00302: component 'F_NAME' must be declared
  • Error(15,7): PL/SQL: Statement ignored
  • Error(15,16): PLS-00382: expression is of wrong type 

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;

This post has been answered by odie_63 on Aug 30 2016
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 27 2016
Added on Aug 30 2016
7 comments
332 views