Home » SQL & PL/SQL » SQL & PL/SQL » wanted to make a child a table
wanted to make a child a table [message #7994] Mon, 21 July 2003 10:18 Go to next message
hardik
Messages: 12
Registered: December 2001
Junior Member
hey there good morning
i am having one problem i am a beginner and wanted some help to make an existing talbe as a child with the data inside.
i have 2 tables and both r having data but i forgot to make one of them as a child table so how can i make tht if i have the repeated values in the child table there is a parent table and parent key but i can not create a reference key on tht table
so please do send me the information thanks a lot for the help
have a good day...
Re: wanted to make a child a table [message #8007 is a reply to message #7994] Tue, 22 July 2003 01:30 Go to previous message
Ganesh
Messages: 31
Registered: November 2000
Member
Try this. Hope this is what U expected...

Take for example our default tables (dept,emp)

dept - master table
emp - trans table

In dept table deptno should be Primary key. If U haven't specified already give the following command.

>ALTER TABLE DEPT ADD PRIMARY KEY(DEPTNO);

In 'emp' table 'deptno' is a foreign key which references 'deptno' of 'dept' table. To specify this,

>ALTER TABLE EMP ADD FOREIGN KEY(DEPTNO) REFERENCES DEPT(DEPTNO)
Previous Topic: ORA-12638 Conventional retrieval failed
Next Topic: retreive dates b/w 2 date
Goto Forum:
  


Current Time: Wed Apr 24 00:10:52 CDT 2024