当前位置: 移动技术网 > IT编程>数据库>Oracle > oracle迁移到mysql数据库的简单对比

oracle迁移到mysql数据库的简单对比

2018年09月13日  | 移动技术网IT编程  | 我要评论

那妞最强2,梁光烈是谁的儿子,河南省注册会计师网

oracle迁移到mysql的简单对比

oracle mysql
||

‘dept_’||name

concat(str1,str2,…)) ,参数含有null,会返回null,所以对oracle里面参数要使用ifnull函数判断是否为空

 

concat('dept_',ifnull(name,''))
 

decode(条件,值1,返回值1,值2,返回值2,...值n,返回值n,缺省值)


decode(city,0,'否',1,'是')
case when then else end ? ? ? ? ? else后面是没有对应条件,设置的值

case city when 0 then '否' when 1 then '是' end

sysdate ?获得现在时间

now()或者sysdate()

nvl (expr1, expr2):expr1为null,返回expr2;不为null,返回expr1。注意两者的类型要一致?

ifnull()

nvl2 (expr1, expr2, expr3) :expr1不为null,返回expr2;为null,返回expr3。expr2和expr3类型不同的话,expr3会转换为expr2的类型?



nvl2(status,1,0)

if()和ifnull()配合实现

if(expr1,expr2,expr3)?expr1 为0或者null或者false,则返回 expr3 ; 否则,返回expr2;


if(ifnull(status,false),1,0)

to_char(date,'yyyy-mm-dd hh24:mm:ss')

to_data(date.time,'yyyy-mm-dd?')

1.?date_format(date,'%y-%m-%d')

1.?tr_to_date(date,'%y-%m-%d')?

列名 desc?nulls last?

?my sql 默认null 为最小
order by order_col [asc|desc] nulls [first|last] order by if(isnull(my_field),1,0),my_field;

trunc()截数字时?

?truncate()代替

to_number(str)?

cast("123" as signed integer)

2个日期相减(d1-d2)

datediff(date1,date2)

rownum

select @rownum:=@rownum+1 as rownum, table.* from (select @rownum:=0) r,table;

 


如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网