what is DECODE function used for?
来源:互联网 发布:郑州淘宝学校 编辑:程序博客网 时间:2024/05/18 14:13
DECODE is used to decode a CHAR or VARCHAR2 or NUMBER into any of several different strings or numbers based on values,That is DECODE does a value-by-value substitution. For every value that is given in the DECODE function it nakes an "if then"check and matches the value. The general format of DECODE function is given below:
DECODE(value.if1,then1,if2,then2,......,else)
Let us see this with an example:
Consider a table named A which has following namely:Empname,sex,salary
select * from A
Gives output as
Empname sex salary
------------ ---- -------
Priya F 20000
Sri F 10000
Sam M 20000
Raj M 20000
Sita F 10000
In the above if we give the DECODE function as below namely:
Select empname, sex, DECODE(salary,’20000’,’50000’,’70000’) from exforsys;
The output of above DECODE function would result as below:
Empname sex salary
------------ ---- -------
Priya F 50000
Sri F 70000
Sam M 50000
Raj M 50000
Sita F 70000
- what is DECODE function used for?
- Cisco IOS: What Is VLAN 1002 – 1005 Used for ?
- what is AttributeOverride annotation used for in Hibernate
- What is the HINSTANCE passed to CreateWindow and RegisterClass used for?
- What is saturating activation function?
- What is XML for?
- What is for dinner?
- 【html】What is href=“#” and why is it used?
- What is this blog for?
- What is JMS good for?
- A. What is for dinner?
- What is a pure virtual function?
- What is Observer and Observable and when we used these?
- What is and how to calculate 'cumulative gas used'?
- create encode function and decode function for using
- Function is used to Show/Hide the TaskBar
- 警告:'serialAttr' is used uninitialized in this function
- the `gets' function is dangerous and should not be used.
- apache无法列表文件?
- Linux 任务控制的几个技巧( &, [ctrl]-z, jobs, fg, bg, kill)
- 留着慢慢看吧
- tcpl 阅读笔记 第三章 控制流
- ajax用户控件中读取session的问题
- what is DECODE function used for?
- 磁县实验学校
- 广告无法显示
- 每日英语-2009/09/10
- 关于RMS,我们该知道的事(理论篇)
- FCKeditor的js验证
- Java持久层选择Hiberante和iBATIS的时机
- joomla 字体太小
- socket 线程池