CodeIgniter Forums
mySQL Stored Procedure "does not exist" - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Development (https://forum.codeigniter.com/forumdisplay.php?fid=6)
+--- Forum: CodeIgniter 3.x (https://forum.codeigniter.com/forumdisplay.php?fid=17)
+--- Thread: mySQL Stored Procedure "does not exist" (/showthread.php?tid=78074)



mySQL Stored Procedure "does not exist" - alQemist - 11-26-2020

CI v 3.1.10

I am trying to call a Stored Procedure without much success. I am getting an error message 

I have no problem calling the procedure from the mysql console in PHPStorm.

My code and the error

$stmt = "CALL spinup()";
$res = $db->query($stmt);
print_r( $db->errorInfo()); 
// Array ( [0] => 42000 [1] => 1305 [2] => PROCEDURE archives.spinup does not exist )

The procedure is created like so....

DELIMITER ;
DROP PROCEDURE IF EXISTS archives.spinup;
DELIMITER //

CREATE
    definer = admin@`%` PROCEDURE `archives`.`spinup`()
BEGIN


-- creating tables here....

SELECT "DONE";
END//
DELIMITER


I have searched high and low and can find no answer as to why the procedure is not being "found" since it absolute does exist.


RE: mySQL Stored Procedure "does not exist" - InsiteFX - 11-26-2020

Read this:

3 Easy Steps To Call Stored Procedure In Codeigniter


RE: mySQL Stored Procedure "does not exist" - ojmichael - 11-26-2020

PHP Code:
USE `archives`;
DROP procedure IF EXISTS `spinup`;

DELIMITER $$
USE `
archives`$$
CREATE PROCEDURE `spinup` ()
BEGIN

-- creating tables here....

SELECT "DONE";
END$$

DELIMITER 



RE: mySQL Stored Procedure "does not exist" - alQemist - 11-27-2020

thanks ojmichael - tried this code and made no difference....this getting Procedure Does not exist error


RE: mySQL Stored Procedure "does not exist" - alQemist - 11-27-2020

(11-26-2020, 02:10 PM)InsiteFX Wrote: Read this:

3 Easy Steps To Call Stored Procedure In Codeigniter
Good information

When is use this method

$stmt = "CALL spinup()";
$data = $this->db->query($stmt);
$result = $data->result();

I get this error

Call to a member function result() on boolean


RE: mySQL Stored Procedure "does not exist" - alQemist - 11-27-2020

Thanks for all the replies - problem was discovered by my colleague who is the CI admin. Turns out the PDO connection was pointing to a different instance of our RDS on AWS. Once I switch the target RDS it worked like a charm !


RE: mySQL Stored Procedure "does not exist" - InsiteFX - 11-27-2020

Both MySQL and MariaDB are showing the same error when the table doe's not exist.

Read:

MySQL DROP PROCEDURE