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 -> insert/select

insert/select

From: Jim Poe <jpoe_at_fulcrumit.com>
Date: 24 Aug 2000 18:41:22 GMT
Message-ID: <8o3q8i$a3i@dispatch.concentric.net>

I have three tables, A, B, and C. C is a detail of B and B is a detail of A.

table A
  A_ID
  NAME table B
  B_ID
  A_ID
  FOO table C
  C_ID
  B_ID
  BAR I would like to copy a record in A and all it's details. I can copy A and the details from B using

insert into A( A_ID, NAME )
  select A_SEQ.NEXTVAL, NAME
  from A where A_ID=OldA_ID

select A_SEQ.CURRVAL into NewA_ID from dual;

insert into B ( B_ID, A_ID, FOO )
  select B_SEQ.NEXTVAL, NewA_ID, FOO
  from B where A_ID=OldA_ID

How do I copy B's details from C? Can I do this without a cursor and a loop?

--
Jim Poe ( jpoe_at_fulcrumit.com )
Received on Thu Aug 24 2000 - 13:41:22 CDT

Original text of this message

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