CREATE TABLE ZH_LOG (
   TYPE 		VARCHAR2(10) 		NOT NULL,
   HTTP_RESPONSE_CODE 	NUMBER(10),
   REQ_ID 		VARCHAR2(30) 		NOT NULL,
   METHOD 		VARCHAR2(10) 		NOT NULL,
   REQUEST_TYPE 	VARCHAR2(20),
   TIMESTAMP 		DATE 			NOT NULL,
   ORGANIZATION_ID 	NUMBER 			NOT NULL,
   USER_ID 		VARCHAR2(12) 		NOT NULL,
   PRODUCT_ID 		NUMBER,
   CONTAINER_NAME 	VARCHAR2(200),
   WIDGET_NAME 	VARCHAR2(200),
   CONTENT 		CLOB 			NOT NULL,
   ROUTE 		VARCHAR2(200),
   NRORG               NUMBER 			DEFAULT 	SYS_CONTEXT('nrorg_ctx','nrorg') NOT NULL,
   IDATIVO              VARCHAR2(1)     	DEFAULT 'S' NOT NULL
      CONSTRAINT CKC_IDATIVO_ZH_LOG CHECK (IDATIVO IN ('S','N')),
   DTINCLUSAO           DATE                    NULL,
   DTULTATU             DATE                    NULL,
   NRORGINCLUSAO        NUMBER                  DEFAULT 1 NULL,
   CDOPERINCLUSAO       VARCHAR2(12)  		DEFAULT '1' NULL,
   NRORGULTATU          NUMBER                  DEFAULT 1 NULL,
   CDOPERULTATU         VARCHAR2(12)  		DEFAULT '1'
)
/
ALTER TABLE ZH_LOG ADD CONSTRAINT ZH_LOG_REQUEST_TYPE CHECK (REQUEST_TYPE IN ('DataSet', 'Row', 'Empty'))
/
ALTER TABLE ZH_LOG ADD CONSTRAINT ZH_LOG_METHOD CHECK (METHOD IN ('POST', 'GET', 'PUT', 'DELETE', 'OPTIONS'))
/
CREATE INDEX IDX_ZH_LOG ON ZH_LOG (TIMESTAMP, ROUTE) 