我必须在 mysql 存储过程中传递两个数组参数和两个整数参数,我完全不知道如何去做。所以我需要你的帮助。我的 java 函数和过程如下所示:
int[] amounts={1000,2000,300,10}
int[] fee={1,2,3,4}
java.sql.CallableStatement cs = conn.prepareCall("{ call P_submitAdmissionFee(?,?,?)}");
cs.setInt(1, amounts);
cs.setInt(2, fee);
cs.setInt(3, Integer.parseInt(did));
cs.execute();
mysql程序
CREATE DEFINER=`kgt`@`%` PROCEDURE `P_submitAdmissionFee`(
IN amount int(15),
IN fee int,
IN userid int,
Out msg int
)
BEGIN
select Session_ID,Registration_ID into @result,@rid from std_entry_master where Student_ID=sid;
select Fee_Cycle into @fc from school_profile_master;
/*Update sims_accounts.student_feecycledetail set Status='Y',Modified_Date=now(),Modified_By=userid
where Reg_ID=@rid AND Expected_Month_Year <= now();
Update registration_student set Admitted='Y' where Registration_ID=@rid;*/
Insert into student_fee_master(Student_ID,Total_Amount,Fee_For,Created_By,
Created_Date) values(@rid,@total,'A',userid,now());
只有更新命令必须根据那里的大小执行。