Re: SQL Experts Only

From: David & Kim Di Biaggio <dibiaggio_at_iquest.net>
Date: 1996/08/08
Message-ID: <3209DF24.1F6B_at_iquest.net>#1/1


Ken Kennedy wrote:
>
> Here is my dilema...
>
> I have two tables in production that appear as shown below:
>
> SQL> desc TABLE_A
> Name Null? Type
> ------------------------------- -------- ----
> IDENTIFIER_ID NOT NULL NUMBER
> SOME_FIELD_1 VARCHAR2(20)
> SOME_FIELD_2 NUMBER
>
> SQL> desc TABLE_B
> Name Null? Type
> ------------------------------- -------- ----
> IDENTIFIER_ID NOT NULL NUMBER
> FK_TABLE_A_ID NUMBER
> SOME_OTHER_FIELD VARCHAR2(20)
>
> Currently, only TABLE_A is populated and TABLE_B is a new table. I need
> to insert an entry in TABLE_B for each row in TABLE_A. If there are 30
> rows in TABLE_A, I need to insert 30 rows in the new table. The
> IDENTIFIER_ID is a sequence number (SOME_SEQ) and the FK_TABLE_A_ID is a
> foreign key to TABLE_A.IDENTIFIER_ID.
>
> Can I do the update through SQL? I know I can make the update writing a
> quick C++/ODBC application, but I'd rather just use SQL.
>
> Any help is greatly appreciated.
>
> Ken

Try:

insert into table_b
select some_seq, identifier_id
from table_a; Received on Thu Aug 08 1996 - 00:00:00 CEST

Original text of this message