Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use if/ else syntax in oracle

2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

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!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report