PROMPT CREATE TABLE prdkit
CREATE TABLE prdkit (
  prdkit_seq            NUMBER(20,0)  NOT NULL,
  empres_codigo         VARCHAR2(4)   NOT NULL,
  filial_codigo         VARCHAR2(4)   NOT NULL,
  prdcad_codigo         VARCHAR2(20)  NOT NULL,
  prdkit_codigo         VARCHAR2(20)  NOT NULL,
  prdkit_status         NUMBER(1,0)   NULL,
  uomcad_codigo         VARCHAR2(3)  NOT NULL,
  prdkit_qde            NUMBER(20,0) 
);


ALTER TABLE prdkit
  ADD PRIMARY KEY (
    prdkit_seq
  )
  DISABLE
/


PROMPT CREATE SEQUENCE seq_doccab
CREATE SEQUENCE seq_prdkit
  MINVALUE 1
  MAXVALUE 999999999999999999999999999
  INCREMENT BY 1
  NOCYCLE
  NOORDER
  CACHE 20
/


PROMPT CREATE OR REPLACE TRIGGER tg_bi_doccab
CREATE OR REPLACE TRIGGER tg_bi_prdkit
BEFORE INSERT
    ON prdkit
    FOR EACH ROW
DECLARE

BEGIN
   SELECT seq_prdkit.NEXTVAL
   INTO :NEW.PRDKIT_SEQ FROM dual;
EXCEPTION
    WHEN OTHERS THEN ROLLBACK;
END;
/



