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 -> Re: How do I do a Select Into

Re: How do I do a Select Into

From: Konstantin V Sartakov <skv_at_kpbank.ru>
Date: 1997/04/17
Message-ID: <33556FF5.37F6@kpbank.ru>#1/1

Shawn Francis wrote:
>
> Very simple question. How do select data out of one table and put the
> results into another table.
>
> Example:
>
> Select MedicalRecordNumber, count(*) into newTableName
> From existingTableName
>
> According to the manuals I have I can only do this into variables. Is this
> true?

        Hi Shawn Francis
If newTableName exists then use

	INSERT INTO newTableName(col1, col2)
        SELECT MedicalRecordNumber, count(*)
          FROM existingTableName

else use

	CREATE TABLE newTableName(col1, col2) AS
        SELECT MedicalRecordNumber, count(*)
          FROM existingTableName
	

Regards


         Konstantin V. Sartakov
                Kuzbassprombank
                       Kemerovo
                         Russia
           mailto:skv_at_kpbank.ru
Received on Thu Apr 17 1997 - 00:00:00 CDT

Original text of this message

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