I would like to create a temporary table in a Oracle database
something like
Declare table @table (int id)
In SQL server
And then populate it with a select statement
Is it possible?
Thanks
This question is related to
sql
oracle
temp-tables
CREATE TABLE table_temp_list_objects AS
SELECT o.owner, o.object_name FROM sys.all_objects o WHERE o.object_type ='TABLE';
CREATE GLOBAL TEMPORARY TABLE Table_name
(startdate DATE,
enddate DATE,
class CHAR(20))
ON COMMIT DELETE ROWS;
Just a tip.. Temporary tables in Oracle are different to SQL Server. You create it ONCE and only ONCE, not every session. The rows you insert into it are visible only to your session, and are automatically deleted (i.e., TRUNCATE
, not DROP
) when you end you session ( or end of the transaction, depending on which "ON COMMIT" clause you use).
Source: Stackoverflow.com