Oracle functions--General functions ___ static functions

Source: Internet
Author: User


Oracle Functions--common functions


NVL (EXPRESS1,EXPRESS2):

If the first expression is empty, the value of the second expression is displayed; If the first expression is not empty, the value of the first expression is displayed;

NVL2 (EXPRESS1,EXPRESS2,EXPRESS3);

Returns an expression of 3 if the first expression is empty, and returns an expression of 2 if the first expression is not empty;

Nullif (EXPRESS1,EXPRESS2);

If the expression 1 is the same as the expression 2, the result is null, otherwise the result is 1;

COALESCE (EXPRESS1,EXPRESS2,EXPRESS3 ...) );

The function is to return the first expression that is not empty and return NULL if all is empty. Note that all representations must be of the same type or can be converted to the same type;

Decode (condition, value 1, return value 1, value 2, return value 2, value 3, return value 3, ... value n, return value N, default value);

The meaning of the function is as follows: if "condition" equals "value 1", returns "return value 1", if "condition" equals "Value 2", returns "return value 2" ..., returns "return value n" if "condition" equals "value n", otherwise returns "default value";

case when function;

This function is similar to the if...when in the Java syntax, and its syntax is as follows:

Case conditions

When ' value 1 ' Then ' returns a value of 1 '

When ' value 2 ' Then ' returns a value of 2 '

When ' value 3 ' Then ' returns a value of 3 '

Else ' return value 4 '

End


Example:

Select

(Case S.sex

When 1 Then ' Men '

When2 Then ' female '

Else ' empty '

End

) gender

From user s

7, Concat (String 1, string 2);

The function returns the string 1 and connects the string 2 after it;

Example: Select Concat (' Yang ', ' Peng ') from dual; The return value is ' Yangpeng ';

8, Length (string);

The function returns the length of the string;







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.