salix/db/routines/vn/procedures/bankEntity_checkBic.sql

20 lines
459 B
SQL

DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`bankEntity_checkBic`(vBic VARCHAR(255))
BEGIN
/**
* If the bic length is Incorrect throw exception
*
* @param vBic bic code
*/
DECLARE vConfigBicLenght INT;
SELECT bicLength INTO vConfigBicLenght
FROM vn.bankEntityConfig bec;
IF LENGTH(vBic) <> vConfigBicLenght THEN
CALL util.throw(CONCAT('bic must be of length ', vConfigBicLenght ));
END IF;
END$$
DELIMITER ;