2011-01-22 16 views
1

MySQLでエラーが発生していて、私を狂わせてしまい、何が問題なのか分かりません。あなたがコード内で見ることができるよう、今MySQLの引数の数が正しくない関数のエラー

;「 1を得た、2を期待される機能のccms.fnGetProfileAlbumsPhotoCountの引数の数が正しくありません」:

CALL ProfileUpdateProgress(107) 

MySQLはエラーを返します:私は、次の呼び出しを行いますfnGetProfileAlbumsPhotoCount(_profileId、profileUserId)

これは2つの引数ではないのですか?なぜそれは誤りですか? 私は怒っているよ!

データベースのprocs:

DELIMITER $$ 

DROP PROCEDURE IF EXISTS `ProfileUpdateProgress` $$ 
CREATE DEFINER=`root`@`%` PROCEDURE `ProfileUpdateProgress`(
     IN _profileId integer 
    ) 
BEGIN 

    SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; 

    CALL ProfileUpdateProfileProgress(_profileId); 

END $$ 

DELIMITER ; 

順番に呼び出します。

DELIMITER $$ 

DROP PROCEDURE IF EXISTS `ProfileUpdateProfileProgress` $$ 
CREATE DEFINER=`root`@`%` PROCEDURE `ProfileUpdateProfileProgress`(IN _profileId int) 
BEGIN 

    -- Declarations here 

    SELECT profileEyes, profileSex, profileHair, profileBustBand, profileBustCup, profileBirthCountry, profileProfession , profileAbout, 
      profileBiography, fnGetProfilePhoto(_profileId, null) AS profilePhoto, fnGetProfileAlbumsPhotoCount(_profileId, profileUserId) AS albumPhotoCount, 
      userAllowMultipleProfiles, profileIsPrimary, fnUserGetChildrenProfileCount(userId) AS ownerProfileCount 
    INTO _profileEyes, _profileSex, _profileHair, _profileBustBand, _profileBustCup, _profileBirthCountry, _profileProfession, 
      _profileAbout, _profileBiography, _profilePhoto, _albumPhotoCount, _userAllowMultipleProfiles, _profileIsPrimary, 
      _ownerProfileCount 
    FROM profile 
    INNER JOIN user 
     ON profileUserId = userId 
    WHERE profileId = _profileId; 


    -- Other irrelevant code here 


END $$ 

DELIMITER ; 

などのエラーが見えることと呼ばれる関数:ああは最終的にそれを解決し

DELIMITER $$ 

DROP FUNCTION IF EXISTS `fnGetProfileAlbumsPhotoCount` $$ 
CREATE DEFINER=`root`@`%` FUNCTION `fnGetProfileAlbumsPhotoCount`(
    _profileId int, 
    _userId int 
) RETURNS int(11) 
BEGIN 

    DECLARE outProfileAlbumsPhotoCount int DEFAULT 0; 

    -- Irrelvant Code 

    RETURN outProfileAlbumsPhotoCount; 

END $$ 

DELIMITER ; 
+0

MySQLクライアントから直接 'fnGetProfileAlbumsPhotoCount'を呼び出せますか? – gregjor

+0

ええ、gregjor、うまく動作します。非常に奇妙な。 – Cheeky

答えて

1

を。 select列のfnUserGetChildrenProfileCountと呼ばれる別の関数も、fnGetProfileAlbumsPhotoCount()関数を呼び出してTHAT呼び出しが1つの引数しか持たない、つまり2番目の引数を欠いているという犯人でした。

関連する問題