详解Oracle数据库各类控制语句的使用
编程学习 2021-07-05 16:08www.dzhlxh.cn编程入门
本文我们主要介绍了Oracle数据库中各种控制语句的使用,包括逻辑控制语句、Case when的使用、While的使用以及For的使用等,希望本次的介绍能够对您有所收获!
Oracle数据库各类控制语句的使用是本文我们主要要介绍的内容,包括一些逻辑控制语句、Case when的使用、While的使用以及For的使用等等,接下来我们就开始一一介绍这部分内容,希望能够对您有所帮助。
Oracle 中逻辑控制语句
If elsif else end if set serverout on; declare per_dep_count number; begin select count(*) into per_dep_count from emp; if per_dep_count>0 then dbms_output.put_line('Big Than 0'); elsif per_dep_count>5 then <span style="font-size:24px;color:#ff0000;"><strong>--elsif not elseif!!!! </strong></span> dbms_output.put_line('Big Than 5'); else dbms_output.put_line('En?'); end if; end;
Case when 的使用的两种方式 :
第一种使用方式
declare per_dep_count number; begin select count(*) into per_dep_count from emp; case per_dep_count when 1 then dbms_output.put_line('1'); when 2 then dbms_output.put_line('2'); else dbms_output.put_line('else'); end case; end;
第二种使用方式
declare per_dep_count number; begin select count(*) into per_dep_count from emp; case when per_dep_count=1 then dbms_output.put_line('1'); when per_dep_count=2 then dbms_output.put_line('2'); else dbms_output.put_line('else'); end case; end;
While 的使用
declare v_id number:=0; begin while v_id<5 loop v_idv_id:=v_id+1; dbms_output.put_line(v_id); end loop; end;
For的使用
declare v_id number:=0; begin for v_id in 1..5 loop dbms_output.put_line(v_id); end loop; end;
关于Oracle数据库各类控制语句的使用就介绍到这里了,希望本次的介绍能够对您有所收获!
编程语言
- ThinkPad 笔记本如何调节LCD屏幕亮度
- Dreamweaver制作网页打开特效教程
- Win10 Mobile 10586升级后无限重启怎么办 硬重启帮您
- Win8系统提示音频设备有问题有一个或多个音频服
- Xbox One版Win10首个预览版9月份发布
- 如何在textarea文本输入区内实现换行
- Win10 Build 9901系统更新 预览版新版本下载
- McAfee Framework存在远程格式串处理漏洞
- Win10家庭版今日(7月30)正式在中国官方商城开卖
- Win10 Mobile预览版更新完10536.1000后才收到10536.100
- Win10 RS2更新了什么-Win10 RS2最终版本号1704首曝
- Windows7如何查看回收站对应的文件夹有哪些方法
- Win10让Charms栏回归桌面的方法教程
- 取消Windows XP系统开机启动画面的小技巧
- win8系统怎么下载安装USB百兆网卡?
- XP系统下磁盘空间变少了怎么办?XP系统磁盘空间