PL/SQL Tables

From: The Magnet <art_at_unsu.com>
Date: Thu, 6 May 2010 07:56:31 -0700 (PDT)
Message-ID: <d239d719-b3ea-4f75-b6f5-1720f159fd4d_at_u7g2000vbq.googlegroups.com>


Hi,

I'm trying to create a Pl/SQL table and SELECT from it. I've looked all over for code examples, but none are working. Please look at this. Maybe someone knows what is wrong and can give me the correct code?

create or replace package test as
TYPE emp_type AS OBJECT
  (id NUMBER,
   name VARCHAR2(20));

TYPE emp_tab IS TABLE OF emp_type;

procedure test1;
end test;
/

create or replace package body test1 as
  g_ref REFCURSOR
  employees emp_tab := emp_tab();

BEGIN
  employees.EXTEND(2);
  employees(1) := emp_type (1, 'name1');   employees(2) := emp_type (2, 'name2');   OPEN :g_ref FOR
  SELECT * FROM TABLE (CAST (employees AS emp_tab)); END test1
end test;
/

Thanks! Received on Thu May 06 2010 - 09:56:31 CDT

Original text of this message