代码片段一

 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. iOS之多线程浅谈

    1)并发和并行的区别 在软件开发中不可避免的会遇到多线程的问题,在iOS客户端开发(或者.NET的winform或者wpf这样的cs程序)中就更不可避免的会用到多线程,在bs类型的web项目中要考虑一 ...

  2. 创建一个.bat文件,用于打开某个路径下的文件

  3. 【GPS】 数据围栏

    1.记录gps信息,定位类型  gps  agps ,偏移量 2.根据id检索用户 gps 历史记录 3.创建围栏 4.围栏内用户检索(先实现 圆形和矩形) 5.判断一个点是否进出围栏 应用场景: o ...

  4. Automotive Security的一些资料和心得(3):Vehicular Security技术

    1. Overview 1.1. Secure Hardware Extension (SHE) 基本结构:ECU里面有一块单独的Secure Zone.Secure Zone里面是SHE模块.SHE ...

  5. BZOJ 4029 [HEOI 4029] 定价 解题报告

    这个题好像也是贪心的感觉.. 我们枚举 $1,5,10,50,100,\dots$ ,找出在 $[l, r]$ 内能整除它们的最小的数. 然后找到其中在荒谬值最小的情况下数值最小的那个数, 就做完了. ...

  6. MySQL db优化

    http://blog.csdn.net/likika2012/article/details/38816037 http://www.nowamagic.net/librarys/veda/deta ...

  7. 转发:maven打包时始终出现以下提示:-source 1.3 中不支持泛型(请使用 -source 5 或更高版本以启用泛型)

    maven打包时始终出现以下提示: 1.-source 1.3 中不支持泛型(请使用 -source 5 或更高版本以启用泛型)List<User> userList= new Array ...

  8. [状压dp]HDOJ3182 Hamburger Magi

    题意 大致是: 有n个汉堡 m块钱  (n<=15) 然后分别给n个汉堡的能量 再分别给n个汉堡所需的花费 然后下面n行 第i行有x个汉堡要在i汉堡之前吃 然后给出这x个汉堡的编号 输出 能获得 ...

  9. [jobdu]最小的K个数

    一开始马上想起来寻找第k小的数,是采用快排的partition方法.但因为题目要把k之前的数排序输出,这个方法就不是很合适,因为(随机化后:http://blog.csdn.net/liangbopi ...

  10. Android 自定义对话框(Dialog)位置,大小

    代码: package angel.devil; import android.app.Activity; import android.app.Dialog; import android.os.B ...