1. if...then语句

  if <condition_expression> then

    plsql_sentence;

  end if;  

declare
-- Local variables here
v_name1 varchar2(50);
v_name2 varchar2(50);
begin
-- Test statements here
v_name1 := 'East';
v_name2 := 'xiaoke';
if length(v_name1) < length(v_name2) then
dbms_output.put_line('字符串['||v_name1||']的长度比字符串['||v_name2||']小!');
end if;
end;

2. if...then...else语句
   if <condition_expression> then

    plsql_sentence1;

  else

    plsql_sentence2;

  end if;

declare
-- Local variables here
v_age int := 55;
begin
-- Test statements here
if v_age > 56 then
dbms_output.put_line('您可以申请退休了!');
else
dbms_output.put_line('您小于56岁,不可以申请退休!');
end if;
end;

3. if...then...elsif语句
  if <condition_expression1> then

    plsql_sentence_1;

  elsif <condition_expression2> then

    plsql_sentence_2;

  else

    plsql_sentence_n;

  end if;

declare
-- Local variables here
v_month int := 3;
begin
-- Test statements here
if v_month <= 3 then
dbms_output.put_line('这是春季!');
elsif v_month <= 6 then
dbms_output.put_line('这是夏季!');
elsif v_month <= 9 then
dbms_output.put_line('这是秋季!');
elsif v_month <= 12 then
dbms_output.put_line('这是冬季!');
else
dbms_output.put_line('您输入的月份不合法!');
end if;
end;

4. case语句
  case <selector>

    when <expression_1> then plsql_sentence_1;

    when <expression_2> then plsql_sentence_2;

    ...

    when <expression_n> then plsql_sentence_n;

    [else plsql_sentence;]

  end case;

declare
-- Local variables here
v_season int := 3;
v_autoInfo varchar2(50);
begin
-- Test statements here
case v_season
when 1 then
v_autoInfo := v_season || '季度包括1,2,3月份';
when 2 then
v_autoInfo := v_season || '季度包括4,5,6月份';
when 3 then
v_autoInfo := v_season || '季度包括7,8,9月份';
when 4 then
v_autoInfo := v_season || '季度包括10,11,12月份';
else
v_autoInfo := v_season || '季度不合法';
end case;
dbms_output.put_line(v_autoInfo);
end;

最新文章

  1. 安装zookeeper
  2. ClickOnce部署
  3. 常看常遇见之一——BS架构VS CS架构
  4. Android Fragment (二) 实例1
  5. 码农谷 找出N之内的所有完数
  6. dennis gabor 从傅里叶(Fourier)变换到伽柏(Gabor)变换再到小波(Wavelet)变换(转载)
  7. php无极分类
  8. BZOJ_1015_星球大战_[JSOI2008]_(并查集)
  9. 3种创建、调用JavaScript对象的方法
  10. cc2540 cc2541 低功耗实測和总结-与注意事项 - 低功耗小于10uA
  11. EIGRP负载均衡、手工汇总、泄露明细、安全认证
  12. 编译安装httpd 2.4
  13. Cas 服务器 使用HTTP协议对外服务
  14. Ubuntu开发用新机安装流程
  15. 应用间共享文件 FileProvider
  16. :hover在ios无效问题
  17. &lt;BEA-141281&gt; &lt;unable to get file lock, will retry ...&gt;
  18. WebService/WCF/WebAPI 之间的区别
  19. 关于java 操作linux命令的 一些相关
  20. Linux引导启动程序 - boot

热门文章

  1. Delphi7编译时,发生Access violation at address 00A7B628 in module &#39;dcc70.dll&#39;. Read of address 00000000.(Delphi6升级到Delphi7)
  2. 关于HttpRuntime.Cache的运用
  3. 20145216《java程序设计》课程总结
  4. 20145322第九周JAVA程序设计基础学习总结
  5. C++实现最基本的LRUCache服务器缓存
  6. README.android
  7. swoole 异步队列简明教程
  8. IntelliJ IDEA 开发git多模块项目
  9. mysql类似递归的一种操作进行层级查询
  10. 爬虫框架Scrapy之Settings