CREATE PROCEDURE dbo.SP_GUILD_CHAR_CREATE
@i_guild_code VARCHAR(10) , --길드코드
@i_character_name VARCHAR(40) , --캐릭터명
@i_peerage_code VARBINARY(1) , --작위코드
@o_sp_rtn INT OUTPUT , --실행결과
@2mx_user_no varchar(50)
AS
DECLARE
@v_max_char_cnt int, --한길드당 최대 길드원 수
@v_row_cnt int
BEGIN
SET NOCOUNT ON
SET @o_sp_rtn = -1
SET @v_max_char_cnt = 50
--입력값 검증
IF @i_guild_code IS NULL OR
@i_character_name IS NULL OR
@i_peerage_code IS NULL BEGIN
SET NOCOUNT OFF
SET @o_sp_rtn = -1
RETURN
END
--길드중복가입 검사.
IF EXISTS( SELECT 1
FROM dbo.GUILD_CHAR_INFO WITH(NOLOCK)
WHERE character_name = @i_character_name )
BEGIN
SET NOCOUNT OFF
SET @o_sp_rtn = -2
RETURN
END
--한길드당 최대 길드원 수 검증
SELECT @v_row_cnt = count(*)
FROM dbo.GUILD_CHAR_INFO WITH(NOLOCK)
WHERE guild_code = @i_guild_code
IF @@Error <> 0 BEGIN
SET NOCOUNT OFF
SET @o_sp_rtn = -3
RETURN
END
IF @v_max_char_cnt <= @v_row_cnt BEGIN
SET NOCOUNT OFF
SET @o_sp_rtn = -4
RETURN
END
--길드원 등록
SET @2mx_user_no = (SELECT user_no FROM user_character
WHERE character_name = @i_character_name)
BEGIN TRAN
INSERT INTO dbo.GUILD_CHAR_INFO
(
guild_code ,
character_name ,
peerage_code ,
ipt_time ,
upt_time ,
user_no
)
VALUES(
@i_guild_code ,
@2mx_user_no ,
@i_character_name ,
ISNULL(CAST(@i_peerage_code AS smallint), 9) ,
getdate() ,
getdate()
)
IF @@Error <> 0
BEGIN
ROLLBACK TRAN
SET NOCOUNT OFF
SET @o_sp_rtn = -9
RETURN
END
COMMIT TRAN
SET NOCOUNT OFF
SET @o_sp_rtn = 0
END
GO
存储过程中的错误:
SQL 存储过程需要未提供的参数。
我收到了这个错误,我真的不明白它出了什么问题。请尽量详细。
我不知道没有提供哪个参数,我应该如何修复它