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!

Use table as out parameter in stored procedure

User_FTTN6Jun 22 2018 — edited Jun 25 2018

Hi All,

Please help me achieve this.

I want to return table as an out parameter in Oracle SQL.

Here's how my code looks like:

create or replace type records_array_type as object (
   EMPNAME VARCHAR(20),
    EID VARCHAR2(20),
    SAL VARCHAR(20)
    );

create or replace type records_array as table of records_array_type


CREATE OR REPLACE PROCEDURE getEmpData(ename in VARCHAR, record out records_array)AS
  table_rec records_array;

BEGIN

  SELECT  records_array_type(NAME, EMPID,SALARY)
  BULK COLLECT INTO table_rec
  FROM  EMPLOYEE where name = ename ;    

END getEmpData;

Is this correct? How do I execute this?

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 23 2018
Added on Jun 22 2018
6 comments
3,478 views