假定有两个表TEST_1、TEST_2,表结构如下:
SQL> DESC TEST_1
名称 空? 类型
----------------------------------------- -------- --------------
ID NOT NULL NUMBER(8)
NAME VARCHAR2(8)
BIRTHDAY DATE
SQL> DESC TEST_2;
名称 空? 类型
----------------------------------------- -------- ------------
ID NUMBER(8)
NAME VARCHAR2(8)
drop table yours_product_category cascade constraints
/
drop table yours_bargain cascade constraints
/
create table yours_product_category (
site VARCHAR2(32) not null,
id NUMBER not null,
gmt_create DATE not null,
gmt_modified DATE not null,
owner VARCHAR2(128) not null,
modifier VARCHAR2(128) not null,
is_deleted CHAR(1) not null,
category_code VARCHAR2(256) not null,
category_name VARCHAR2(128) not null,
remark BLOB,
constraint PK_YOURS_PRODUCT_CATEGORY primary key (id)
)
/
create table yours_bargain (
site VARCHAR2(32) not null,
id NUMBER not null,
gmt_create DATE not null,
gmt_modified DATE not null,
owner VARCHAR2(128) not null,
modifier VARCHAR2(128) not null,
is_deleted CHAR(1) not null,
customer_name VARCHAR2(256) not null,
category_id NUMBER not null,
supplier_level VARCHAR2(4) not null,
style VARCHAR2(4) not null,
bargain_date DATE,
end_date DATE,
service_month NUMBER,
total_month NUMBER,
bargain_price NUMBER(14,3),
remark BLOB,
reserve1 VARCHAR2(256),
reserve2 VARCHAR2(256),
constraint PK_YOURS_BARGAIN primary key (id),
constraint FK_BARGAIN_PRODUCT foreign key (category_id)
references yours_product_category (id)
)
/