We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

Create Temp table from view

ckaley
ckaley asked
on
Medium Priority
759 Views
Last Modified: 2012-06-21
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
Comment
Watch Question

Database Developer & Administrator
CERTIFIED EXPERT
Most Valuable Expert 2011
Top Expert 2012
Commented:
Unlock this solution with a free trial preview.
(No credit card required)
Get Preview

Author

Commented:
Thank you so much
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a free trial preview!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.