詳解Oracle數(shù)據(jù)庫各類控制語句的使用
Oracle數(shù)據(jù)庫各類控制語句的使用是本文我們主要要介紹的內(nèi)容,包括一些邏輯控制語句、Case when的使用、While的使用以及For的使用等等,接下來我們就開始一一介紹這部分內(nèi)容,希望能夠?qū)δ兴鶐椭?/p>
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;
關(guān)于Oracle數(shù)據(jù)庫各類控制語句的使用就介紹到這里了,希望本次的介紹能夠?qū)δ兴斋@!
相關(guān)文章
CentOS 6.3下安裝部署Oracle服務(wù)器圖文教程
這篇文章主要介紹了CentOS 6.3下安裝部署Oracle服務(wù)器圖文教程,本文內(nèi)容詳細(xì),步驟清楚,并配有大量圖片說明,需要的朋友可以參考下2014-09-09Oracle數(shù)據(jù)庫中外鍵的相關(guān)操作整理
這篇文章主要介紹了Oracle數(shù)據(jù)庫中外鍵的相關(guān)操作整理,包括對外鍵參照的主表記錄進(jìn)行刪除的操作方法等,需要的朋友可以參考下2016-01-01Oracle 實(shí)現(xiàn) 一個(gè)關(guān)鍵字 匹配多個(gè) 字段的方法
這篇文章主要介紹了Oracle 實(shí)現(xiàn) 一個(gè)關(guān)鍵字 匹配多個(gè) 字段的方法,本文給大家提供兩個(gè)方案,非常不錯(cuò),具有一定的參考借鑒價(jià)值 ,需要的朋友可以參考下2019-05-05Oracle數(shù)據(jù)庫中創(chuàng)建自增主鍵的實(shí)例教程
Oracle的字段自增功能,可以利用創(chuàng)建觸發(fā)器的方式來實(shí)現(xiàn),接下來我們就來看看Oracle數(shù)據(jù)庫中創(chuàng)建自增主鍵的實(shí)例教程,需要的朋友可以參考下2016-05-05刪除EM,強(qiáng)制結(jié)束EM進(jìn)程后,啟動數(shù)據(jù)庫ORA-00119,ORA-00132報(bào)錯(cuò)的解決方法
通過emca -deconfig dbcontrol db -repos drop命令刪除EM資料庫時(shí),很長時(shí)間沒有刪除完成,期間數(shù)據(jù)庫連接數(shù)暴漲,達(dá)到數(shù)據(jù)庫最大連接數(shù),結(jié)果前臺及后臺均連接不上數(shù)據(jù)庫。強(qiáng)制殺死EM及應(yīng)用相關(guān)進(jìn)程,關(guān)閉數(shù)據(jù)庫后,重啟數(shù)據(jù)庫時(shí)報(bào):ORA-00119,ORA-00132錯(cuò)誤2015-12-12