1CREATE TABLE departments (
2 ID NUMBER(10) NOT NULL,
3 DESCRIPTION VARCHAR2(50) NOT NULL);
4
5ALTER TABLE departments ADD (
6 CONSTRAINT dept_pk PRIMARY KEY (ID));
7
8CREATE SEQUENCE dept_seq START WITH 1;
9
1CREATE OR REPLACE TRIGGER dept_bir
2BEFORE INSERT ON departments
3FOR EACH ROW
4
5BEGIN
6 SELECT dept_seq.NEXTVAL
7 INTO :new.id
8 FROM dual;
9END;
10/
11