text: /* Formatted on 12-15-2018 8:12:36 AM (QP5 v5.126.903.23003) */
  DROP TABLE ORG.ORG_POSITIONS  CASCADE CONSTRAINTS PURGE;
  
  CREATE TABLE ORG.ORG_POSITIONS (
     POSITION_ID          NUMBER NOT NULL,
     POSITION_CODE_NAME   VARCHAR2 (200 BYTE),
     PRNT_POSITION_ID     NUMBER,
     POSITION_COMMENTS    VARCHAR2 (500 BYTE),
     IS_ENABLED           VARCHAR2 (1 BYTE),
     CREATED_BY           NUMBER NOT NULL,
     CREATION_DATE        VARCHAR2 (21 BYTE) NOT NULL,
     LAST_UPDATE_BY       NUMBER NOT NULL,
     LAST_UPDATE_DATE     VARCHAR2 (21 BYTE) NOT NULL,
     ORG_ID               NUMBER
  )
  TABLESPACE RHODB
  PCTUSED 0
  PCTFREE 10
  INITRANS 1
  MAXTRANS 255
  STORAGE (PCTINCREASE 0 BUFFER_POOL DEFAULT)
  LOGGING
  NOCOMPRESS
  NOCACHE
  NOPARALLEL
  MONITORING;
  
  CREATE UNIQUE INDEX ORG.IDX_POSITION_ID
     ON ORG.ORG_POSITIONS (POSITION_ID)
     LOGGING
     TABLESPACE RHODB
     PCTFREE 10
     INITRANS 2
     MAXTRANS 255
     STORAGE (PCTINCREASE 0 BUFFER_POOL DEFAULT)
     NOPARALLEL;
  
  ALTER TABLE ORG.ORG_POSITIONS ADD (
    CONSTRAINT PK_POSITION_ID
   PRIMARY KEY
   (POSITION_ID));
  
  CREATE INDEX ORG.IDX_POSITION_CODE_NAME
     ON ORG.ORG_POSITIONS (POSITION_CODE_NAME)
     LOGGING
     TABLESPACE RHODB
     PCTFREE 10
     INITRANS 2
     MAXTRANS 255
     STORAGE (PCTINCREASE 0 BUFFER_POOL DEFAULT)
     NOPARALLEL;
  
  CREATE INDEX ORG.IDX_POSITION_COMMENTS
     ON ORG.ORG_POSITIONS (POSITION_COMMENTS)
     LOGGING
     TABLESPACE RHODB
     PCTFREE 10
     INITRANS 2
     MAXTRANS 255
     STORAGE (PCTINCREASE 0 BUFFER_POOL DEFAULT)
     NOPARALLEL;
  
  CREATE INDEX ORG.IDX_PRNT_POSITION_ID
     ON ORG.ORG_POSITIONS (PRNT_POSITION_ID)
     LOGGING
     TABLESPACE RHODB
     PCTFREE 10
     INITRANS 2
     MAXTRANS 255
     STORAGE (PCTINCREASE 0 BUFFER_POOL DEFAULT)
     NOPARALLEL;
  
  DROP SEQUENCE ORG.ORG_POSITIONS_SEQ;
  
  CREATE SEQUENCE ORG.ORG_POSITIONS_SEQ
     START WITH 1
     MAXVALUE 9223372036854775807
     MINVALUE 1
     NOCYCLE
     NOCACHE
     ORDER;
  
  
  CREATE OR REPLACE TRIGGER ORG.ORG_POSITIONS_TRG
     BEFORE INSERT
     ON ORG.ORG_POSITIONS
     FOR EACH ROW
     -- OPTIONALLY RESTRICT THIS TRIGGER TO FIRE ONLY WHEN REALLY NEEDED
     WHEN (NEW.POSITION_ID IS NULL)
  DECLARE
     V_ID   ORG.ORG_POSITIONS.POSITION_ID%TYPE;
  BEGIN
     SELECT   ORG.ORG_POSITIONS_SEQ.NEXTVAL INTO V_ID FROM DUAL;
  
     :NEW.POSITION_ID := V_ID;
  END ORG_POSITIONS_TRG;