DROP PROCEDURE `SP_FinList_Serial`//
CREATE DEFINER=`root`@`localhost` PROCEDURE `SP_FinList_Serial`(
IN _Period Int(11),
IN _UnitCode VarChar(12),
IN _NumberFrom Int(11),
IN _NumberTo Int(11),
OUT _ListId Int(11)
)
BEGIN
SELECT Id
FROM AccList
WHERE Period = _Period
AND AccList.UnitCode = _UnitCode
AND (_NumberFrom IS NULL OR AccList.Number >= _NumberFrom)
AND (_NumberTo IS NULL OR AccList.Number <= _NumberTo);
END
CREATE PROCEDURE Sp_FinList_Vch01(
_Period Int,
_UnitCode Int,
_NumberFrom Int,
_NumberTo Int
)
BEGIN
DECLARE _Serial, _ListId int(11);
CALL SP_FinList_Serial(_Period,_UnitCode,_NumberFrom,_NumberTo, @ListId) ;
SELECT *
, (SELECT SUM(Debtor) Debit
FROM AccListAdd
WHERE ParentId IN (SELECT @ListId)
AND Debtor > 0
AND LEFT(AccListAdd.Account,fx_Level()) = fx_KolCode(P.AccountCode)
GROUP BY Left(Account, fx_Level())) DebitKol
FROM
(SELECT *
FROM AccList LEFT JOIN AccListAdd ON AccList.Id = AccListAdd.ParentId
LEFT JOIN AccAccount AccAccount03 ON AccListAdd.Account = AccAccount03.Code
LEFT JOIN AccAccount AccAccount02 ON AccAccount02.Code = AccAccount03.Parent
WHERE AccList.Period = _Period
AND AccList.UnitCode = _UnitCode
AND (_NumberFrom IS NULL OR AccList.Number >= _NumberFrom)
AND (_NumberTo IS NULL OR AccList.Number <= _NumberTo))P;
END
当我在我的选择中写入SP_FINLIST_Serial
时,我有一个错误,当我把它写下来并在我的where子句之后,我的字段返回NULL值
我应该如何在其他程序中编写和调用程序