Oracle中 decode的用法

select id, decode(sign(score-85),1,'优秀',0,'优秀',-1, 
decode(sign(score-70),1,'良好',0,'良好',-1, 
decode(sign(score-60),1,'及格',0,'及格',-1,'不及格'))) 
from student;

 

decode(sign(变量1-变量2),1,'',0,'',-1,'') 

1:成立的时候

0:相等时

-1:不等时

 

 

http://www.cnblogs.com/freespider/archive/2010/08/09/1795977.html

posted @ 2017-04-21 11:14  MalongSing  阅读(2363)  评论(0编辑  收藏  举报