oracle创建视图时一些问题
这几天创建视图的时候,遇见的问题。
一:创建视图的时候Oracle-报错:文字与格式字符串不匹配(ORA-01861)
我创建的时候用的 是to_date
然后我改成了to_char
select XYPTGUID as id,C_006200040001 as cf_wsh, C_006200040002 as cf_mc, C_006200040003 as cf_type, C_006200040004 as cf_sy,C_006200040005 as cf_yj,name,uscc,C_006200040012 as cf_legal_name, C_006200040013 as cf_jg,to_char(C_006200040014,'YYYY-MM-DD') as cf_jdrq, C_006200040016 as cf_org,to_char(C_006200040015,'YYYY-MM-DD') as cf_qx, to_char(C_006200040019,'YYYY-MM-DD') as cf_gxrq from T_00620004 union all
就已经更改成功了。无报错。
二:创建视图的时候,视图所需要的表字段,在一些表字段中没有。但是字段属性又是统一的,这个时候,就可以用as、
select XYPTGUID as id,name ,uscc,C_010900330002 as legal_name,to_char(XYPT_ENTRY_DATE,'yyyy-MM-dd') as build_date ,'企业' as market_type,'工商局' as register_org from T_01090033 union all
查询完后就会有这个字段。