/* The following script may be used to create the required tables in Oracle database server */


/* Create LOG table */
CREATE table "LOG" (
    "ID"             NUMBER NOT NULL,
    "RECORD_DATE"    TIMESTAMP NOT NULL,
    "SERVER_IP"      VARCHAR2(255),
    "SERVER_PORT"    NUMBER,
    "CLIENT_IP"      VARCHAR2(255),
    "CLIENT_PORT"    NUMBER,
    "SESSION_ID"     VARCHAR2(255),
    "USERNAME"       VARCHAR2(255),
    "CLIENT_REQUEST" VARCHAR2(1024),
    "CLIENT_MESSAGE" VARCHAR2(1024),
    "SERVER_STATUS"  VARCHAR2(1024),
    "SERVER_MESSAGE" VARCHAR2(1024),
    "INBOUND_BYTES"  NUMBER,
    "OUTBOUND_BYTES" NUMBER,
    constraint  "LOG_PK" primary key ("ID")
);

create sequence "LOG_SEQ"
start with 1
increment by 1
nocache
nocycle
noorder;

create or replace trigger "LOG_TEST"
BEFORE
insert on "LOG"
for each row
begin
select log_seq.nextval into :new.id from dual;
end;
