您现在的位置是:网站首页> 编程资料编程资料
详解Oracle数据库各类控制语句的使用_oracle_
2023-05-27
517人已围观
简介 详解Oracle数据库各类控制语句的使用_oracle_
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 --elsif not elseif!!!! 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数据库各类控制语句的使用就介绍到这里了,希望本次的介绍能够对您有所收获!
您可能感兴趣的文章:
相关内容
- 对比Oracle临时表和SQL Server临时表的不同点_oracle_
- 实例讲解临时处理去重 80w 数据时夯死现象_oracle_
- 如何实现只授予用户查看存储过程定义的权限_oracle_
- oracle存储过程常用的技巧(详)_oracle_
- Oracle触发器用法实例详解_oracle_
- Oracle自动备份脚本_oracle_
- Oracle自动备份及自动备份步骤_oracle_
- Oracle DATABASE LINK(DBLINK)创建与删除方法_oracle_
- Oracle创建Database Link的两种方式详解_oracle_
- oracle中变长数组varray,嵌套表,集合使用方法_oracle_
