//存储过程
例子1
delimiter $$
drop proedure if exists helloword$$
create procedure helloword()
begin
select "hello word";
end$$
delimiter;
例子2
delimiter $$
drop procedure if exists my_sqrt$$
create procedure my_sqrt(input_number int)
begin
declare l_sqrt float;
set l_sqrt=SQRT(input_number);
select l_sqrt;
end$$
//存储函数
delimiter $$
drop function if exists f_discount_price$$
create function f_discount_price
(normal_price numeric(8,2))
RETURNS numeric(8,2)
DETERMINISTIC
begin
declare discount_price numeric(8,2);
if(normal_price>500)then
set discount_price=normal_price*.8;
elseif(normal_price>300)then
set discount_price=normal_price*.9;
else
set discount_price=normal_price;
end if;
return (discount_price);
end$$