In Oracle/PLSQL, the decode
function has the functionality of
an IF-THEN-ELSE statement.
The syntax for the decode
function is:
decode( expression , search , result [, search ,
result]... [, default] )
expression
is the value to compare.
search
is the value that is compared against expression
.
result
is the value returned, if expression
is
equal to search
.
default
is optional. If no matches are found, the
decode will return default
. If default
is omitted, then
the decode statement will return null (if no matches are found).
Applies To:
- Oracle 9i, Oracle 10g, Oracle 11g
For example:
You could use the decode function in an SQL statement as
follows:
SELECT supplier_name, |
decode(supplier_id, |
10000, |
'IBM', |
|
10001, |
'Microsoft', |
|
10002, |
'Hewlett Packard', |
|
|
'Gateway') result |
FROM suppliers; |
The above decode statement is equivalent to the following
IF-THEN-ELSE statement:
IF supplier_id = 10000 THEN
result := 'IBM';
ELSIF supplier_id = 10001 THEN
result := 'Microsoft';
ELSIF supplier_id = 10002 THEN
result := 'Hewlett Packard';
ELSE
result := 'Gateway';
END IF;
The decode function will compare each supplier_id value, one
by one.
分享到:
相关推荐
AMD Fluid Motion Video是一项AMD研发,将帧率为24FPS【即帧每秒,Frames per Second】或者其他帧率低于60FPS的视频补帧成60帧的...Fixed error on the PotPlayer when enabling decode function using external decoder
博客:PostgreSQL的学习心得和知识总结(四十四)|语法级自上而下完美实现Oracle数据库DECODE函数的实现方案(GreenPlum & AntDB)
base64decode 编码,解码。
A obscure bug was found by HuangYeJun from china, in the RetrieveHeaders function if the retrieved text was larger than 1024 bytes and the crlf.crlf fall in the middle of two chunks, the function is ...
#### 1.5 解码函数(DECODE Function) DECODE函数用于根据表达式的值返回不同的结果,类似于多路分支选择。例如: ```sql DECODE(column_name, 'value1', result1, 'value2', result2, default_result); ``` #### ...
jwt JS解密文件 var getUserjwt = function (token) { if (!token) { return; } } //解析jwt令牌 var jwtDecodeVal = jwt_decode(token);
用js实现的base64encode,base64decode函数. 包括: function base64encode(str) { function base64decode(str) { function utf16to8(str) { function utf8to16(str) { function doit() {
最佳(测试版) python元启发式优化库。 易于扩展和使用。 警告:最佳状态为Beta。 API可能会更改。...# A decode function is useful for converting the binary solution to real numbers def dec
$.getJSON('server_script.php', function(data) { console.log(data.name); // 输出:John Doe }); ``` 这里,`$.getJSON`会发起一个HTTP GET请求到'server_script.php',服务器响应的JSON数据会被自动解析并作为...
全志 a10开发板 专用的 video 硬件 decoding 源码 video decoding sample source code using allwinner a10 hardware encoding function for development board (h264, h263, mp4,...)
不用重启电脑.txt”可能包含了详细步骤来指导你如何添加环境变量,而“1.Fatal error Call to undefined function curl_init().txt”可能是对错误的详细描述或者解决方案的记录。“2.php.ini中extension = ...
function urldecode(encodestr) newstr = "" havechar = false lastchar = "" for i = 1 to len(encodestr) char_c = mid(encodestr, i, 1) if char_c = "+" then newstr = newstr & " " elseif char_c = "%...
JavaScript中的`encode`和`decode`是一组用于字符串编码解码的方法,它们在处理和传输数据时起到关键作用。在JavaScript中,常见的编码方法有`encodeURIComponent`、`decodeURIComponent`、`encodeURI`、`decodeURI`...
然而,默认情况下,`json_decode` 会转义特殊字符并把非ASCII的中文字符转换为Unicode编码,这可能导致在数据库或日志中查看时不方便。本文将详细介绍如何在PHP中使用`json_decode` 不转义中文的方法。 对于PHP 5.4...
Function URLDecode(enStr) dim deStr, strSpecial, c, i, v deStr = "" strSpecial = "!""#$%'()*+,.-_/:;=?@[/]^`{|}~%" For i = 1 To Len(enStr) c = Mid(enStr, i, 1) If c = "%" Then v = Eval("h" & ...
Function URLDecode(enStr) Dim deStr Dim c, i, v deStr = "" For i = 1 To Len(enStr) c = Mid(enStr, i, 1) If c = "%" Then v = Eval("&h" + Mid(enStr, i + 1, 2)) If v deStr = deStr & Chr(v) i =...
在"Oracle的几个Function实例"这个主题中,我们将探讨一些常见的Oracle函数,并通过实际示例来理解它们的用法。 1. ** NVL 函数**: NVL函数用于处理空值(NULL)。如果一个字段的值为NULL,NVL函数会将其替换为你...
function js_urldecode(url) { var output = url; var binVal, thisString; var myregexp = /(%[^%]{2})/; while ((match = myregexp.exec(output)) != null) { // ... // 解码过程 // ... } function utf...
decode = K.function([model.input, input_length], [ctc_decode[0][0]]) ``` 这样,`decode`函数就可以在循环中重复调用,而不会每次都向计算图添加新节点,从而解决了内存不释放的问题。 关于CTC_loss,同样的...
function ajax_decode($str){ $patern = array("/%25/","/%26/","/%3D/"); $rp = array("%","=","&"); return preg_replace($patern, $rp, $str); } ``` 通过这两个自定义函数,我们可以根据需要对字符串进行...