Delete
Setting
Add New Item
Menu List
Title | Content Type | Order | Action | ||||||
---|---|---|---|---|---|---|---|---|---|
{{kb_content.name}} {{kb_content.name}} | {{setValue(content_types, kb_content.content_type)}} | {{kb_content.sort_order}} | Preview Edit Edit Content | ||||||
{{kb_content.name}} | {{setValue(content_types, kb_content.content_type)}} | {{kb_content.sort_order}} | Preview Edit Edit Content | ||||||
No record |
Oracle CASE expression
Introduction to Oracle Database Oracle Tables and Data definition Modifying data Oracle Query and Filter Oracle data types Joining tables Oracle Operators Grouping data Constraints
Oracle CASE expression allows you to add if-else logic to SQL statements without having to call a procedure. The CASE expression evaluates a list of conditions and returns one of the multiple possible results.
Oracle CASE expression has two formats: the simple CASE expression and the searched CASE expression. Both formats support an optional ELSE clause.
simple CASE expression:
The following illustrates the syntax of the simple CASE expression:
CASE e
WHEN e1 THEN
r1
WHEN e2 THEN
r2
WHEN en THEN
rn
[ ELSE r_else ]
END
Example:
Select *from app_list where parent_id = (CASE when :P25_PARENT_ID is NULL THEN 0
else :P25_PARENT_ID
END)
Searched CASE expression:
The Oracle searched CASE expression evaluates a list of Boolean expressions to determine the result.
The searched CASE statement has the following syntax:
CASE
WHEN e1 THEN r1
[ WHEN e2 THEN r2]
...
[ELSE
r_else]
END
Example:
select name,
alias,
(CASE
WHEN parent_id==0 THEN 'Parent'
ELSE 'Child'
END) list_type
from app_lists;