You could do like this
CREATE GLOBAL TEMPORARY TABLE <table_name>
(
<column_name> <column_type>,
....
....
....
) ON COMMIT DELETE ROWS;
/
Only thing is this table remains in the DB unlike the SQL server.
Read more here:
http://download-west.oracle.com/docs...73.htm#2061433
Or try out using PL/SQL Collections..
Here is a sample
--------------------------------
/************************************************** ******* A PL/SQL table is a type of COLLECTION in Oracle.
A COLLECTION is an ordered group of elements, all of the same type
(for example, the grades for a class of students). Each element has a unique subscript that
determines its position in the collection. PL/SQL offers two COLLECTION types. Items of type TABLE
are either index-by tables (Version 2 PL/SQL tables) or nested tables (which extend the functionality of
index-by tables). Items of type VARRAY are varrays (short for variable-size arrays).
This sample gives an idea of working with COLLECTIONs of type TABLE.
You will grasp the following from the sample
1. Declare a COLLECTION of type TABLE containing OBJECTS
2. Populate(INSERT values) the COLLECTION from a table
3. UPDATE the contents of the COLLECTION
4. SELECT all the values from the COLLECTION and display them
I have used PL/SQL COLLECTIONs to convert the temp-tables in sybase to Oracle version
************************************************/
SET SERVEROUTPUT ON
-- a PLSQL table sample
-- baseball table
DROP TABLE tab_baseball
/
CREATE TABLE tab_baseball
(
ID INT,
DESCRIPTION VARCHAR2(20)
)
/
INSERT INTO tab_baseball VALUES(1,'YANKEES')
/
INSERT INTO tab_baseball VALUES(2,'METS')
/
INSERT INTO tab_baseball VALUES(3,'MARINERS')
/
INSERT INTO tab_baseball VALUES(4,'GIANTS')
/
DROP TYPE to_baseball
/
DROP TYPE obj_baseball
/
-- baseball object that holds one record of "baseball"
CREATE OR REPLACE TYPE obj_baseball IS OBJECT
(
ID INT,
DESCRIPTION VARCHAR2(20)
)
/
-- a PL/SQL table that contains more than one "baseball" objects
CREATE OR REPLACE TYPE to_baseball IS TABLE OF obj_baseball
/
DECLARE
-- a local variable of type "table of objects"
lto_baseball to_baseball := to_baseball();
BEGIN
/* insert the first 3 records from the "baseball" table into the PL/SQL table "to_baseball" */
FOR baseball IN (SELECT ID,DESCRIPTION FROM tab_baseball WHERE ID <= 3)
LOOP
lto_baseball.extend;
lto_baseball(lto_baseball.count) := obj_baseball(baseball.ID,baseball.DESCRIPTION);
END LOOP;
/* verify the number of records in the PL/SQL table "to_baseball" */
DBMS_OUTPUT.PUT_LINE('After First Insert : lto_baseball.COUNT = ' || lto_baseball.COUNT);
/* insert the remaining records from the "baseball" table into the PL/SQL table "to_baseball" */
FOR baseball IN (SELECT ID,DESCRIPTION FROM tab_baseball WHERE ID > 3)
LOOP
lto_baseball.extend;
lto_baseball(lto_baseball.count) := obj_baseball(baseball.ID,baseball.DESCRIPTION);
END LOOP;
/* verify again the number of records in the PL/SQL table "to_baseball" */
DBMS_OUTPUT.PUT_LINE('After Second Insert : lto_baseball.COUNT = ' || lto_baseball.COUNT);
/* Update the PL/SQL table "to_baseball" */
FOR li_loopidx IN lto_baseball.FIRST..lto_baseball.LAST
LOOP
lto_baseball(li_loopidx).DESCRIPTION := lto_baseball(li_loopidx).DESCRIPTION || ' team';
END LOOP;
/*
SELECTing from the PL/SQL collection is slightly different from the standard SELECT syntax.
SELECT <list of columns> FROM TABLE( CAST(<local_collection_variable> AS <collection_variable>) )
*/
/* print the whole PL/SQL table */
DBMS_OUTPUT.PUT_LINE('Print the whole PL/SQL table "to_baseball"');
FOR baseball IN (SELECT ID,DESCRIPTION FROM TABLE(CAST(lto_baseball AS to_baseball)))
LOOP
DBMS_OUTPUT.PUT_LINE(baseball.ID || '-----' ||baseball.DESCRIPTION);
END LOOP;
END;
/
--------------------------------
Read more here:
http://download-west.oracle.com/docs...colls.htm#1059