日期:2014-05-16  浏览次数:20894 次

oracle创建视图语句报错的问题
create or replace view v_inspection_map(deviceid,planStarttime,planendtime,zoneID,deviceTypeID,stationNO,typename,stationName,longitude,latitude,recorderNum,finishedNum,nofinishedNum,outofTimeNum) as select b.deviceID,min(a.planStartTime),max(a.planEndTime),b.zoneID,b.deviceTypeID,b.stationNO,c.typeName,b.stationName,b.j_longitude,b.j_latitude,count(a.recorderID),sum((case when(a.actualEndTime>0) then 1 else 0 end)),sum((case when((a.actualEndTime=0) and (a.planEndTime>(unix_timestamp(cast(contact(year(curdate()),'-',month(curdate()),'-01') as date))*1000))) then 1 else 0 end)),sum((case when((a.actualEndTime=0) and (a.planEndTime<(unix_timestamp(cast(concact(year(curdate()),'-',month(curdate()),'-01') as date)) * 1000))) then 1 else 0 end)) from inspectionrecorder a,devicebaseinfo b,devicetype c where a.deviceID = b.deviceID and a.deleteFlag<>-1 and b.deviceTypeID = c.deviceTypeID group by a.deviceID;


这条语句报了unix_timestamp标识符无效的错误,我知道这是在mysql才有的时间戳函数,那请问在oracle中这个地方我该怎么改?急。。。
------解决方案--------------------
试试systimestamp
------解决方案--------------------
select 
(to_date('2013-12-20','yyyy-mm-dd')- to_date('1970-01-01 00:00:00','yyyy-mm-dd hh24:mi:ss'))* 24*60*60
as mon_milli from dual;