--ABS-128694
----------- WORKSTATIONEXTRAINFO -----------
ALTER TABLE WORKSTATIONEXTRAINFO ADD (SIMULATEINSCANGARMENTS VARCHAR2(1) DEFAULT 'N' NOT NULL 
                                     CONSTRAINT CHK_WORKSTATIONEI_SIMINSCGARM CHECK (SIMULATEINSCANGARMENTS IN ('Y','N')),
                                     SIMULATEINSCANRESIDENTIAL VARCHAR2(1) DEFAULT 'N' NOT NULL 
                                     CONSTRAINT CHK_WORKSTATIONEI_SIMINSCRES CHECK (SIMULATEINSCANRESIDENTIAL IN ('Y','N')));
create or replace procedure temp_workstationextrainfo is 
begin 
begin
  insert into workstationextrainfo
    (workstation_id,
     allowchangegdndeldate,
     systemuser_id,
     timestamp,
     simulateinscangarments,
     simulateinscanresidential)
    select (select workstation_id
              from workstation
             where code = 'SIMULATEIN'),
           0,
           getminsystemuser(),
           sysdate,
           'N',
           'Y'
      from dual;
  commit;
exception
  when dup_val_on_index then
    update workstationextrainfo wei
       set wei.simulateinscanresidential = 'Y'
     where wei.workstation_id = (select workstation_id
                                   from workstation
                                  where code = 'SIMULATEIN');
  when others then 
       null;
    commit;
end;

begin
  insert into workstationextrainfo
    (workstation_id,
     allowchangegdndeldate,
     systemuser_id,
     timestamp,
     simulateinscangarments,
     simulateinscanresidential)
    select (select workstation_id
              from workstation
             where code = 'SIMULATEINGM'),
           0,
           getminsystemuser(),
           sysdate,
           'Y',
           'N'
      from dual;
  commit;
exception
  when dup_val_on_index then
    update workstationextrainfo wei
       set wei.simulateinscangarments = 'Y'
     where wei.workstation_id = (select workstation_id
                                   from workstation
                                  where code = 'SIMULATEINGM');
  when others then 
       null;
    commit;
end;
end temp_workstationextrainfo;
/
execute temp_workstationextrainfo;
drop procedure temp_workstationextrainfo;
