
oracle
Archibald丶
这个作者很懒,什么都没留下…
展开
-
oracle 除数为0 问题 && decode 用法
select 100/10 from dual; 结果为10但是当除数为0时报错,例如:select 100/0 from dual; 解决方案:当除数为0时,不让系统提示出错,显示为0select decode( a, 0, 0, b/a ) from dual;decode函数意义select decode( a, b, c, b/a原创 2018-01-31 14:44:05 · 2308 阅读 · 0 评论 -
mybatis & oracle & 存储过程调用实例
mapper namespace="这里为mapper接口类全名" > resultMap id="CusBaseMap0" type="java.util.HashMap"> result column="DATATYPE" property="datatype" jdbcType="VARCHAR" /> result column="DATAVALUE" property="da原创 2018-01-25 09:17:08 · 437 阅读 · 0 评论 -
oracle行转列函数
PIVOT为行转列 语法SELECT .... FROM <table-expr> PIVOT ( aggregate-function(<column>) FOR <pivot-column> IN (<value1>, <value2>,..., <valuen&...原创 2018-03-08 11:30:14 · 635 阅读 · 0 评论 -
oracle月数年数专用函数months_between
求时间差月数floor(months_between(sysdate, date)) 求时间差年数floor(months_between(sysdate, date) / 12) years原创 2018-07-25 21:46:33 · 4656 阅读 · 0 评论 -
oracle sql like多个条件函数
select * from table where REGEXP_LIKE(字段名, '(匹配串1|匹配串2|...)') ;//全模糊匹配select * from table where REGEXP_LIKE(字段名, '^(匹配串1|匹配串2|...)') ;//右模糊匹配select * from table where REGEXP_LIKE(字段名, '(匹配串1|匹配...原创 2018-07-25 21:55:30 · 13183 阅读 · 0 评论 -
oracle日期,获取年月日等函数、日期函数、时区
获取年月日年 select extract(year from sysdate) from dual;月 select extract(month from sysdate) from dual;日 select extract(day from sysdate) from dual;格式化日期:TO_CHAR(SYSDATE(),'YY/MM/DD HH24...原创 2018-07-26 00:00:36 · 52588 阅读 · 1 评论 -
delete、truncate和drop的区别
不再需要该表时, 用 drop;**仍要保留该表,但要删除所有记录时, 用 trunc**ate;要删除部分记录时, 用 delete.drop和delete只是删除表的数据(定义),drop语句将删除表的结构、被依赖的约束(constrain)、触发器 (trigger)、索引(index);依赖于该表的存储过程/函数将保留,但是变为invalid状态。 效率方面:drop >...原创 2018-07-27 19:53:19 · 571 阅读 · 0 评论