摘要: 含义解释: decode(条件,值1,返回值1,值2,返回值2,...值n,返回值n,缺省值)该函数的含义如下: IF 条件=值1 THEN RETURN(翻译值1) ELSIF 条件=值2 THEN RETURN(翻译值2) ...... ELSIF 条件=值n THEN RETURN(翻译值n) ELSE RETURN(缺省值) END IFdecode(字段或字段的运算,值1,值2,值3) 这个函数运行的结果是,当字段或字段的运算的值等于值1时,该函数返回值2,否则返回值3 当... 阅读全文
posted @ 2014-01-27 10:45 Derek1208 阅读(617) 评论(0) 推荐(0) 编辑
摘要: 查询: 普通查询: select * from userlist; 条件查询: select * from userlist where name = '张三'; 删除重复项: selectdistinct(name) from userlist ; 取前N行: select *,rownum from userlist where rownum <=N; 排序: select * from userlist order by id desc; 降序 select * from userlist order by id asc;升序 改变显示: ... 阅读全文
posted @ 2014-01-27 10:23 Derek1208 阅读(155) 评论(0) 推荐(0) 编辑
摘要: --Oracle trunc()函数的用法/**************日期********************/1.select trunc(sysdate) from dual--2011-3-18 今天的日期为2011-3-182.select trunc(sysdate, 'mm') from dual--2011-3-1 返回当月第一天.3.select trunc(sysdate,'yy') from dual --2011-1-1 返回当年第一天4.select trunc(sysdate,'dd') from dual --2 阅读全文
posted @ 2014-01-27 10:21 Derek1208 阅读(384) 评论(0) 推荐(0) 编辑