Last answered:

25 Mar 2024

Posted on:

01 Dec 2023

0

Resolved: Getting Null as the result from all stored procedure queries including the assignment too.

6 answers ( 1 marked as helpful)
Instructor
Posted on:

01 Dec 2023

0

Hi Maimuna!
Thanks for reaching out.


You used e.first_name=p_last_name instead of e.last_name=p_last_name. Correcting this will give you the correct result set.


Hope this helps.
Best,
Tsvetelin

Posted on:

01 Dec 2023

0

Posted on:

01 Dec 2023

0

Yes, I corrected that but still, I am getting OK as the result not only from this query but also for the queries related to stored procedures and functions. Is there any specific reason behind this? 

Instructor
Posted on:

06 Dec 2023

0

Hi Maimuna!
Thanks for reaching out!


Could you please support your question with the entire code of the f_emp_info() stored procedure? This can help us assist you better. Thank you.


Looking forward to your answer.
Best,
Tsvetelin

Super learner
This user is a Super Learner. To become a Super Learner, you need to reach Level 8.
Posted on:

25 Mar 2024

0

I also have exactly the same issue, and this is my entire code snippet. Cause no solution is literally placed in this conversation sir:


set @v_emp_no = 0;

drop procedure if exists ret_emp_no;

DELIMITER $$
create procedure ret_emp_no(in f_name varchar(40), in l_name varchar(40), out v_emp_no int)
begin
select emp_no from employees
where first_name = f_name and last_name = l_name;
end $$

delimiter ;

call employees.ret_emp_no('Aruna', 'Journel', @v_emp_no);

select @v_emp_no;

Super learner
This user is a Super Learner. To become a Super Learner, you need to reach Level 8.
Posted on:

25 Mar 2024

0

I think I have gotten where the error comes from, @Maimuna. 
We need to use the SELECT INTO structure in our procedure if its going to store an output in a parameter that will eventually be stored in a variable.
Thanks.

Submit an answer