Last answered:

24 Mar 2023

Posted on:

10 Jul 2022

1

When calling the procedure, it asks for both IN and OUT parameters

I ran the following query, and everyhing was ok, but when I call the procedure, it asks for both IN and OUT parameter as shown in the screenshot. I just need to enter the IN parameter and it returns the average, but I wonder why and how this has happened?

DELIMITER $$
CREATE PROCEDURE avg_salary_out (IN p_emp_no INT, OUT p_avg_salary DECIMAL(10,2))
BEGIN
SELECT
AVG(s.salary)
INTO p_avg_salary
FROM employees e
JOIN salaries s ON e.emp_no = s.emp_no
WHERE
e.emp_no = p_emp_no;
END$$

3 answers ( 0 marked as helpful)
Instructor
Posted on:

14 Jul 2022

2

Hi Saeed!
Thanks for reaching out.
This is because you typed the keywords IN and OUT with capital letters. This is a well-known bug from the Workbench. Please, use these keywords with small letters. This will resolve the issue.

Hope this helps.
Best,
Tsvetelin

Posted on:

17 Jul 2022

0

Thank you Tsvetelin!
Another issue is that when I try to call the procedure using a query, it is successful and shows the green checkmark but doesn't return the average value as it does when calling the procedure using the lightening sign. Could you please share how we can call it using a query?

Posted on:

24 Mar 2023

0

no way capital letters make a difference here 😂

Submit an answer