CREATE TABLE relfil( 
    RELFIL_SEQ          bigint IDENTITY(1,1) NOT NULL,
    EMPRES_CODIGO       varchar(4) NOT NULL,
    FILIAL_CODIGO       varchar(4) NOT NULL,
    RELFIL_TELA     	varchar(10) NOT NULL,
    RELFIL_DESC         varchar(60) NULL,
    RELFIL_NOMEFIL     	varchar(40) NOT NULL,
    RELFIL_CAMPO     	varchar(40) NOT NULL,
    RELFIL_OPERACAO     varchar(10) NOT NULL,
    RELFIL_VALOR     	text NULL,
    PRIMARY KEY(RELFIL_SEQ,EMPRES_CODIGO,FILIAL_CODIGO)
);

-- SCRIPT PARA ORACLE
CREATE TABLE relfil (
  RELFIL_SEQ       NUMBER(20,0) NOT NULL,
  EMPRES_CODIGO       varchar(4) NOT NULL,
  FILIAL_CODIGO       varchar(4) NOT NULL,
  RELFIL_TELA     	varchar(10) NOT NULL,
  RELFIL_DESC         varchar(60) NULL,
  RELFIL_NOMEFIL     	varchar(40) NOT NULL,
  RELFIL_CAMPO     	varchar(40) NOT NULL,
  RELFIL_OPERACAO     varchar(10) NOT NULL,
  RELFIL_VALOR     	VARCHAR2(250) NULL
)
  TABLESPACE users
/

ALTER TABLE relfil
  ADD PRIMARY KEY (
    RELFIL_SEQ
  )
  USING INDEX
    TABLESPACE users
/

CREATE SEQUENCE seq_relfil
  MINVALUE 1
  MAXVALUE 999999999999999999999999999
  INCREMENT BY 1
  NOCYCLE
  NOORDER
  CACHE 20
/

CREATE OR REPLACE TRIGGER tg_bi_relfil
BEFORE INSERT
    ON relfil
    FOR EACH ROW

DECLARE
BEGIN
   SELECT seq_relfil.NEXTVAL
   INTO :NEW.RELFIL_SEQ FROM dual;
EXCEPTION
    WHEN OTHERS THEN ROLLBACK;
END;
/