我必须在mysql存储过程中传递两个数组参数和两个整数参数,而我完全没有意识到如何做到这一点的想法。所以我需要你的帮助。 我的java函数和performure看起来像这样:
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 proceedure
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());
只有更新命令必须根据大小执行。