数据库
首页 > 数据库> > Mysql(CAST)和Oracle(to_char)应用

Mysql(CAST)和Oracle(to_char)应用

作者:互联网

Oracle to_char  mysql cast
select * from taxpayer_subject_info f, tax_land_info LEFT JOIN document d ON tax_land_info.doc_id = to_char(d.id AS CHAR)
select * from taxpayer_subject_info f, tax_land_info LEFT JOIN document d ON tax_land_info.doc_id = CAST(d.id AS CHAR) 

当有时报字符长度超出范围的时候 可以考虑CAST(d.id AS CHAR(50));

 

Mysql中

Cast(字段名 as 转换的类型 ),其中类型可以为:

CHAR[(N)] 字符型 
DATE  日期型
DATETIME  日期和时间型
DECIMAL  float型
SIGNED  int
TIME  时间型

 

Oracle中

to_char(date,'格式');

to_char(number,'格式');

to_char(salary,'$99,99');

 

标签:info,CHAR,land,tax,char,CAST,Oracle,id
来源: https://www.cnblogs.com/innocenter/p/14637248.html