plsql的参数IN和OUT
代码片段一
create or replace procedure scott.pro_para_inout(p_dname in out scott.dept.dname%TYPE,
p_loc out scott.dept.loc%TYPE) is
begin
dbms_output.put_line(p_dname || ',ING');
dbms_output.put_line(p_loc || ',ING' );
end pro_para_inout;
调用
DECLARE
v_dept scott.dept%ROWTYPE; BEGIN v_dept.dname :='bumon1';
v_dept.loc :='SH'; -- Call the procedure
scott.pro_para_inout(v_dept.dname, v_dept.loc); dbms_output.put_line(v_dept.dname || ',after');
dbms_output.put_line(v_dept.loc || ',after');
end;
结果
bumon1,ING
,ING
bumon1,after
,after
当参数类型是OUT的情况下,原来record(v_dept)中的值也没有了。如果是IN OUT的情况下,原来record的值还保持了原来的样子。
当然根据实际情况使用的时候设置就可以了,但是如果是预想某种情况下就重新设定值,不满足条件就什么也不做,原值不变的话,写成OUT就错了。
关于oracle的参数的值传递,还是引用传递,官方是这么解释的。
Summary of Subprogram Parameter Modes
Table 8-1 summarizes the characteristics of parameter modes.
Table 8-1 Parameter Modes
IN | OUT | IN OUT |
---|---|---|
The default |
Must be specified |
Must be specified |
Passes a value to the subprogram |
Returns a value to the caller |
Passes an initial value to the subprogram and returns an updated value to the caller |
Formal parameter acts like a constant |
Formal parameter acts like an uninitialized variable |
Formal parameter acts like an initialized variable |
Formal parameter cannot be assigned a value |
Formal parameter must be assigned a value |
Formal parameter should be assigned a value |
Actual parameter can be a constant, initialized variable, literal, or expression |
Actual parameter must be a variable |
Actual parameter must be a variable |
Actual parameter is passed by reference (the caller passes the subprogram a pointer to the value) |
Actual parameter is passed by value (the subprogram passes the caller a copy of the value) unless |
Actual parameter is passed by value (the caller passes the subprogram a copy of the value and the subprogram passes the caller a copy of the value) unless |
plsql的参数IN和OUT的更多相关文章
- plsql 带参数的游标
-- 带参数的游标 -- cursor c(no emp.deptno%type) is select * from emp where deptno=no; 参数的起名 不要和表中的列名相同! -- ...
- TT8509: PL/SQL execution terminated; PLSQL_TIMEOUT exceeded
TT8509: PL/SQL execution terminated; PLSQL_TIMEOUT exceeded plsql_timeout连接超时,解决办法: ODBC pl/sql选项卡 修 ...
- Instant Client 配置
Instant Client Download 选择 Instant Client for Microsoft Windows (32-bit) 由于PL/SQL Developer 不支持64b ...
- plsql programming 17 过程, 函数与参数
代码模块化, 即将一大块代码拆成若干小块(过程), 然后就可以在其他模块调用这些模块了, 这样, 重用性更好, 也方便管理. 过程: 过程是一个可以像执行 PL/SQL 语句一样调用的程序, 一个过程 ...
- Oracle plsql存储过程中out模式参数的用法
在plsql中,存储过程中的out模式的参数可以用来返回数据,相当于函数的返回值.下面是一个小例子. 沿用上一篇的emp表结构和数据. 存储过程如下: create or replace proced ...
- PLSQL中的三种参数模式IN、OUT、IN OUT
原文链接:https://www.cnblogs.com/zbj815/p/6854108.html 1.IN模式 IN模式是参数的默认模式,这种模式就是在程序运行的时候已经具有值,在程序体中值不会改 ...
- plsql参数
PL/SQL中对out,in out参数使用的? 默认形参会复制一份实参的副本,然后在内部传递,修改等,发生异常,不会赋值给实参,控制权交还调用环境,而实参值不变,还是调用前的值.而使用了NOCOPY ...
- plsql 储存过程 参数的传递方式?
/* 存储过程 一.oracel存储过程 1.没有返回值 return 值: 2.用输出参数来代替返回值: 3.输出参数可以有多个 二.参数的传递方式 1. 按位置传递 2. 按名字传递 3.混合传递 ...
- 【PLSQL】过程procedure形参和参数
************************************************************************ ****原文:blog.csdn.net/clar ...
随机推荐
- JsTree异步加载数据实现多级菜单
最近在搞一个项目的维护,有一个问题是把原来的树导航变成多级的,原来的那个导航是JsTree的,但我又不熟悉,遂头疼了好久... 终于,他还是出来了,下面就贴上主要代码和思路,因为我在搞这个东西的时候在 ...
- gentoo下grub文件编辑
在编译完内核,配置好网络,配置好fstab文件等等,最后一个至关重要的文件要属grub文件了,该文件的配置成功才最终决定gentoo 是否成功装上,首先当然是 emerge grub 了,现在就可以配 ...
- Android开发中activity切换动画的实现
(1)我们在MainAcitvity中定义两个textview,用于点击触发切换Activity事件,下面是布局文件代码. <LinearLayout android:layout_width= ...
- platform平台设备驱动简化示例代码
driver.c: #include <linux/kernel.h> #include <linux/module.h> #include <linux/init.h& ...
- IOS中如何判断APP是否安装后首次运行或升级后首次运行
对于是否为首次安装的App可以使用如下方法来判断 [[NSUserDefaults standardUserDefaults] boolForKey:@"firstLaunch"] ...
- [转]利用/*+Ordered*/提高查询性能
[转]利用/*+Ordered*/提高查询性能 2009-02-06 10:46:27| 分类: Oracle | 标签: |字号大中小 订阅 消耗在准备利用Oracle执行计划机制提高查询性能 ...
- classes system in sencha touch
//http://www.sencha.com/learn/sencha-class-system var Person = new Ext.Class({ name: 'Mr. Unknown', ...
- pywinauto如何获取gridwindow控件的屏幕位置
一:问题描述 问题一:通过查找pywinauto在线文档,其中没有讲解到gridwindow控件的方法,我不知道这个控件是不是标准控件,还是pywinauto根本就没适配这个控件.从网上查询了好多资料 ...
- Jfinal 入门
Jfinal 入门 IDE----->IDEA 新建项目 新建web项目 添加maven特性 方便导入jar包,不用一个个导入了 配置pom.xml <dependencies> & ...
- 触发UIButton长按事件
UIButton *aBtn=[UIButton buttonWithType:UIButtonTypeCustom]; [aBtn setFrame:CGRectMake(40, 100, 60, ...