The decode () function in Oracle

Source: Internet
Author: User

One, decode () function

1. Grammar

DECODE (Control_value,value1,result1[,value2,result2 ...] [, Default_result]);

Control _value: The value you are trying to process. The decode function compares this value to the subsequent sequence of even orders to determine the return value.

Value1: is a numerical value of a constituent sequence. If the input value matches successfully, the corresponding result is returned. corresponding to an empty return value, you can use the keyword NULL for the corresponding.

RESULT1: Is the result value of a constituent sequence pair.

Default_result The default value returned by the function when it fails to match any one of the values.

2. Usage

When the first argument equals 1 o'clock, return "you are standing here."

When the first argument equals 2 o'clock, return "do not move around"

Returns "I'll buy some oranges" when the first parameter equals another value.

The decode () function in Oracle

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.