stored procedure .. how to pass variable.?

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
fird01
Forum Newbie
Posts: 19
Joined: Mon Apr 07, 2008 11:04 pm

stored procedure .. how to pass variable.?

Post by fird01 »

Code: Select all

delimiter |
create procedure totalmonth(btnid int, mnth int)
begin
    select count(click) as total from eachclick where date like "%-mnth-%" and btn=btnid;
end
|
delimiter;
my table would look like this

eachclick
+--+---+----+--------------+
|bil |btn|click|date |
+--+----+----+--------------+
|1 | 2 | 1 | 2008-05-01 |
+--+---+----+--------------+
so i create a stored procedure in my database... the thing is.. how do i pass mnth value to the query in procedure...

when i use
call totalmonth(2,05);

result will return column total with 0 value...

so how does i make this functioning..
Post Reply