declare
-- 声明奖金的变量
v_comm emp.comm%type;
begin
-- 查询出员工的奖金
select comm into v_comm from emp where empno=&no;
-- 判断如果员工没有奖金,把基本工资的10%作为奖金
if v_comm is null then
update emp set comm=sal*0.1 where empno=&no;
--如果原先奖金低于1000,提升到1000
elsif v_comm<1000 then
update emp set comm=1000 where empno=&no;
-- 其他情况 把奖金提升10%
else
update emp set comm=comm*1.1 where empno=&no;
end if;
end;
declare
-- 声明部门编号的变量
v_deptno emp.deptno%type:=&no; begin
case v_deptno
when 10 then
dbms_output.put_line('技术部');
when 20 then
dbms_output.put_line('业务部');
when 30 then
dbms_output.put_line('开发部');
when 40 then
dbms_output.put_line('财务部');
else
dbms_output.put_line('您查找的部门不存在');
end case; end;

Oracle if else 、case when 判断示例的更多相关文章

  1. Linux shell case条件判断及位置变量

    case语句使用于需要进行多重分支的应用情况 case分支判断结构 语法: case 变量名称 in      value1)          statement          statemen ...

  2. Oracle特有函数 case when decode exists 分页rownum

    select * from EMP eselect * from dept dselect * from salgrade s--Oracle特有函数 case whenselect case 2 w ...

  3. shell编程 条件判断式----利用 case ..... esac 判断

    条件判断式----利用 case ..... esac 判断 case  $变量名称 in   <==关键词为 case ,还有变量前有钱字号 "第一个变量内容")   &l ...

  4. Oracle sql 子字符串长度判断

    Oracle sql 子字符串长度判断 select t.* from d_table t ,) ,instr(t.col,; 字符串的前两位都是数字: select * from d_table t ...

  5. Oracle decode和case的区别

    case在SQL中有两种写法,先建立一个表create table salgrade(grade int, sal int);insert into salgrade values(1,1000);i ...

  6. oracle 数据库——知识点总结(加示例)

    新入oracle数据库,把目前学到的知识点记录下来,可能都比较基础,但还是比较全的,里面的示例都是自己在PL/SQL中跑过的,如果有错误,还望各位大侠指出哈. 创建用户 1.创建用户(使用管理员身份创 ...

  7. oracle+servlet+extjs4 分页表格布局示例代码

    Log.java package com.example.entity; import java.util.Date; public class Log { private int id; priva ...

  8. oracle中的case when then else end 用法

    Case when 的用法,简单Case函数 简单CASE表达式,使用表达式确定返回值. 语法: CASE search_expression WHEN expression1 THEN result ...

  9. sql server case when 判断为空

    代码如下 select distinct G.* ,(select BUSINESS_NAME from BusinessInfo where BusinessInfo.BUSINESS_BID=G. ...

随机推荐

  1. Python头脑风暴2

    今天想到了一个致富新途径:假如我在X东上班,我写个X宝爬虫,专门爬在X宝买奢侈品的土豪,然后我自己注册个X宝号,用脚本一个个加他们然后给他们发信息说我X东这还有比你更便宜更好的...不知道行不行啊(狗 ...

  2. LeetCode(307) Range Sum Query - Mutable

    题目 Given an integer array nums, find the sum of the elements between indices i and j (i ≤ j), inclus ...

  3. Eclipse设置C++自动补全变量名快捷键

    用快捷键:Alt+/ 要是还是有些场合不能提示,按照下列步骤 Window-Preferences-c/c++-Editor-Content Assist-Advanced 将未勾选的全部勾选

  4. selenium2基本控件介绍及其代码

    输入框:input  表现形式:      1.在html中一般为:<input id="user" type="text"> 主要操作:    ...

  5. 《鸟哥的Linux私房菜》学习笔记(1)——文件与目录

    在Linux中,任何设备都是文件,不仅如此,连数据通信的接口也有专门的文件负责.可以说,一切皆文件,目录也是一种文件,是路径映射.因此,文件系统是Linux的基础. 一.文件与目录管理命令 1.ls( ...

  6. dwr介绍及配置

    DWR 编辑 DWR(Direct Web Remoting)是一个用于改善web页面与Java类交互的远程服务器端Ajax开源框架,可以帮助开发人员开发包含AJAX技术的网站.它可以允许在浏览器里的 ...

  7. 大数据学习——scala函数与方法

    package com /** * Created by Administrator on 2019/4/8. */ object TestMap { def ttt(f: Int => Int ...

  8. selenium - 常用页面操作

    # 2.常用页面操作 # 访问某一个页面url = 'http://www.baidu.com'driver.get(url) # 获取页面的标题title = driver.titleprint(t ...

  9. 解压文件夹python

    # _*_ coding: utf-8 _*_ import zipfile import shutil import os print os.getcwd() basedir = os.path.d ...

  10. Jupyter Notebook与Jupyterhub的安装与配置

    Jupyter Notebook是一个很好用的交互环境,Jupyterhub则在此基础上实现了多用户的管理.最近配置这个环境的时候也遇到了一些坑,想想自己疯狂百度的过程,在此把自己的完整安装配置流程记 ...