Oracle Database :玩转Oracle学习笔记之(14):PLSQL函数包
来源:互联网 发布:短网址网站源码 编辑:程序博客网 时间:2024/06/10 12:51
过程:
用于执行特定的操作,既可以指定输入参数(in) , 也可以指定输出参数(out)。通过在过程中输入参数,可以将数据传递到执行部分;通过使用输出参数,可以将过程执行部分的数据传递到应用环境;在qplsql中可以使用create procedure 命令来创建过程;
①、案例一:
SQL> create procedure sp_pro3(spName varchar2 , newSal number) is 2 begin 3 --execute part,根据用户名曲修改工资; 4 update emp set sal=newSal where ename=spName; 5 end; 6 /Procedure created.SQL> exec sp_pro3('SCOTT',4678);PL/SQL procedure successfully completed.SQL> call sp_pro3('SCOTT',3000);Call completed.
注意:在(spName varchar2 , newSal number)里面的varchar2和number不必写成varchar2(5) ,number(7,2),这里只是知名形参的类型即可;
Ⅰ、如何在Java中调用存储过程;
public static void main(String[] args) {try { //加载驱动;Class.forName("oracle.jdbc.driver.OracleDriver"); //得到连接 ; Connection connection =DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:orcl" ,"scott","Spongcer123"); //创建一个CallableStaement; CallableStatement callableStatement = connection.prepareCall("{call sp_pro3(?,?)}"); //给问好赋值; callableStatement.setString(1,"SMITH"); callableStatement.setInt(2, 800); //执行: callableStatement.execute(); callableStatement.close(); connection.close(); } catch (Exception e) { // TODO: handle exception e.printStackTrace(); } }
- Oracle Database :玩转Oracle学习笔记之(14):PLSQL函数包
- Oracle Database :玩转Oracle学习笔记之(13):PLSQL函数包
- Oracle Database :玩转Oracle学习笔记之(15):PLSQL函数包
- Oracle Database :玩转Oracle学习笔记之(11):PlSQL块
- Oracle Database :玩转Oracle学习笔记之(12):PLSQL控制结构
- Oracle Database :玩转Oracle学习笔记之(16):PLSQL触发器
- Oracle Database :玩转Oracle学习笔记之(17):PLSQL编写分页过程
- Oracle Database :玩转Oracle学习笔记之(27):Oracle函数
- Oracle Database :玩转Oracle学习笔记之(2):在Oracle中操纵数据
- Oracle Database :玩转Oracle学习笔记之(20):Oracle远程连接以及连接命令
- Oracle Database :玩转Oracle学习笔记之(21):Oracle用户和用户管理
- Oracle Database :玩转Oracle学习笔记之(22):Oracle选择
- Oracle Database :玩转Oracle学习笔记之(23):Oracle数据库管理--导入及导出
- Oracle Database :玩转Oracle学习笔记之(24):Oracle视图
- Oracle Database :玩转Oracle学习笔记之(25):Oracle事务
- Oracle Database :玩转Oracle学习笔记之(26):Oracle命令
- Oracle Database :玩转Oracle学习笔记之(28):Oracle表空间和数据文件
- Oracle Database :玩转Oracle学习笔记之(29):Oracle表管理
- 存贷款基准利率
- 使用UIActivityIndicatorView
- 修改了kernel之后,每次重启后,就会出现kernel文件被破坏的情况
- 螺旋矩阵
- Qt C++ decorate模式
- Oracle Database :玩转Oracle学习笔记之(14):PLSQL函数包
- hdoj_1428漫步校园
- 如何把 opengrok 安装在 windows上
- Oracle中TO_DATE格式的使用小结
- 卸载虚拟机virtualbox中的ubuntu系统
- Oracle Database :玩转Oracle学习笔记之(15):PLSQL函数包
- 深入浅出JSONP--解决ajax跨域问题
- 关于工作效率
- ActionBarSherlock自定义