Getting the out parameter from my stored procedure

169 views Asked by At

Hello I have a stored procedure where the parameters look like this:

CREATE PROCEDURE getModels
(
    in :division char(2),
    in :startdate date,
    in :enddate date,
    out :QualifyingModels int
);
...

I simply want to test what the out value would be. When I create a new SQL document it doesn't seem to want to let me call the Stored Procedure or declare variables to store the value. Is there a simple way I can do this?

Thanks

1

There are 1 answers

2
mirtheil On BEST ANSWER

Write another procedure that calls the first one and prints the out parameter. Something like (untested):

CREATE PROCEDURE TestOutParam () 
BEGIN
DECLARE :division char(2);
DECLARE :startdate date;
DECLARE :enddate date;
DECLARE :QualifyingModels int;

SET :division ='AA';
SET :startdate = '2013-12-01';
set :enddate = '2013-12-04';

EXEC getModels (:division, :startdate date, :enddate date, :QualifyingModels);

PRINT :QualifyingModels;

END;