代码片段一

 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 NOCOPY is specified

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 NOCOPY is specified

plsql的参数IN和OUT的更多相关文章

  1. plsql 带参数的游标

    -- 带参数的游标 -- cursor c(no emp.deptno%type) is select * from emp where deptno=no; 参数的起名 不要和表中的列名相同! -- ...

  2. TT8509: PL/SQL execution terminated; PLSQL_TIMEOUT exceeded

    TT8509: PL/SQL execution terminated; PLSQL_TIMEOUT exceeded plsql_timeout连接超时,解决办法: ODBC pl/sql选项卡 修 ...

  3. Instant Client 配置

    Instant Client Download 选择  Instant Client for Microsoft Windows (32-bit)  由于PL/SQL Developer 不支持64b ...

  4. plsql programming 17 过程, 函数与参数

    代码模块化, 即将一大块代码拆成若干小块(过程), 然后就可以在其他模块调用这些模块了, 这样, 重用性更好, 也方便管理. 过程: 过程是一个可以像执行 PL/SQL 语句一样调用的程序, 一个过程 ...

  5. Oracle plsql存储过程中out模式参数的用法

    在plsql中,存储过程中的out模式的参数可以用来返回数据,相当于函数的返回值.下面是一个小例子. 沿用上一篇的emp表结构和数据. 存储过程如下: create or replace proced ...

  6. PLSQL中的三种参数模式IN、OUT、IN OUT

    原文链接:https://www.cnblogs.com/zbj815/p/6854108.html 1.IN模式 IN模式是参数的默认模式,这种模式就是在程序运行的时候已经具有值,在程序体中值不会改 ...

  7. plsql参数

    PL/SQL中对out,in out参数使用的? 默认形参会复制一份实参的副本,然后在内部传递,修改等,发生异常,不会赋值给实参,控制权交还调用环境,而实参值不变,还是调用前的值.而使用了NOCOPY ...

  8. plsql 储存过程 参数的传递方式?

    /* 存储过程 一.oracel存储过程 1.没有返回值 return 值: 2.用输出参数来代替返回值: 3.输出参数可以有多个 二.参数的传递方式 1. 按位置传递 2. 按名字传递 3.混合传递 ...

  9. 【PLSQL】过程procedure形参和参数

    ************************************************************************   ****原文:blog.csdn.net/clar ...

随机推荐

  1. PHP中使用cURL

    1.cURL介绍 cURL 是一个利用URL语法规定来传输文件和数据的工具,支持很多协议,如HTTP.FTP.TELNET等.最爽的是,PHP也支持 cURL 库.本文将介绍 cURL 的一些高级特性 ...

  2. wamp——利用phpmyadmin修改数据库密码

    一.wamp版本         我采用的是 WampServer2.2a-x32.exe 这个版本的安装程序. 二.问题描述         安装wamp后,mysql数据库默认密码为空,但是由于某 ...

  3. Delphi新语法和ifthen的扩展联想

    Delphi之前已经重载了好多个ifthen函数 Math单元 ): Integer; overload; inline; ): Int64; overload; inline; ): UInt64; ...

  4. python初准备:安装easy_install和pip

    安装easy_install wget http://peak.telecommunity.com/dist/ez_setup.py python ez_setup.py 安装pip wget htt ...

  5. Sublime Text 3插件之Emmet:HTML/CSS代码快速编写神器

    一.快速编写HTML代码 1.  初始化 HTML文档需要包含一些固定的标签,比如<html>.<head>.<body>等,现在你只需要1秒钟就可以输入这些标签. ...

  6. iOS上绘制自然的签名-b

    这里有一篇很棒的文章写如何在Android上获取流畅的签名:Smoother Signatures:https://corner.squareup.com/2012/07/smoother-signa ...

  7. python @property 属性

    在绑定属性时,如果我们直接把属性暴露出去,显然不合适,是通过getter和setter方法来实现的,还可以定义只读属性,只定义getter方法,不定义setter方法就是一个只读属性: class P ...

  8. 关于新的man版本出现“无法解析 /usr/share/man/zh_CN/man1/ls.1.gz: 没有那个文件或目录“

    今天学习了下man,有关详细资料参考:http://www.cnblogs.com/hnrainll/archive/2011/09/06/2168604.html toor@door:/usr/sh ...

  9. PHP漏洞全解(三)-客户端脚本植入

    本文主要介绍针对PHP网站的客户端脚本植入攻击方式.所谓客户端脚本植入攻击,是指将可以执行的脚本插入到表单.图片.动画或超链接文字等对象内.当用户打开这些对象后,黑客所植入的脚本就会被执行,进而开始攻 ...

  10. hdu 4778

    知道是状态压缩,但是不会做: 看题解学的: dp[i]表示现在状态是i,先手-后手的分数. #include<cstdio> #include<cstring> #includ ...