Home » SQL & PL/SQL » SQL & PL/SQL » On delete set default
On delete set default [message #22044] Thu, 19 September 2002 02:19 Go to next message
woody
Messages: 1
Registered: September 2002
Junior Member
How to specify foreign key constraint in create table statement.

I have two tables. Emp and Dept.
create statement as follows:

create table emp
(empid char(4),
ename char(20),
dno char(3) not null default 1,
primary key (eid),
foreign key (dno) references dept(dnumber)on delete set default;

create table dept
(dnumber char(3),
dname char(10),
primary key (dnumber);

when specifying this statement "dno char(3) not null default 1" in oracle it's gives an error on 'default' How can I specify 'a default value for a FK'
Re: On delete set default [message #22056 is a reply to message #22044] Thu, 19 September 2002 09:14 Go to previous message
Todd Barry
Messages: 4819
Registered: August 2001
Senior Member
Just put the default value first:

dno char(3) default 1 not null


Also, the 'on delete set default' is incorrect (the only options are 'cascade' and 'set null').
Previous Topic: getting the 10 years from this year
Next Topic: Update ?
Goto Forum:
  


Current Time: Thu Jul 24 07:09:25 CDT 2025