Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Help : temporary tables with oracle8 ?

Re: Help : temporary tables with oracle8 ?

From: Christopher Beck <clbeck_at_us.oracle.com>
Date: Wed, 30 Dec 1998 13:00:41 GMT
Message-ID: <368a20e0.1057450@inet16.us.oracle.com>


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;

 10 end;
 11 /

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.



Opinions are mine and do not necessarily reflect those of Oracle Corporation Received on Wed Dec 30 1998 - 07:00:41 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US