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

Home -> Community -> Usenet -> c.d.o.server -> Re: Oracle equalivent of a Sybase's ISQL for Select Into Trick

Re: Oracle equalivent of a Sybase's ISQL for Select Into Trick

From: Mark D Powell <Mark.Powell_at_eds.com>
Date: 15 Dec 2006 08:55:08 -0800
Message-ID: <1166201708.485519.210920@80g2000cwy.googlegroups.com>

On Dec 15, 10:09 am, "sybrandb" <sybra..._at_gmail.com> wrote:
> On Dec 15, 4:05 pm, Edmond <somewh..._at_yahoo.com> wrote:
>
> > Hi,
>
> > In Sybase,
>
> > I can do select * into new_table from old_table where 1=0;
>
> > This will create the empty new_table which the column name and data
> > definition the same as the old_table.
>
> > Is there a equivalent trick in Oracle to do so?
>
> > Thanks,create table foo
> as select * from bar
> where 0=1
> /
>
> Frankly the Sybase 'solution' is a kludge as it misuses SELECT to
> impost for CREATE TABLE.
> --
> Sybrand Bakker
> Senior Oracle DBA
>

Edmond, I do not know Sybase but in Oracle the Create Table as Select, commonly referred to as CTAS, creates only the table. Constraints and indexes on the source table are not copied.

See the Oracle SQL manual for more information on this and all other SQL statements.

HTH -- Mark D Powell -- Received on Fri Dec 15 2006 - 10:55:08 CST

Original text of this message

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