mysql 转 oracle

1.oracle批量插入

1<insert id="save"> 2 insert into t_ac_user_role 3 ( 4 userroleid,<!--主键--> 5 roleid, 6 userid 7 ) 8 select seq_ac_user_role.nextval <!--主键自增序列--> ,cd.* from(        <foreach collection="entity.ids" item="item" index="index" separator="union all">         SELECT #{entity.roleid}, #{item}         from dual        </foreach>     )cd </insert>

2.oracle 分页

1 select * from( 2 SELECT ROWNUM AS rowno,r.* FROM ( 3 4 ) r 5 <if test="entity.offset != null and entity.limit != null"> 6 <![CDATA[ where ROWNUM <= ${entity.offset}+${entity.limit} ]]> 7 </if> 8 ) table_alias 9 <if test="entity.offset != null and entity.limit != null"> 10 <![CDATA[ WHERE table_alias.rowno > #{entity.offset} ]]> 11 </if>

3.装换成货币金额

select to_char(tax_amount,'FM999,999,999,999,990.00') from dual

4.代替mysql的truncate

1ROUND(sum(tax_amount),2) 代替 2truncate(SUM(tax_amount),2)
点赞
收藏

评论区

加载中...

相关推荐

MySQL:[Err] 1292 - Incorrect datetime value: ‘0000-00-00 00:00:00‘ for column ‘CREATE_TIME‘ at row 1

文章目录问题用navicat导入数据时,报错:原因这是因为当前的MySQL不支持datetime为0的情况。解决修改sql\mode:sql\mode:SQLMode定义了MySQL应支持的SQL语法、数据校验等,这样可以更容易地在不同的环境中使用MySQL。全局s

Oracle 分组与拼接字符串同时使用

SELECTT.,ROWNUMIDFROM(SELECTT.EMPLID,T.NAME,T.BU,T.REALDEPART,T.FORMATDATE,SUM(T.S0)S0,MAX(UPDATETIME)CREATETIME,LISTAGG(TOCHAR(

MySQL部分从库上面因为大量的临时表tmp_table造成慢查询

背景描述Time:20190124T00:08:14.70572408:00User@Host:@Id:Schema:sentrymetaLast_errno:0Killed:0Query_time:0.315758Lock_

手写Java HashMap源码

HashMap的使用教程HashMap的使用教程HashMap的使用教程HashMap的使用教程HashMap的使用教程22

2020年前端实用代码段,为你的工作保驾护航

有空的时候,自己总结了几个代码段,在开发中也经常使用,谢谢。1、使用解构获取json数据let jsonData  id: 1,status: "OK",data: 'a', 'b';let  id, status, data: number   jsonData;console.log(id, status, number )

mysql设置时区

mysql设置时区mysql\_query("SETtime\_zone'8:00'")ordie('时区设置失败,请联系管理员!');中国在东8区所以加8方法二:selectcount(user\_id)asdevice,CONVERT\_TZ(FROM\_UNIXTIME(reg\_time),'08:00','0