ORACLE建立一張表
阿新 • • 發佈:2018-12-11
--先建立一個序列
CREATE SEQUENCE SEQ_T_GM_COMMUNITY INCREMENT BY 1 MAXVALUE 9999999999999999999999999999 MINVALUE 1 CYCLE CACHE 20 ORDER;
--建立一個觸發器
create or replace trigger "BI_T_GM_COMMUNITY" before insert on "T_GM_COMMUNITY" for each row begin if :NEW."ID" is null then select "SEQ_T_GM_COMMUNITY".nextval into :NEW."ID" from sys.dual; end if; end;
--建立一張表
--建立一張表 create table T_GM_COMMUNITY ( ID NUMBER(8) PRIMARY KEY, NAME VARCHAR2(100) NOT NULL, HEAD_IMG VARCHAR2(150) NOT NULL, CREATE_DATE DATE DEFAULT SYSDATE, TITLE VARCHAR(200) NOT NULL, PRAISE NUMBER(8) DEFAULT 0, REPLY NUMBER(8) DEFAULT 0, TRANSPOND NUMBER(8) DEFAULT 0 )