plsql_case when_if else endif
Example 1-7 Using the IF-THEN_ELSE and CASE Statement for Conditional Control
DECLARE jobid employees.job_id%TYPE; empid employees.employee_id%TYPE := 115; sal employees.salary%TYPE; sal_raise NUMBER(3,2); BEGIN SELECT job_id, salary INTO jobid, sal from employees WHERE employee_id = empid; CASE WHEN jobid = 'PU_CLERK' THEN IF sal < 3000 THEN sal_raise := .12; ELSE sal_raise := .09; END IF; WHEN jobid = 'SH_CLERK' THEN IF sal < 4000 THEN sal_raise := .11; ELSE sal_raise := .08; END IF; WHEN jobid = 'ST_CLERK' THEN IF sal < 3500 THEN sal_raise := .10; ELSE sal_raise := .07; END IF; ELSE BEGIN DBMS_OUTPUT.PUT_LINE('No raise for this job: ' || jobid); END; END CASE; UPDATE employees SET salary = salary + salary * sal_raise WHERE employee_id = empid; COMMIT; END; /
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/9240380/viewspace-668859/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- C語言的條件編譯#if, #elif, #else, #endif、#ifdef, #ifndefC語言編譯
- #ifndef/#define/#endif使用詳解
- JS - if else and else if statementJS
- plsql_case when_end case學習小例SQL
- c# 判斷多分支學習if else if elseC#
- python 中的 for-else 和 while-else 語句PythonWhile
- JavaScript if else 語句JavaScript
- if else與策略模式模式
- if …if 和if …else if 區別
- Python if..elsePython
- What else is there in Python?Python
- C++自學34:原始檔與標頭檔案(pragma/ifndef/endif/ifdef)C++
- if-elif-else結構
- python的for..elsePython
- python中for……else……的使用Python
- 淺談優化if...else優化
- 學習Scala IF…ELSE 語句
- 不要if else的程式設計程式設計
- JSX 中的 If-ElseJS
- 善用python的else子句Python
- 技術卡片 - 不要使用 else
- 在CSS中如何使用 when/elseCSS
- python中的while...elsePythonWhile
- Java 判斷語句 - if…else/switchJava
- 優化If else(簡化程式碼)優化
- Python if else條件語句Python
- Python 無處不在的 elsePython
- python學習:for else語句Python
- oracle 中的 if- else if- end ifOracle
- 如何用設計模式替代if else設計模式
- 策略模式+工廠模式取代if{}else{}模式
- 清華尹成帶你實戰GO案例(9)Go if..else if..else 條件判斷Go
- 實戰if-else 過多詳解
- Python 基礎 - if else流程判斷Python
- Python中if else語句出錯Python
- Spring Boot中如何幹掉if elseSpring Boot
- 減少該死的 if else 巢狀巢狀
- CSS,我可以寫 if/else 語法了?CSS