CREATE TABLE ACQUIRING (ID INTEGER NOT NULL, DT TIMESTAMP DEFAULT current_timestamp, CHEQUE BLOB SUB_TYPE 1 SEGMENT SIZE 80, AMOUNTCLEAR VARCHAR(64), AMOUNT VARCHAR(64), CARDNAME VARCHAR(64), CARDTYPE VARCHAR(64), TRXDATE VARCHAR(64), TRXTIME VARCHAR(64), TERMNUM VARCHAR(64), MERCHNUM VARCHAR(64), AUTHCODE VARCHAR(64), RRN VARCHAR(64), MERCHANTTSN VARCHAR(64), MERCHANTBATCHNUM VARCHAR(64), CLIENTCARD VARCHAR(64), CLIENTEXPIRYDATE VARCHAR(64), EXT_ID INTEGER)`
alter table ACQUIRING add constraint PK_ACQUIRING primary key (ID)`
CREATE SEQUENCE GEN_ACQUIRING_ID`
create trigger acquiring_bi for acquiring active before insert position 0 as begin if (new.id is null) then new.id = gen_id(gen_acquiring_id,1); end `
ALTER TABLE PAYMENTS ADD ACQ_ID INTEGER`
alter table PAYMENTS add constraint FK_PAYMENTS_4 foreign key (ACQ_ID) references ACQUIRING(ID)`
ALTER TABLE SMENA ADD ACQ_CHEQUE BLOB SUB_TYPE 1 SEGMENT SIZE 80 CHARACTER SET WIN1251`



