Home » SQL & PL/SQL » SQL & PL/SQL » Creating bi birectional table?
Creating bi birectional table? [message #2358] Tue, 09 July 2002 13:09 Go to next message
csst
Messages: 2
Registered: July 2002
Junior Member
Hi all;
I want to create tables that both of thier primary keys.say
table A has TableB primary Key
table B has TableA primaryKey
Thanks
Re: Creating bi birectional table? [message #2361 is a reply to message #2358] Tue, 09 July 2002 13:54 Go to previous messageGo to next message
Todd Barry
Messages: 4819
Registered: August 2001
Senior Member
Just break it up into three steps:

create table a(
  a_pk int primary key);
   
create table b(
  b_pk int primary key,
  a_pk int references a);
   
alter table a
  add (b_pk int references b);
Re: Creating bi birectional table? [message #2368 is a reply to message #2361] Tue, 09 July 2002 22:15 Go to previous messageGo to next message
csst
Messages: 2
Registered: July 2002
Junior Member
Well thanks i got it.But how i wil drop table of a and b?.IT GIVES ERROR of primary key constraint.
Re: Creating bi birectional table? [message #2383 is a reply to message #2361] Wed, 10 July 2002 09:39 Go to previous message
Todd Barry
Messages: 4819
Registered: August 2001
Senior Member
drop table a cascade constraints;
 
drop table b;
Previous Topic: MAX function with VARCHAR2 field
Next Topic: SQL LOADER
Goto Forum:
  


Current Time: Fri Apr 19 04:45:23 CDT 2024