Several usage methods of oracle decode function, oracledecode
Decode usage
1: Use decode to determine whether the string is the same
DECODE (value, if1, then1, if2, then2, if3, then3,..., else)
Meaning:
IF condition = value 1 THEN
RETURN (value
DECODE function: Compares the input value with the parameter list in the function and returns a corresponding value based on the input value. The parameter list of a function is a sequence of several numbers and their corresponding result values. Of
The decode () function is one of the powerful functions of Oracle PL/SQL. Currently, only oracle SQL provides this function, and other database vendors do not yet implement this function.
The DECODE function is one of the powerful functions of
Oracle decode functions are very powerful, and here's a detailed description of the use of the Oracle decode function, hopefully giving you a better understanding of Oracle decode functions.
Oracle decode functionsThe Oracle decode function is an
DECODE function: Compares the input value with the parameter list in the function and returns a corresponding value based on the input value. The parameter list of a function is a sequence of several numbers and their corresponding result values. Of
Decode function: It can compare an input value to a parameter list in a function, and return a corresponding value based on the input value. The parameter list of a function is a number of sequential pairs of numbers and their corresponding result
Introduction to the Decode () function in SQLLook at other people's SQL today look at this inside there are also decode () function, has never been in contact with the Internet to check a bit, but also very useful for a function, write down hope to
/*
Decode Function
*/
--
The prototype of the decode function is decode (testvalue, if1, then1, if2, then2.... else ).
--
Test testvalue. If testvalue is set to if1, then1 is returned. If testvalue is set to if2, then2,... is
Compare size function Sign
function Syntax:Sign (n)
Function Description:Take the symbol of number n, greater than 0 to return 1, less than 0 to return-1, equal to 0 to return 0
Example:One, select sign (m), sign (-M), sign (0) from dual;
SIGN (+)
Preface DECODE () function, which compares the input value with the parameter list in the function and returns a corresponding value based on the input value. The parameter list of a function is a sequence of several numbers and their corresponding
DECODE () function usage: Compares the input value with the parameter list in the function, and returns a corresponding value based on the input value. The parameter list of a function is a sequence of several numbers and their corresponding result
The strange DECODE function encountered the following problem today: www.2cto.com order by decode (column_id, 1, null, 2, null, 3, null, column_id, that is, when the number of columns is greater than 10, the column_id order is 10, 11, 12, 13, 6, 7, 8
The customer requested that hive be used to implement the decode function similar to orale. Okay, start work.
Oracle decode function Syntax: DECODE (value, if1, then1, if2, thne2, if3, then3,... else ).
The first problem involved is the dynamic
Decode Function usage:
OracleOfDecodeThe function is quite interesting.OracleExclusive, International StandardSQLNot inDecodeFunction.
Syntax
Decode (Col | expression, search1, result1
[, Search2, result2 ,...,]
[, Default])
Example
In Oracle/plsql, the Decode function has a function of a if-then-else statement.
The syntax for the decode function is:Decode (expression, search, result [, search, result] ... [, default])
The expression value is compared.Search is the value of
The syntax structure of the DECODE function is as follows:
Copy Code code as follows:
Decode (expression, search_1, result_1)
Decode (expression, search_1, Result_1, search_2, result_2)
Decode (expression, search_1, Result_1,
Decode () and NVL () function usage for SQL statementsSELECTDECODE (choose_tool,0, ' BMW ', 1, ' EV ', 2, ' bike ', ' walk ') as My_toolFromdata_tool_tAnalysis: When Choose_tool is 0, my_tool= ' BMW 'When Choose_tool is 1, my_tool= ' EV 'When Choose_
Tag:blog io ar use data on div log ad Meaning explanation: Decode (condition, value 1, return value 1, value 2, return value 2,... Value N, return value N, default value) The function has the following meanings: IF condition =
Meaning explanation:Decode (condition, value 1, return value 1, value 2, return value 2,... Value N, return value N, default value)The function has the following meanings:IF Condition =thenreturn(translation value 1) elsif condition =thenreturn
The oracle function library provides many useful functions, such as nvl, sign, and round. The decode function is used in many cases. This function is used as follows: decode (expression, condition 1, result 1, condition 2, result 2 ,...) there are
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.