sql - Issue with null values being inserted -
so have searched on answer, know it'll basic , silly i've overlooked life of me can't see it.
at insert "" values point, i'm stuck unable insert null values.. need spaces blank. :/
drop table patient; drop table kennel; drop table prescription; create table patient ( patient_id number, name varchar2(15), dob date, primary key(patient_id) ); create table kennel ( kennel_no varchar2(2), kennel_section varchar2(1), admission_date date, patient_id number, primary key(kennel_no), foreign key (patient_id) references patient ); create table prescription ( prescription_date date, drug_code varchar2 (5), drug_name varchar2 (55), dosage varchar2 (25), num_days_dosage number , kennel_no varchar(255), foreign key (kennel_no) references kennel ); insert patient values (1234,'wiggles','12 dec 1996'); insert patient values ('','',''); insert patient values (4587, 'woofy', '15 nov 1999'); insert patient values ('', '',''); insert patient values ('', '',''); insert patient values (4692,'hiccup','3 apr 1998'); insert patient values ('', '',''); insert patient values ('', '',''); insert patient values (5432, 'sandy', '2 jun 2002 '); insert patient values ('', '', ''); insert patient values ('', '', ''); insert patient values (2591, 'snoopy', '28 aug 2001'); insert patient values ('', '', ''); insert patient values (4563, 'dopey', '1 apr 2004'); insert kennel values (23,'a', '20 oct 2005'); insert kennel values ('', '', ''); insert kennel values (28, 'b', '10 nov 2005'); insert kennel values ('', '', ''); insert kennel values ('', '', ''); insert kennel values (25, 'a', '21 nov 2005'); insert kennel values ('', '', ''); insert kennel values ('', '', ''); insert kennel values (35,'c', '30 nov 2005'); insert kennel values ('', '', ''); insert kennel values ('', '', ''); insert kennel values (34, 'c', '04 dec 2005'); insert kennel values ('', '', ''); insert kennel values (30, 'b', '06 dec 2005'); insert prescription values ('20 oct 2005', 'co156', 'cortisone', '2 pills, 3 times day', 14, 23); insert prescription values ('23 oct 2005', 'ap566','aspirin', '1 pills, 3 times day', 10, 23); insert prescription values ('13 nov 2005','pe312', 'penicillin', '1 pill, 3 times day', 5, 28); insert prescription values ('14 nov 2005','ap566', 'aspirin', '2 pills, 2 times day', 14, 28); insert prescription values ('15 nov 2005','co156', 'cortisone', '2 pills, 3 times day', 10, 28); insert prescription values ('22 nov 2005','pe312', 'penicillin', '1 pill, 3 times day', 2, 25); insert prescription values ('23 nov 2005', 'ap566','aspirin', '2 pills, 2 times day', 10, 25); insert prescription values ('24 nov 2005', 'be159', 'benzocaine', '2 pills, 3 times day', 7, 25); insert prescription values ('30 nov 2005', 'co156', 'cortisone', '1 pill, 3 times day', 7, 35); insert prescription values ('02 dec 2005', 'ap566', 'aspirin', '2 pills, 2 times day', 12, 35); insert prescription values ('03 dec 2005', 'be159', 'benzocaine', '2 pills, 3 times day', 2, 35); insert prescription values ('04 nov 2005', 'co156', 'cortisone', '1 pill, 3 times day',10, 34); insert prescription values ('05 dec 2005', 'ap566', 'aspirin', '2 pills, 2 times day', 8, 34); insert prescription values ('06 nov 2005', 'pe312', 'penicillin', '3 pills, 3 times day',7,30);
your column set allow nulls, and/or have no default value. check settings on table.
Comments
Post a Comment