Αποτελέσματα Αναζήτησης
For example, you can use the CASE expression in statements such as SELECT, UPDATE, or DELETE, and in clauses like SELECT, WHERE, HAVING, and ORDDER BY. Oracle CASE expression has two formats: the simple CASE expression and the searched CASE expression. Both formats support an optional ELSE clause.
In a simple CASE expression, Oracle Database searches for the first WHEN... THEN pair for which expr is equal to comparison_expr and returns return_expr. If none of the WHEN... THEN pairs meet this condition, and an ELSE clause exists, then Oracle returns else_expr. Otherwise, Oracle returns null.
Script Name Simple SQL CASE example Description In this simple CASE expression, Oracle Database evaluates the first WHEN and returns the THEN if satisfied. It next considers the next WHEN condition.
Oracle Database 10g: SQL Fundamentals I 1-2 1-2 Copyright © 2004, Oracle. All rights reserved. Objectives After completing this lesson, you should be able to do the following: • List the capabilities of SQL SELECTstatements • Execute a basic SELECTstatement • Differentiate between SQL statements and iSQL*Plus commands Objectives
A WHEN clause can return the result of another CASE expression. This checks if the row is for a genuine result first. If it is, it returns the result of the grading CASE expression. It also has separate CASE expressions to see if a result is for a test exam or student, concatenating their output.
CASE Expressions. Improving SQL efficiency using CASE. Some time ago I wrote ‘The Power of Decode’ - a paper on using the DECODE function to improve report performance. I was aware at the time that DECODE was being replaced by CASE but wanted to make sure that the paper applied to as many Oracle versions as possible.
Oracle Data Warehousing Guide for examples using various forms of the CASE expression. Simple CASE Example. For each customer in the sample oe.customers table, the following statement lists the credit limit as "Low" if it equals $100, "High" if it equals $5000, and "Medium" if it equals anything else.