I'm using CodeIgniter framework and MySQL database. I want to pass 2 variables to the stored procedure and get the calculation done. The following is my stored procedure.
CREATE DEFINER=`root`@`localhost` PROCEDURE `SPNoOfCams`(IN cams_for_pack int(25), IN pack_id int(20),
OUT available_cams INT)
BEGIN
SELECT p.no_of_cameras - cams_for_pack
INTO available_cams
FROM package p
WHERE p.id = pack_id;
END
I call this stored procedure by the following function in CodeIgniter.
$query = $this->db->query("call SPNoOfCams()");
return $query->result();
I get the following error.
Error Number: 1318
Incorrect number of arguments for PROCEDURE mydb.SPNoOfCams; expected 3, got 0
call SPNoOfCams()
Filename: F:\wamp\www\eventmanagementsystem\system\database\DB_driver.php
Line Number: 331