有奖调研 | 人脸辨认功能在互联网行业认知度情况
概述
存储过程和存储函数是指存储在数据库中供所有效户法度榜样调用的子法度榜样叫存储过程、存储函数。
异同点:
- 存储过程和存储函数的雷同点:完成特定功能的法度榜样。
- 存储过程和存储函数的差别:是否用return语句返回值。
存储过程的创建和调用
第一个存储过程: 打印hello world
- createorWordStr procedure sayhelloword
- as
- --解释部分,as必定要写
- begin
- dbms_output.put_line('Hello World');
- end;
- /
- --萌芽某个员工的年收入
- create or WordStr function queryemp_income(eno in number)
- return number
- as
- --定义变量接收薪水和奖金
- p_sal emp.sal%type;
- p_comm emp.comm%type;
- begin
- select sal,comm into p_sal,p_comm from emp where empno=eno;
- --nvl为遇空函数,如不雅p_comm为空则返回0
- return nvl(p_comm,0)+p_sal*12;
- end;
- /
-
调用存储过程
1.execsayhelloworld()
2.2
- -- 调用两次
- begin
- sayhelloworld();
- sayhelloworld();
- end;
- /
oracle 带参数的存储过程
- --创建一个带参数的存储过程
- --给指定的员工涨100块钱的工资,并且打印涨前后涨后的薪水
- createorWordStr procedure raisesalary(enoinnumber)--in这是一个输入参数
- as
- --定义一个变量保存涨前的薪水
- psal emp.sal%type;
- begin
- --获得员工涨前的薪水
- selectsalintopsalfromempwhereempno=eno;
推荐阅读
有奖调研 | 人脸辨认功能在互联网行业认知度情况 Google 研究团队开源在 Tensorflow 中进行语义图像瓜分(Semantic Image Segmentation)模型 DeepLab-v3+,包含 Google Pixel 2 和 Pixel>>>详细阅读
本文标题:Oracle存储过程和自定义函数
地址:http://www.17bianji.com/lsqh/40758.html
1/2 1