PROMPT Creating table EMAIL_ACCOUNTS

CREATE TABLE email_accounts (
   email_account_id              NUMBER(10,0) NOT NULL,
   email_account                 VARCHAR2(100) NOT NULL,
   row_create_time               date,
   row_date_time                 date,
   cuser                         varchar2(30),
   muser                         varchar2(30),
   mterm                         varchar2(64),
   source                        varchar2(8),
   to_be_archived                varchar2(1),
   appn_row_id                   number(18) not null,
   system_id                     number(4) default 0 not null
);

alter table email_accounts add ( constraint email_accounts_pk primary key (appn_row_id) using index tablespace &1._indexes);
  
ALTER TABLE email_accounts ADD CONSTRAINT email_accounts_uk1 unique ( email_account_id ) USING INDEX TABLESPACE &1._indexes; 

ALTER TABLE email_accounts ADD CONSTRAINT email_accounts_uk2 unique ( email_account ) USING INDEX TABLESPACE &1._indexes; 

COMMENT ON TABLE EMAIL_ACCOUNTS IS 'This table contains details of the email accounts used in the system';

COMMENT ON COLUMN EMAIL_ACCOUNTS.EMAIL_ACCOUNT IS  'Email account';
COMMENT ON COLUMN EMAIL_ACCOUNTS.EMAIL_ACCOUNT_ID IS  'Email account identifier';
COMMENT ON COLUMN EMAIL_ACCOUNTS.APPN_ROW_ID IS 'Unique sequence number for this row';
COMMENT ON COLUMN EMAIL_ACCOUNTS.ROW_CREATE_TIME IS 'The time the row was created';
COMMENT ON COLUMN EMAIL_ACCOUNTS.ROW_DATE_TIME IS 'The time the row was last modified';
COMMENT ON COLUMN EMAIL_ACCOUNTS.CUSER IS 'The user who created the row';
COMMENT ON COLUMN EMAIL_ACCOUNTS.MUSER IS 'The user who last modified the row';
COMMENT ON COLUMN EMAIL_ACCOUNTS.MTERM IS 'The terminal from which the last modifcation to this row was made';
COMMENT ON COLUMN EMAIL_ACCOUNTS.SYSTEM_ID IS 'The system identifier';
COMMENT ON COLUMN EMAIL_ACCOUNTS.SOURCE IS 'The process that last amended this row ';
COMMENT ON COLUMN EMAIL_ACCOUNTS.TO_BE_ARCHIVED IS 'Indicates that this row is to be archived or has been archived';
