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

14 lines
305 B
SQL

DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `vn`.`ledger_next`(
IN vFiscalYear INT,
OUT vNewBookEntry INT
)
BEGIN
UPDATE ledgerCompany
SET bookEntry = LAST_INSERT_ID(bookEntry + 1)
WHERE fiscalYear = vFiscalYear;
SET vNewBookEntry = LAST_INSERT_ID();
END$$
DELIMITER ;