Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Для таблицы
- CREATE TABLE EMT.DEPARTAMENT (
- DEP_ID NUMBER(38, 0),
- DEP_NAME VARCHAR2(50 CHAR) NOT NULL,
- CONSTRAINT PK_DEPARTAMENT PRIMARY KEY (DEP_ID) USING INDEX TABLESPACE USERS STORAGE (INITIAL 64 K
- NEXT 1 M
- MAXEXTENTS UNLIMITED))
- --Создаем последовательность
- CREATE SEQUENCE EMT.DEPARTAMENT_SQ
- START WITH 1
- INCREMENT BY 1
- NOCACHE;
- --Создаем триггер
- BEGIN
- IF :N.DEP_ID IS NULL THEN
- SELECT DEPARTAMENT_SQ.NEXTVAL INTO :N.DEP_ID FROM DUAL;
- END IF;
- END;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement