0% found this document useful (0 votes)
14 views

Query

The document contains SQL commands to create two tables called SA_INNER_ORDER and SA_INNER_ORDER_DETAIL, and defines primary and foreign keys for each table.

Uploaded by

mehar kashif
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views

Query

The document contains SQL commands to create two tables called SA_INNER_ORDER and SA_INNER_ORDER_DETAIL, and defines primary and foreign keys for each table.

Uploaded by

mehar kashif
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

-- Create table

create table SA_INNER_ORDER


(
INNER_ORDER_ID NUMBER(9) not null,
INNER_ORDER_TYPE NUMBER(3) not null,
CREATED_DATE DATE not null,
COMPLETED_DATE DATE,
STATE CHAR(1) not null,
STATE_DATE DATE not null,
PRIORITY NUMBER(6),
REQUEST_ID VARCHAR2(60)
)
tablespace TAB_CC
pctfree 10
initrans 1
maxtrans 255
storage
(
initial 64K
next 1M
minextents 1
maxextents unlimited
);
-- Create/Recreate primary, unique and foreign key constraints
alter table SA_INNER_ORDER
add constraint PK_SA_INNER_ORDER primary1 key (INNER_ORDER_ID)
using index
tablespace TAB_CC
pctfree 10
initrans 2
maxtrans 255
storage
(
initial 64K
next 1M
minextents 1
maxextents unlimited
);
alter table SA_INNER_ORDER
add constraint FK_SA_INNER_REFERENCE_SA_INNER1 foreign key (STATE)
references SA_INNER_ORDER_STATE (INNER_ORDER_STATE);

--------===========================================================------

-- Create table
create table SA_INNER_ORDER_DETAIL
(
INNER_ORDER_ID NUMBER(9) not null,
SEQ NUMBER(3) not null,
INNER_ORDER_DETAIL VARCHAR2(4000)
)
tablespace TAB_CC
pctfree 10
initrans 1
maxtrans 255
storage
(
initial 64K
next 1M
minextents 1
maxextents unlimited
);
-- Create/Recreate primary, unique and foreign key constraints
alter table SA_INNER_ORDER_DETAIL
add constraint PK_SA_INNER_ORDER_DETAIL primary key (INNER_ORDER_ID, SEQ)
using index
tablespace TAB_CC
pctfree 10
initrans 2
maxtrans 255
storage
(
initial 64K
next 1M
minextents 1
maxextents unlimited
);
alter table SA_INNER_ORDER_DETAIL
add constraint FK_SA_INNER_REFERENCE_SA_INNE2 foreign key (INNER_ORDER_ID)
references SA_INNER_ORDER (INNER_ORDER_ID);
----==================================================================------

You might also like