SQL> create or replace procedure sp_pro5(id_in varchar2) is
2 v_sal mytest.salary%type;
3 begin
4 select salary into v_sal from mytest where id=id_in;
5 if v_sal<130 then
6 update mytest set salary=1.1*v_sal where id=id_in;
7 end if;
8 end;
9 / Procedure created SQL> exec sp_pro5(4); PL/SQL procedure successfully completed SQL> select * from mytest; ID NAME PASSWD SALARY
----- -------------------- -------------------- --------------------------------------------------------------------------------
1 123 123 150
2 gaodingle!!!! 123 150
3 gagaga 123 150
4 125555 passwd 55

SQL> create or replace procedure sp_pro6(id_in varchar2) is
2 v_bonus number(6,2);
3 begin
4 select bonus into v_bonus from mytest where id=id_in;
5 if v_bonus=0 then
6 update mytest set bonus=100 where id=id_in;
7 else
8 update mytest set bonus=v_bonus+300 where id=id_in;
9 end if;
10 end;
11 / Procedure created SQL> select * from mytest; ID NAME PASSWD SALARY BONUS
----- -------------------- -------------------- -------- --------
1 123 123 120.00 0.00
2 gaodingle!!!! 123 120.00 0.00
3 gagaga 123 120.00 100.00
4 125555 passwd 120.00 100.00 SQL> exec sp_pro6(1); PL/SQL procedure successfully completed SQL> select * from mytest; ID NAME PASSWD SALARY BONUS
----- -------------------- -------------------- -------- --------
1 123 123 120.00 100.00
2 gaodingle!!!! 123 120.00 0.00
3 gagaga 123 120.00 100.00
4 125555 passwd 120.00 100.00

SQL> create or replace procedure sp_pro7 is
2 i number:=0;
3 begin
4 loop
5 insert into users values(i,'test'||i);
6 exit when i=3;
7 i:=i+1;
8 end loop;
9 end;
10 / Procedure created

最新文章

  1. Quartz
  2. xml 的 CDATA
  3. Chapter 4: Troubleshoot and debug web applications
  4. jeesite 一对多,对子表单独修改时出现 HV000030: No validator could be found for type:
  5. golang-mongodb范例
  6. Day5 双层装饰器、字符串格式化、生成器、迭代器、递归
  7. 西装定制平台Indochino获$1350万B轮融资 - 国际B2C - 亿邦动力网
  8. Swift 控制流
  9. mysql的内建日期处理函数
  10. sql读取 所有表、结构 描述
  11. GIT教程的好文章
  12. os.date
  13. python之string模块常量:数字,26个字母,标点符号,空白
  14. Floodlight1.2+Mininet的安装及使用
  15. Go的CSP并发模型实现:M, P, G
  16. mysql安装登录
  17. include
  18. Linux 各种软件的安装-mysql篇
  19. GDI+编程小结
  20. find -exec 与xargs 区别

热门文章

  1. k8s入门
  2. windows静态库的使用
  3. javaEE面试重点
  4. Alpha matting算法发展
  5. Eclipse设置护眼背景
  6. JavaScript------分页插件下载地址
  7. java关于Timer schedule执行定时任务 !!!!!!!!!
  8. JZOJ.5235【NOIP2017模拟8.7】好的排列
  9. oracle用于判断时间条件为当天的写法(当前日期加一天)
  10. 火狐 a 标签 download 属性,要在 a 标签添加到页面中才生效;