CREATE TABLE AGENDAJOB (
   NRAGENDAEVENTOS NUMBER,
   NMJOB VARCHAR2(50),
   DSWHAT VARCHAR2(4000),
   NMROTINAPT VARCHAR2(200),
   NMROTINAES VARCHAR2(200),
   NMROTINAEN VARCHAR2(200),
   DTPROCESSO DATE,
   DTLIMPEZA DATE,
   IDTIPOEXEC VARCHAR2 (30) DEFAULT 'ROTINA' NOT NULL,
   IDROTINA VARCHAR2(5) DEFAULT 'DB' NOT NULL,
   NRFREQUEMINIMA VARCHAR2(20) DEFAULT 'TRINTAMINUTOS' NOT NULL,
   NRORG             NUMBER 	     DEFAULT         SYS_CONTEXT('nrorg_ctx','nrorg') NOT NULL,
   IDATIVO           VARCHAR2(1)     DEFAULT 'S' NOT NULL
      CONSTRAINT CKC_IDATIVO_AGENDAJOB CHECK (IDATIVO IN ('S','N')),
   DTINCLUSAO        DATE                  			NULL,
   DTULTATU          DATE                  			NULL,
   NRORGINCLUSAO     NUMBER          DEFAULT SYS_CONTEXT('nrorg_ctx','nrorg')		NULL,
   CDOPERINCLUSAO    VARCHAR2(12)    DEFAULT '1' 		NULL,
   NRORGULTATU       NUMBER          DEFAULT SYS_CONTEXT('nrorg_ctx','nrorg')		NULL,
   CDOPERULTATU      VARCHAR2(12)    DEFAULT '1',
      CONSTRAINT PK_AGENDAJOB PRIMARY KEY (NRAGENDAEVENTOS),
      CONSTRAINT CK_AGENDAJOB_IDROTINA CHECK (IDROTINA IN ('DB', 'LINUX')),
      CONSTRAINT CK_AGENDAJOB_IDTIPOEXEC CHECK (IDTIPOEXEC IN ('LIMPEZA', 'ROTINA')),
      CONSTRAINT CK_AGENDAJOB_NRFREQUEMINIMA CHECK (NRFREQUEMINIMA IN ('TRINTAMINUTOS', 'UMAHORA', 'DUASHORAS', 'DIARIO', 'SEMANAL', 'MENSAL'))
)
/ 