0

i have to pass two array parameter and two integer parameter in mysql stored procedure and iam totaly unaware of the idea that how to do it. So i need your help. my java function and proceedure look like this:

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());

only update command must be execute according to there size.

Subodh Bisht
  • 859
  • 7
  • 19
  • 33

0 Answers0