feat: refs #6738 crear las Fk de la tabla flight #2054

Merged
robert merged 26 commits from 6738-cleanTables2008Part2to2 into dev 2024-04-05 11:51:22 +00:00
1 changed files with 19 additions and 0 deletions
Showing only changes of commit 7d39813fd0 - Show all commits

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 saleGroup
WHERE id = vSaleGroupFk;
IF !vHasSaleGroup THEN
CALL util.throw ("invalid saleGroup");
END IF;
SELECT COUNT(id) INTO vHasSectorCollection
FROM sectorCollection
WHERE id = vSectorCollectionFk;
IF !vHasSectorCollection THEN
CALL util.throw ("invalid sectorCollection");
END IF;
REPLACE sectorCollectionSaleGroup
SET sectorCollectionFk = vSectorCollectionFk,
saleGroupFk = vSaleGroupFk;