Skip to main content

create-table-sample | sql-memo

sqlplus から呼ぶとして

sql
whenever sqlerror EXIT FAILURE
set timing on

create table CONTENTS
(
ID number not null primary key
, PARENT_ACTION_ID number null
, SORT_ORDER number default 99 not null
, NAME varchar2(255) not null
, DISPLAY_NAME varchar2(255) not null
);

alter table ACTIONS add constraint CHK_ACTION_NAME
check(
regexp_like(name, '^[a-z0-9\-]+$')
);

create sequence SEQ_ACTION_ID
start with 1
increment by 1
nocache
nocycle
;

quit