//建Sequence
create sequence STUDENT_S
minvalue 1
maxvalue 999999999999999999999999
start with 1
increment by 1
cache 20;
//建表
CREATE TABLE STUDENT
(
ID INTEGER,
"NAME" VARCHAR2(20),
ADDRESS VARCHAR2(40),
AGE INTEGER
)
//建Trigger
CREATE OR REPLACE TRIGGER INSERTSTUDENTID
BEFORE INSERT ON STUDENT
FOR EACH ROW
BEGIN
SELECT STUDENT_S.NEXTVAL INTO :NEW.ID FROM DUAL;
END;