stored procedure with parameters mysql
-- Stored Procedure with parameters with default
DELIMITER $$
CREATE PROCEDURE get_clients_by_state
(
state CHAR(2)
)
BEGIN
IF state IS NULL THEN
SET state = 'CA';
END IF;
SELECT
*
FROM
clients c
WHERE c.state = state;
END $$
DELIMITER ;
-- Once you save the stored procedure, you can invoke it by using the CALL statement:
CALL get_client_by_state(NULL);