Oracle Decode()函数和CASE语句都是我们经常用到的,那么它们的区别在哪里呢?下面就为您详细介绍Oracle Decode()函数和CASE语句的区别,供您参考。
首先,举2个简单的例子,简单对比一下这2者的区别。
1.CASE语句:
以下是代码片段:
#div_code img{border:0px;}<!--
Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/
--> SELECT CASE SIGN ( 5 - 5 )
WHEN 1 THEN ' Is Positive '
WHEN - 1 THEN ' Is Negative '
ELSE ' Is Zero ' END
FROM DUAL;
Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/
--> SELECT CASE SIGN ( 5 - 5 )
WHEN 1 THEN ' Is Positive '
WHEN - 1 THEN ' Is Negative '
ELSE ' Is Zero ' END
FROM DUAL;
转载于:http://blog.itpub.net/16860121/viewspace-714695/