Re: PL/SQL temp tables

From: Charles Thompson <thompsoc_at_groupwest.ca>
Date: 1995/03/29
Message-ID: <3lcqv3$8oh_at_wolfe.wimsey.com>#1/1


>
> ----------------------------------------------------------------------
> Subject: PL/SQL temp tables
> Date: Tue, 28 Mar 1995 15:48:19 LOCAL
> From: dkilgall_at_email.vill.edu
> Organization: Villanova University
> Newsgroups: comp.databases.oracle
>
> ---------------------------------------------------------------
>
> Fellow Netters,
> I have been trying to implement the use fo temporary tables per user
 with
> PL/SQL tables. The only references in the documentation suggest a data
 type
> definition like TYPE TEMPTAB, then a variable definition like TEMP_EMP
 TEMPTAB;
> But where do I put it? I tried all the usual places with no sucess. And
 the
> lumps on my head are really starting to hurt!
>
 

Here is some sample PL/SQL code to define and use a PL/SQL table.



create or replace procedure test_tables (

   parm1 in number ) as  

   /* PL/SQL tables for temporary storage */  

   /* first, declare table type. */
   type temp_table_type is

      table of real_table.field11%TYPE  /* or "table of varchar2(30)" */ 
      index by binary_integer; 
 

   /* next, declare a table object of the predeclared type */    temp_table temp_table_type;  

   /* you'll probably also want to use an index variable for loops */    i number(8);  

begin     

   /* initialize the first 20 entries in the table to null */    for i in 1..20 loop

        temp_table(i) = null;
   end loop;  

   /* to simulate a 2-D array (a "relation"), use a separate table */    /* for each column ... and make sure you keep them in sync ! */ end test_tables;


 

That's it. Have fun.    

--  
=-=-=-=-=-=-=-=-= C h a r l e s   T h o m p s o n =-=-=-=-=-=-=-=-= 
=-=-=-=-=-=-=-=        thompsoc_at_groupwest.ca        =-=-=-=-=-=-=-= 
=-=-=-=-=-=-=                   /\                    =-=-=-=-=-=-= 
=-=--==-=-=                     \/                      =-=-=-=-=-= 
Received on Wed Mar 29 1995 - 00:00:00 CEST

Original text of this message