代码片段一

 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. 客户端获取服务器SessionID (Asp.net SessionID)

    SessionID是客户端首次访问某个方法或页面, 并且这个方法中设置了Session["xxx"]=xx; 此时服务器返回的响应头(HttpResponse.Headers)中会 ...

  2. Git问题:Cannot update paths and switch to branch 'dev' at the same time.

    使用命令 $ git checkout -b develop origin/develop 签出远程分支,出现以下错误: fatal: Cannot update paths and switch t ...

  3. 推荐一个优秀的前端框架——Bootstrap

    Bootstrap是Twitter推出的一个开源的用于前端开发的工具包.它由Twitter的设计师Mark Otto和Jacob Thornton合作开发,是一个CSS/HTML框架.Bootstra ...

  4. Django视图与网址传参

    目的:采用/add?a=1&b=2  这样get/post方法进行 修改一下mysite/views.py文件 from django.shortcuts import renderfrom ...

  5. MVC+EF 随笔小计——NuGet程序包管理

    安装EF 打开 工具-库程序包管理器-程序包管理器控制台 输入 install-package entityframework 去MSDN上查看下EF的架构图:http://msdn.microsof ...

  6. Win7下安装Mongodb教程

    最新Mongodb下载地址:http://www.mongodb.org/downloads 1.下载完成后,解压到任意路径,如:D:\mongodb: 2.在D:\mongodb目录下 新建data ...

  7. POJ 2531 Network Saboteur

    http://poj.org/problem?id=2531 题意 :有N台电脑,每两台电脑之间都有个通信量C[i][j]; 问如何将其分成两个子网,能使得子网之间的通信量最大. 也就是说将所有节点分 ...

  8. Codeforces Burning Midnight Oil

    /* * BurningMidnightOil.cpp * * Created on: 2013-10-12 * Author: wangzhu */ /** * 每次至少写多少行代码ret: * 1 ...

  9. RxJava开发精要6 – Observables组合

    原文出自<RxJava Essentials> 原文作者 : Ivan Morgillo 译文出自 : 开发技术前线 www.devtf.cn 转载声明: 本译文已授权开发者头条享有独家转 ...

  10. 应付期间 Payables Periods

    (N) AP > Accounting > Control payables periods Click [Period Status] column to Open.