Let's create a stored procedure in our database and run it from Railo Server.
In our MySQL console, let's run the following command to create a stored procedure called employeebyid:
DELIMITER // CREATE PROCEDURE employeebyid(IN empid int(11)) BEGIN SELECT * FROM employee WHERE id = empid; END // DELIMITER ;
We get a response from MySQL as follows:
mysql> DELIMITER //
mysql> CREATE PROCEDURE employeebyid(IN empid int(11))
-> BEGIN
-> SELECT *
-> FROM employee
-> WHERE id = empid;
-> END //
Query OK, 0 rows affected (0.00 sec)
mysql> DELIMITER ;
mysql>
Now, we can test a call to it by running the following code:
mysql> CALL employeebyid(1);
+----+-----------+-------------+--------------------+
| id | FirstName | LastName | email |
+----+-----------+-------------+--------------------+
| 1 | Test | TestSurname | [email protected] |
+----+-----------+-------------+--------------------+
1 row in set (0.00 sec)
Query OK,...