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中变量的作用域

    一.变量作用域的含义 变量的作用域说白了就是变量的值从哪里获取,或者说变量取值的地方 我们在写代码过程中会用到很多变量,这些变量会出现在各种代码块中,有的出现在函数块里,有的在函数块外,例如: def ...

  2. Python并发编程之多进程(实战)

    一.multiprocessing和Process multiprocessing提供了支持子进程.通信和数据共享.执行不同形式的同步,提供了Process.Queue.Pipe.Lock等组件 创建 ...

  3. static 的三个作用

    1).用于声明函数体内的变量为静态局部变量,存储在静态数据存储区,在函数被调用过程中维持其值保持不变 2).在文件内(函数体外)被声明为静态的变量,可以被文件内的所有函数访问,但不能被其他文件的函数访 ...

  4. How to setup multimedia on CentOS 7

    You will need to also install the EPEL repository as nux-dextop depends on this for some of its pack ...

  5. POJ:3228-Gold Transportation(要求最小生成树最大边最小)

    Gold Transportation Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 3079 Accepted: 1101 D ...

  6. 【第一章第一回】BootStrap 简介

    Twitter Bootstrap 是目前最受欢迎的前端框架,它简洁.直观.移动优先.强悍的前端开发框架,让web开发更迅速.简单.基于HTML.CSS和Javascript. 为什么使用Bootst ...

  7. webdriver高级应用- 浏览器中新开标签页(Tab)

    #encoding=utf-8 import unittest from selenium import webdriver import time import win32api, win32con ...

  8. TOJ4168: Same Digits

    4168: Same Digits  Time Limit(Common/Java):1000MS/3000MS     Memory Limit:65536KByteTotal Submit: 11 ...

  9. AtCoder Regular Contest 089

    这场一边吃饭一边打,确实还是很菜的 C - Traveling Time limit : 2sec / Memory limit : 256MB Score : 300 points Problem ...

  10. 【Luogu】P3047附近的牛(树形DP)

    题目链接 树形DP,设f[i][j]是当前在i点,j步之内有多少牛.从相邻点to的f[to][j-1]转移而来,减去重复计算即可. #include<cstdio> #include< ...