Re: referring to a temp table in a procedure?

From: L. Tseng <lesliet_at_u.washington.edu>
Date: 1996/11/13
Message-ID: <56d0hc$446_at_nntp1.u.washington.edu>#1/1


[Quoted] If I declare a RECORD type and populate it, how can I loop thru it? For example:

DECLARE    TYPE EmpRecType IS RECORD

        (empno    NUMBER,
         ename    VARCHAR2(15),
         sal      NUMBER(10,2));

   EmployeeRec EmpRecType;

BEGIN
    SELECT empno, ename, sal INTO EmployeeRec FROM mydept;

  • then DBMS_OUTPUT all the rows
  • please fill in... END;
Thank you very much!!!

In article <32899BF5.6323_at_ozemail.com.au>, Sridhar Subramaniam <avion_at_ozemail.com.au> wrote:
>L. Tseng wrote:
>>
>> I don't know if this is a trivial question but I am hitting
>> the wall now. Any help will be very appreciated!!!
>>
>> What I want to do is
>>
>> In a strored procedure,
>>
>> create a temp table;
>>
>> insert some rows to the temp table;
>>
>> create a cursor on the temp table;
>>
>> Loop thru the temp table with the DBMS_OUTPUT;
>>
>> It seems to me DBMS_SQL is the only way to go but...
>>
>> Can what I want be achieved? how?
>>
>> Thank you very much.
>>
>> Leslie
>Leslie,
>The way you are going, dbms_sql seems to be the only way since ddls are
>not supported in pl/sql.
>
>A better way is to create pl/sql table and loop thro' it. Depending on
>the version of oracle you use, pl/sql support for table-type variables
>differ. In ver 2.0 and 2.1 pl/sql supports one dimensional array-like
>tables. 2.3 supports table of records and table-type attributes.
>
>Check your pl/sql manual for more details
>
>--
>Cheers
>
>Sridhar Subramaniam
>Avion Consulting Services
>Sydney - Australia
>Email : avion_at_ozemail.com.au
>
>Disclaimer : All opinions are truly and just mine.
Received on Wed Nov 13 1996 - 00:00:00 CET

Original text of this message