refs #6834 feat:handle Error
gitea/salix/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Sergio De la torre 2024-02-20 16:10:16 +01:00
parent 4d2637764e
commit b9fe990003
1 changed files with 19 additions and 0 deletions

View File

@ -8,6 +8,25 @@ BEGIN
* @param vSaleGroupFk Identificador de vn.saleGroup
* @param vSectorCollectionFk Identificador de vn.sectorCollection
*/
DECLARE vHasSaleGroup INT;
DECLARE vHasSectorCollection INT;
SELECT COUNT(id) INTO vHasSaleGroup
FROM vn.saleGroup sg
WHERE sg.id = vSaleGroupFk;
IF !vHasSaleGroup THEN
CALL util.Throw ("INVALID_SALEGROUP");
END IF;
SELECT COUNT(id) INTO vHasSectorCollection
FROM vn.sectorCollection scsg
WHERE scsg.id = vSectorCollectionFk;
IF !vHasSectorCollection THEN
CALL util.Throw ("INVALID_SECTORCOLLECTION");
END IF;
REPLACE sectorCollectionSaleGroup
SET sectorCollectionFk = vSectorCollectionFk,
saleGroupFk = vSaleGroupFk;