Re: Temporary table
Date: 1996/07/19
Message-ID: <31EF72FB.1103_at_acsatlanta.com>#1/1
Fuzzy wrote:
>
> People,
>
> In SQL Server and Sybase, there is the concept of a temporary table,
> that can be used as a holding space for results that will need further
> work.
>
> Is there such a beast in Oracle? I can't find any references in the
> doco, and I've thought about creating views on the fly, but this could
> get messy.
>
> Ciao
> Fuzzy
> :-)
In Oracle PL/SQL Programming by Steven Feuerstein published by O'Reilly
and
Associates, Inc. in chapter 10, he discusses PL/SQL tables. "A PL/SQL
table
is a one-dimensional, unbounded, sparse collection of homogeneous
elements,
indexed by integers. It is like an array; it is like a table, yet it is
not exactly either..." He says that these were introduced in PL/SQL
version
2. His book some good examples, plus the ever popular companion disk
with
the source to examples and some useful packages.
I haven't actually used this stuff yet, but I think I understand how it works.
You can create a PL/SQL table in a stored procedure of datatype
%rowtype.
This gives you an "array" of structures with the same structure as your
permanent table. You populate the table with your intermediate results.
The PL/SQL table is private to your procedure, so you don't have to name
conflicts with other instances of your program as you would with a
regular
SQL table. You can access the intermediate results by an index, like an
array, or you can set up a primary key.
If this sounds like what you are looking for, give it a shot. I'd
appreciate
a note back on how it worked for you if you use it.
-Thanks
Allan Hicks
Received on Fri Jul 19 1996 - 00:00:00 CEST