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

Home -> Community -> Usenet -> c.d.o.misc -> Creating empty temp table from an existing view

Creating empty temp table from an existing view

From: paulfil <paul.filstein_at_thehartford.com>
Date: 28 Sep 2005 07:16:52 -0700
Message-ID: <1127917012.783914.318220@g44g2000cwa.googlegroups.com>


I am looking for a generic approach to create an empty temp table matching the definition of given columns of existing view.

To do that I use SQL like the following:

CREATE GLOBAL TEMPORARY TABLE MY_TEMP_TABLE AS SELECT COLUMN_1, COLUMN_2 FROM MY_VIEW WHERE 1 = 2 The problem I face is that this approach appears to be too costly because according to explain plan ORACLE scans indexes of all the tables composing the view despite the fact that WHERE clause constantly false and no rows should be returned.

Is there a better and faster approach? One condition: the solution should be fairly generic, with only known factors being column names and view name. Received on Wed Sep 28 2005 - 09:16:52 CDT

Original text of this message

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