Get the App
SLTechnology News&Howtos  ›  Database  › 

How to use if/ else syntax in oracle

Shulou Source: shulou.com Published: 2022-05-31 21:12:24 10月13日 Update

This article mainly introduces how to use if/ else grammar in oracle. It is very detailed and has a certain reference value. Friends who are interested must finish it!

1. Standard sql specification

1. Single IF

IF vault... THEN END IF

2 、 IF... ELSE

IF vault... THEN ELSE t.; END IF

3. Multiple IF

IF vault... THEN ELSIF vault... THEN t.; END IFL

Note: multiple IF is' ELSIF' not 'ELSE IF'

2. Decode function

DECODE (VALUE,IF1,THEN1,IF2,THEN2,IF2,THEN2,..,ELSE)

Indicates that the result of the DECODE function returns then1,..., if value is equal to if1, or else if it is not equal to any if value.

3 、 case when

CASE WHERE vault... THEN 'vvvvv'; WHERE vault... THEN 'ffff'; ELSE.; END AS' alias'

Note:

1. Start with CASE and end with END

2. The WHEN in the branch is followed by the condition, and THEN is the display result.

3. ELSE is the other default, which is similar to the default of switch case in high-level language programs.

4. END followed by alias

The above is all the content of the article "how to use if/ else Grammar in oracle". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Tags: Grammar content function alias follower multiple article result advanced value interest branch single buddy beginning situation more condition standard Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Xiaomi macOS Shulou Tech Info MySQL vpn