I am trying to make a stored procedure in phpmyadmin. I do this in PHP MyAdmin for instance
UPDATE financeplusacct SET bal = bal - 5000 WHERE accNum = 00343297587;
UPDATE financeplusacct SET bal = bal + 5000 WHERE accNum = 00343995977
It posts fine without worries then i try to make it a stored procedure so my Javascript REST api can call it without hassle, Looks like this
UPDATE financeplusacct SET bal = bal - amount WHERE accNum = accNum1;
UPDATE financeplusacct SET bal = bal + amount WHERE accNum = accNum2;
And i am getting this as an Error
One or more errors have occurred while processing your request:
The following query has failed: "CREATE DEFINER=`root`@`localhost` PROCEDURE `ExecDebitCredit`(IN `accNum1` VARCHAR(150), IN `accNum2` VARCHAR(150), IN `amount` DECIMAL(18,2)) NOT DETERMINISTIC CONTAINS SQL SQL SECURITY DEFINER UPDATE financeplusacct SET bal = bal - amount WHERE accNum = accNum1; UPDATE financeplusacct SET bal = bal + amount WHERE accNum = accNum2;"
MySQL said: #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'UPDATE financeplusacct SET bal = bal + amount WHERE accNum = accNum2' at line 2
Please is there something i am not getting rightly?