编写一个简单的oracle存储过程(条件语句)程案例!(初学者)

3581阅读 0评论2012-12-29 古丁高手
分类:Oracle

create or replace procedure sp_pro6(spname char) is --创建一个过程附带一个输入形参
v_price goods.unitprice%type;--变量类型
begin--执行部分
select unitprice into v_price from goods where goodsname=spname;
if v_price<5 then--条件语句
update goods set unitprice=unitprice*1.1 where goodsname=spname;
end if;
end;
 
exec sp_pro6('pen');--执行存储过程出入参数
 
 
上一篇:除了钱,其他都不是!
下一篇:pl/sql 条件语句多重用法!