0

I want to return a output parameter from a store procedure. I have written below query,but the output param is giving blank value

CREATE DEFINER=`root`@`%` PROCEDURE `GetVendorSpecificReport`(
  startdate DATE,
  enddate DATE,
   vendorname  varchar(50),
out vendoremail varchar(50)
)
BEGIN

SELECT email into vendoremail from user where FirstName=@vendorname;

select distinct concat(u.Firstname, ' ', u.Lastname) as Name, 
u.FirstName,  t.subtask, u.NTName, from user U, task t, groupuser g, `group` g1
where  U.idUser= t.userid and g.userid= U.idUser
and g1.name=vendorname and date >= startdate and date <= enddate
order by  date,u.FirstName asc;

END $$

DELIMITER ;

Can anyone help me on this ?

sandeep.mishra
  • 825
  • 4
  • 19
  • 40

1 Answers1

-1

You should replace '@vendorname' with 'vendorname' in your code. You can try to simplify the code or to create another very simple test SP to check.

Here is the simple SP that works fine in my system:

DELIMITER $$
CREATE PROCEDURE `z`(
    IN `a` INT,
    OUT `b` INT
)
BEGIN
    SELECT a + 1 into b;
END;
$$

DELIMITER ;

CALL z(1, @x);
SELECT @x;
fifonik
  • 1,556
  • 1
  • 10
  • 18