Torna al Thread
CREATE OR REPLACE PROCEDURE AggiornaABI_CAB
DECLARE CURSOR TabCAB SELECT COD_ABI, COD_CAB, INDIRIZZO, COMUNE, NUMCIV, BANCA, FILIALE FROM ZCNTB_EXTRA_ABICAB;
strCOD_ABI VARCHAR2(100);
strCOD_CAB VARCHAR2(100);
strINDIRIZZO VARCHAR2(100);
strCOMUNE VARCHAR2(100);
strNUMCIV VARCHAR2(100);
strBANCA VARCHAR2(100);
strFILIALE VARCHAR2(100);
RowTabCAB TabCAB%ROWTYPE;
TRUNCATE FROM ZCTR_ABI;
INSERT INTO ZCTR_ABI SELECT DISTINCT(COD_ABI), BANCA FROM ZCNTB_EXTRA_ABICAB;
IS BEGIN
TRUNCATE FROM ZCTR_CAB;
OPEN TabCAB;
LOOP
FETCH TabCAB INTO RowTabCAB;
EXIT WHEN TabCAB%NOTFOUND;
INSERT INTO ZCTR_CAB(COD_ABI, COD_CAB, INDIRIZZO, CAP, NR_CIVICO, DESC_AGENZIA) VALUES(strCOD_ABI, strCOD_CAB, strINDIRIZZO, strCOMUNE, strNUMCIV, strBANCA || strFILIALE);
END LOOP
CLOSE TabCAB;
COMMIT;
EXCEPTION
END AggiornaABI_CAB;