1.主键自增
(1)Mysql可以给表主键设置自增,添加数据时不需要设置id,数据库会自动设置id;
(2)Oracle没有主键自增,如果需要设置自增,需要给表添加自增序列;
添加数据时,从序列中取下一个值作为id;
2.系统时间
(1)Mysql中系统时间为now(),oracle中系统时间为sysdate
3.Like其后写法
(1)Mysql写法:like CONCAT('%', #{title}, '%')
(2)Oracle写法:like '%'||#{title}||'%' (oracle中contact只能链接两个参数)
4.分页
(1)Mysql写法:select * from table limit startindex , pagesize
(2)Oracle写法:select * from (select * , rownum as rn from table) where rn between startindex , endindex
5.时间条件
(1)Mysql写法:where create_date > #{beginDate}
(2)Oracle写法:
where to_char(create_date , ’yyyy-MM-dd HH:mm:ss’) > #{beginDate}
*传输的beginDate为字符串格式,mysql中可以直接使用时间字段进行比较,Oracle需要使用to_char函数把时间字段转换为一定格式的字符串