reference - Oracle SQL Foreign Key Issues -
reference - Oracle SQL Foreign Key Issues -
i trying create tables references maintain getting next error:
error @ line 4: ora-00907: missing right parenthesis
...and have searched high , low no clear way on how resolve this. have following:
drop table financing_plans; create table financing_plans (plan_id char(10) primary key, establishment varchar2(15) not null, loan_type varchar2(10) not null, min_down number(10,2) not null, max_loan_amount number(10,2) not null, percentage number(10,2) not null, max_term number(10,25) not null);
drop table sale_financings;
create table sale_financings (sale_id char(10) primary key, down_pay varchar2(25) not null, loan_term varchar2(18) not null, foreign key ("plan_uid") references financing_plans(plan_id) foreign key ("sale_uid") references sales(sale_id));
drop table sales;
create table sales (sale_id char(10) primary key, salesperson_id varchar2(25) not null, cust_id varchar2(10) not null, vin varchar2(10) not null, gross_sale_price number(10,2) not null, mileage number(10,2) not null, sale_date date, vehicle_status varchar2(10) not null);
any solution, anyone?
thanks,
you have create columns foreign key @ first, , create foreign keys:
create table financing_plans ( plan_id char(10) primary key , establishment varchar2(15) not null , loan_type varchar2(10) not null , min_down number(10,2) not null , max_loan_amount number(10,2) not null , percentage number(10,2) not null , max_term number(10,25) not null ); create table sales ( sale_id char(10) primary key , salesperson_id varchar2(25) not null , cust_id varchar2(10) not null , vin varchar2(10) not null , gross_sale_price number(10,2) not null , mileage number(10,2) not null , sale_date date , vehicle_status varchar2(10) not null ); create table sale_financings ( sale_id char(10) primary key , down_pay varchar2(25) not null , loan_term varchar2(18) not null , plan_id char(10) not null , sale_uid char(10) not null , constraint constraint_name_fk foreign key (plan_id) references financing_plans(plan_id) , constraint constraint_name_fk2 foreign key (sale_uid) references sales(sale_id) );
oracle reference foreign-keys
Comments
Post a Comment