Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Help : temporary tables with oracle8 ?
On Wed, 30 Dec 1998 00:35:02 +0100, Chams SOUABNI
<souabni_at_isia.cma.fr> wrote:
>hi,
>
>Does anyone know how to use temporary tables in oracle8,
>or something similar to those #table_name in Sybase ?
>
>I tried varrays ... but I can't do a select from a varray ...
>
You could try something like this...
SQL> create or replace type myTableType as table of number;
2 /
Type created.
SQL> declare
2 l_x myTableType := myTableType( 1, 2, 3, 4, 5, 6, 7, 8, 9 );
3 begin
4 for x in ( select a.column_value val 5 from THE ( select cast( l_x as myTableType ) 6 from dual ) a ) 7 loop 8 dbms_output.put_line( x.val ); 9 end loop;
1
2
3
4
5
6
7
8
9
PL/SQL procedure successfully completed.
Using the 'THE' operator and casting the variable of type myTableType, you can select from it.
A more robust example was posted by Tom Kyte on 28-DEC-98. Go here to see more examples on how to use this.
http://www.dejanews.com/getdoc.xp?AN=426562018
hope this helps.
chris.
>Thanks for any help.
>
>
>chams.
--
Christopher Beck
Oracle Corporation
clbeck_at_us.oracle.com
Reston, VA.