http://www.jbxue.com/db/11545.html
http://bbs.csdn.net/topics/300105063
http://blog.csdn.net/panpanxj/article/details/2729791
</pre><pre name="code" class="sql">delimiter //;
create procedure test_while(in x int)
begin
declare count int default 0;
while count<x do
count = count +1;
end while;
select count;
end
//
创建一个test_while的procedure,进行while do 测试。
delimiter ;
call test_while(10);
drop procedure test_while;
带返回的function
delimiter //
create function mfunction(quality int(10)) returns int(10)
begin
while quality mod 12 > 0 do
set quality = quality +1;
end while;
return quality;
end
//
调用和删除function
call mfucntion(14); //
drop function mfunction; //
mysql - Assignment
1. declare name type_name default somevalue
2. set @i = somevalue
3. select SystemTypeId into iSystemTypeId from B_SystemType where os = Aos;
4. set lockTime=(select lockTime from ccmUsers where name=myuser);
5. select @mysum:=COUNT(*) from mendpinfo where ipaddr = rvIpaddr;