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 ...
随机推荐
- Unity3D--学习太空射击游戏制作(四)
步骤七:添加声音和特效(射击声音和爆炸效果) 01:在Project窗口单机右键,选择Import Package->Custome Package,然后到资源文件目录packages浏览uni ...
- php验证身份证号码正确性
发布:JB01 来源:脚本学堂 [大 中 小] 分享一例php代码,用于验证身份证号码的正确性,用到了preg_match.preg_replace函数,有需要的朋友可以参考学习下.本文转 ...
- 产生一个长度为100的int数组,并向其中随机插入1-100,不能重复
]; ArrayList myList=new ArrayList(); Random rnd=new Random(); ) { ,); if(!myList.Contains(num)) myLi ...
- 在Linux上安装Memcached服务
下载并安装Memcache服务器端服务器端主要是安装memcache服务器端.下载:http://www.danga.com/memcached/dist/memcached-1.2.2.tar.gz ...
- 使用.net 的Chart控件绘制曲线图
在进行软件开发过程中我们可能会碰到需要生成图表的情况,在.NET中以前经常用GDI去绘制,虽然效果也不错,自从.NET 4.0开始,专门为绘制图表而生的Chart控件出现了,有了它,就可以轻松的绘制你 ...
- net.sf.json日期类型格式化输出
net.sf.json 日期类型格式化输出 Date, Timestamp ; 编写工具类 package cn.jorcen.commons.util; import java.text.DateF ...
- 朴素贝叶斯文本分类java实现
package com.data.ml.classify; import java.io.File; import java.util.ArrayList; import java.util.Coll ...
- portal、portlet、portlet容器三个概念
什么是portal Portlet规范中是这样定义portal的: A portal is a web based application that –commonly- provides perso ...
- POJ2221+模拟
参考http://blog.sina.com.cn/s/blog_7de5c6210100tm1h.html 其实是水题............ #include<string.h> #i ...
- HDU4515+计算日期
模拟! /* 计算过了D天后的日期 之前D天的日期 */ #include<stdio.h> int judge_year( int year ){ ==&&year%!= ...