[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 705
  • Last Modified:

Create Temp table from view

For performance purposes I want to copy a view into a temp table before starting a SP that contains a cursor and multiple loops.

I found an example of creating the table
CREATE GLOBAL TEMPORARY TABLE my_temp_table (
  column1  NUMBER,
  column2  NUMBER
) ON COMMIT PRESERVE ROWS;

But the view has about 30 columns and I want to know if there is an easier way to do a copy besides defining every column i.e can I do something like this

CREATE GLOBAL TEMPORARY TABLE my_temp_table AS
 ( SELECT *
    FROM MY_VIEW
 )ON COMMIT PRESERVE ROWS;


Thank you
0
ckaley
Asked:
ckaley
1 Solution
 
sdstuberCommented:
CREATE GLOBAL TEMPORARY TABLE my_temp_table  ON COMMIT PRESERVE ROWS
AS
  SELECT *
    FROM MY_VIEW;  
0
 
ckaleyAuthor Commented:
Thank you so much
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now