日期:2014-05-16 浏览次数:20772 次
create procedure proc_name(in parameter integer) BEGIN declare variable varchar(20); if parameter=1 THEN set variable='mysql'; ELSE set variable='java'; end if; insert into tb(name) values (variable); end 测试语句: call proc_name(3);
create procedure abin(in parameter int) BEGIN if parameter=1 THEN select * from tb order by id asc; ELSE select * from test order by id asc; end if; end; 测试语句: call abin(2);
create procedure abin_1(in parameter int) BEGIN declare variable varchar(20); if parameter=1 THEN set variable='windows'; ELSE set variable='linux'; end if; select parameter; end; 测试语句: call abin_1(1); call abin_1(2);
create procedure bing() BEGIN DECLARE temp int; set temp='java'; update tb set name='abin' where id=1; end;