/*ALIAS>l_data*/

/*SQLStart>544*/
CREATE TABLE CATEGORIZE (
    CAT_ID INTEGER NOT NULL PRIMARY KEY,
    CAT_CERT VARCHAR(10),
    CAT_CERTDATESTART DATE,
    CAT_CERTDATESTOP DATE,
    CAT_CERTTERM VARCHAR(10),
    CAT_CERTTERMDATESTART DATE,
    CAT_CERTTERMDATESTOP DATE,
    CAT_CAPACITY VARCHAR(10),
    CAT_PROTOCOL VARCHAR(10),
    CAT_PROTOCOLDATE DATE,
    CAT_ORDER VARCHAR(10),
    CAT_ORDERDATE DATE,
    CAT_CATEGORY INTEGER,
    CAT_CATEGORYDATESTART DATE,
    CAT_CATEGORYDATESTOP DATE,
    CAT_NOTICEID INTEGER,
    CAT_FIRMID INTEGER,
    CAT_OBJID INTEGER,
    CAT_LAST CHAR(1) DEFAULT "F")
/*SQLStop*/

/*SQLStart>545*/
grant all on categorize to public
/*SQLStop*/

/*SQLStart>546*/
create generator CAT_ID_GEN;
/*SQLStop*/

/*SQLStart>547*/
set generator CAT_ID_GEN to 0;
/*SQLStop*/

/*SQLStart>548*/
CREATE trigger cat_setlast for categorize
active before insert position 0
AS
begin
  update categorize set cat_last = 'F';
  new.cat_last = 'T';
end
/*SQLStop*/

/*SQLStart>549*/
alter table firms
  add f_managerid integer;
/*SQLStop*/

/*SQLStart>550*/
UPDATE RDB$FIELDS SET RDB$FIELD_LENGTH=240, RDB$CHARACTER_LENGTH=240
  WHERE RDB$FIELD_NAME=(SELECT RDB$FIELD_SOURCE FROM RDB$RELATION_FIELDS
  WHERE RDB$RELATION_NAME='FIRMS' AND  RDB$FIELD_NAME='F_NAME');
/*SQLStop*/

/*SQLStart>0*/
UPDATE RDB$FIELDS SET RDB$FIELD_LENGTH=240, RDB$CHARACTER_LENGTH=240
  WHERE RDB$FIELD_NAME=(SELECT RDB$FIELD_SOURCE FROM RDB$RELATION_FIELDS
  WHERE RDB$RELATION_NAME='FIRMS' AND  RDB$FIELD_NAME='F_CLEARNAME');
/*SQLStop*/

/*DLLStart>551*/
DLLName=upd013.dll
DLLProc=cnvmanager
/*DLLStop*/

/*SQLStart>552*/
alter table firms
  drop f_manager,
  drop f_managerphone,
  drop f_manageraddress;
/*SQLStop*/

/*SQLStart>553*/
alter table objects
  add o_ownerid integer;
/*SQLStop*/

/*DLLStart>554*/
DLLName=upd013.dll
DLLProc=cnvobjowner
/*DLLStop*/

/*SQLStart>555*/
alter table objects
  drop o_owner;
/*SQLStop*/

/*SQLStart>556*/
alter table objectregister
  add or_managerid integer;
/*SQLStop*/

/*DLLStart>557*/
DLLName=upd013.dll
DLLProc=cnvormanager
/*DLLStop*/

/*SQLStart>558*/
alter table objectregister
  drop or_manager,
  drop or_managerphone;
/*SQLStop*/

/*SQLStart>559*/
alter table payment
  add p_todate date;
/*SQLStop*/
