/*ALIAS>prop_db*/

/*SQLStart>2602*/
CREATE TABLE BANKBRANCHES(
  BB_ID   INTEGER NOT NULL,
  BB_BANKNAME VARCHAR(50),
  BB_BRANCHNAME VARCHAR(50),
  BB_ADRESS VARCHAR(50),
  BB_CITY VARCHAR(50),
  BB_OBUNIT_ID INTEGER		
);
/*SQLStop*


/*SQLStart>2603*/
GRANT ALL ON bankbranches TO PUBLIC;
/*SQLStop*


/*SQLStart>2604*/
CREATE GENERATOR BB_ID_GEN;
/*SQLStop*

/*SQLStart>2605*/
SET GENERATOR BB_ID_GEN TO 0;
/*SQLStop*

/*SQLStart>2606*/
 INSERT INTO bankbranches (bb_id,bb_bankname,bb_branchname,bb_adress,bb_city,BB_OBUNIT_ID)
 VALUES (GEN_ID(bb_id_gen,1),(SELECT sys_str FROM system_strings WHERE sys_id = 1300),
 (SELECT sys_str FROM system_strings WHERE sys_id = 1303),
 (SELECT sys_str FROM system_strings WHERE sys_id = 1301),
 (SELECT sys_str FROM system_strings WHERE sys_id = 1302),
 0);
/*SQLStop*

/*SQLStart>2607*/
INSERT INTO bankbranches (bb_id,bb_bankname,bb_branchname,bb_adress,bb_city,BB_OBUNIT_ID) SELECT GEN_ID(bb_id_gen,1),unit_to_bank,unit_to_klon,unit_to_addr,unit_to_city,UNIT_PERID FROM obunits;

/*SQLStop*

/*SQLStart>2608*/
update system_strings set sys_str = '6.7.212.1' where sys_id = 1401;  /*BackOffice*/
/*SQLStop*/