MySQL Forums
Forum List  »  Newbie

Select into Varirable in Stored Procedure in mysql
Posted by: Rahul Chaudhari
Date: June 24, 2005 03:26AM

Hi All
the following procedure is returns Null value why ???
select into variable is not working in mysql ????

delimiter $$

drop procedure if exists test_proc$$
create procedure test_proc
(
o_Value integer
)
Begin
declare v_string varchar(100);
declare v_Cnt integer;
declare v_outpara varchar(20);

set v_string = concat('select count(*) into ',v_Cnt,' from employee where department_id = ''10'');

if v_cnt = 0 then
' Do Some thing here
else
' Do Some thing here
end if;

set v_outparam = v_cnt;

END$$

delimiter ;

my Question is in above procedure the v_cnt is giving null value why as there are 10 records in the employee table so why Null in v_cnt variable.

is there other way to do !!

Please help me ..............

Regards
Rahul Chaudhari

Options: ReplyQuote


Subject
Written By
Posted
Select into Varirable in Stored Procedure in mysql
June 24, 2005 03:26AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.