oracle存储过程写法(一)
Create or Replace Procedure Proc_AppendRecords
(
nAppendCount int -- 要添加的记录条数
)
as
begin
declare
nstart int;
nend int;
begin
select NVL(max(UserID),0) into nstart from T_Test_Checkbill;
nend := nstart + nAppendCount;
while nstart < nend loop
nstart := nstart + 1;
insert into T_Test_Checkbill values(Seq_testCheckbill.nextval, 'User'||nstart, 'UPwd'||nstart,
mod(nstart*73, 100), sysdate, 'Note'||nstart);
end loop;
end;
end;
其中NVL说明如下:
Syntax
Purpose
NVL
lets you replace null (returned as a blank) with a string in the results of a query. Ifexpr1
is null, thenNVL
returnsexpr2
. Ifexpr1
is not null, thenNVL
returnsexpr1
.
The arguments expr1
and expr2
can have any datatype. If their datatypes are different, then:
If
expr1
is character data, then Oracle Database convertsexpr2
to the datatype ofexpr1
before comparing them and returnsVARCHAR2
in the character set ofexpr1
.If
expr1
is numeric, then Oracle determines which argument has the highest numeric precedence, implicitly converts the other argument to that datatype, and returns that datatype.See Also:
Table 2-11, "Implicit Type Conversion Matrix" for more information on implicit conversion and"Numeric Precedence " for information on numeric precedence
Examples
The following example returns a list of employee names and commissions, substituting "Not Applicable" if the employee receives no commission:
SELECT last_name, NVL(TO_CHAR(commission_pct), 'Not Applicable') "COMMISSION" FROM employees WHERE last_name LIKE 'B%' ORDER BY last_name;
oracle存储过程写法(一)相关推荐
- oracle存储过程写法 并行_oracle存储过程的写法
1.存储过程的基本语法: CREATE OR REPLACE PROCEDURE 存储过程名(param1 in type,param2 out type) IS 变量1 类型(值范围); 变量2 类 ...
- oracle存储过程写法 并行_oracle存储过程写法
表名改过来,试下? create procedurce pro_insert as declare @allAmount double,@per double,@safeQty double,@typ ...
- oracle的存储过程写法Oracle中如何写存储过程
Oracle的存储过程基本写法 Oracle存储过程简介: 存储过程是事先经过编译并存储在数据库中的一段SQL语句的集合,调用存储过程可以简化应用开发人员的很多工作,减少数据在数据库和应用服务 ...
- Oracle存储过程日常工作整理写法实例
Oracle存储过程日常工作整理写法实例 create or replace package body CUX_HRMIS_SYNC_PKG is /* *-- Creation time:2016 ...
- Oracle存储过程(增、删、改)写法
工作上也没什么事情,一天都琐碎的事,空闲时间比较多,自己可以随意安排. 分析目前的形式,发现自己要学的东西真是太多了,都不知道要学什么好,例如:数据库.开发技术.管理--这些技术东西,一天一天都在更新 ...
- oracle存储过程(写法+实战)
1. 先看看oracle存储过程的格式: create or replace procedure p_add(num1 in number,num2 in number, result out num ...
- oracle存储过程建表写法,用oracle存储过程创建表
create or replace procedure createtable(tname in varchar2) is sqlTEXT varchar2(400); v_createsql var ...
- Oracle存储过程基本写法
oracle 存储过程的基本语法 1.基本结构 CREATE OR REPLACE PROCEDURE 存储过程名字 ( 参数1 IN NUMBER, 参数2 IN NUMBER ) ...
- oracle存储过程游标写法,Oracle存储过程,游标使用
语法: CREATE [OR REPLACE] PROCEDURE procedure_name (arg1 [mode1] datatype1,arg2 [mode2] datatype2,...) ...
最新文章
- tplink路由器dns服务器未响应,小米路由器AC2100恢复出厂设置的方法
- liunx服务(Nginx服务器 web服务器源码包和rpm 服务平滑升级)
- 剑指Offer_29_最小的K个数
- DW Question Answer Pro 1.3.4 DWQA问答系统插件
- vsphere虚拟克隆虚拟服务器,vSphere实战攻略2:虚拟机模板与克隆
- c++模板---3(类模板碰到继承问题,类模板类外实现,类模板与友元函数)
- Ubuntu安装pycharm并且激活
- 《BI那点儿事》数据挖掘各类算法——准确性验证
- matlab库函数大全
- 黑莓7100T激活上网、彩信设置(转)
- 药店千方百剂系统无法连接服务器,管家婆千方百剂软件常见问题解决办法分享...
- 信道滤波带宽,信号带宽,频率误差的关系
- 2016 Youtube 推荐系统介绍
- 数据结构(3) 第三天 栈的应用:就近匹配/中缀表达式转后缀表达式 、树/二叉树的概念、二叉树的递归与非递归遍历(DLR LDR LRD)、递归求叶子节点数目/二叉树高度/二叉树拷贝和释放...
- java狐妖外传,月华凌乱——狐不归外传
- oracle 918,Oracle00-918:未明确定义列的错误
- 浙大计算机学院郭庆,团队介绍
- [剑指Offer]-矩阵中的路径
- matlab傅里叶变换 绘图
- io 流相关知识之available()方法的使用总结
热门文章
- 机器学习实践一 logistic regression regularize
- 598. 范围求和 II
- leetcode 168. Excel表列名称
- leetcode剑指 Offer 20. 表示数值的字符串
- 超越Android:探索Kotlin的应用领域
- 数据科学r语言_您应该为数据科学学习哪些语言?
- 构建了我的第一个React Native应用程序之后,我现在确信这是未来。
- 「BZOJ1485」[HNOI2009] 有趣的数列 (卡特兰数列)
- maven+jetty项目在tomcat部署
- cmstop框架中的js设计content.js