0

有人可以帮帮我吗?我不确定为什么这段代码一直不执行:

'0' || CASE
WHEN (EAmain.ActivityStopMin - EAmain.ActivityStartMin) < 0 THEN         (DATEDIFF(hh,EAmain.ActivityStartTimeHours || ':' ||     EAmain.ActivityStartTimeMin,EAmain.ActivityStopTimeHours || ':' ||     EAmain.ActivityStopTimeMin)-1)
WHEN (EAmain.ActivityStopMin - EAmain.ActivityStartMin) >= 0 THEN
(DATEDIFF(hh,EAmain.ActivityStartTimeHours || ':' ||     EAmain.ActivityStartTimeMin,EAmain.ActivityStopTimeHours || ':' ||     EAmain.ActivityStopTimeMin))
END || ':' || (DATEDIFF(n,EAmain.ActivityStartTimeHours || ':' ||     EAmain.ActivityStartTimeMin,EAmain.ActivityStopTimeHours || ':' ||     EAmain.ActivityStopTimeMin)#60) || '0' AS ActivityTotalTime,

编辑:我找到了错误代码,这里是:

错误 #5540:SQLCODE:-29 消息:在适用的表中找不到字段 'EAMAIN.ACTIVITYSTOPMIN' THEN SUBSTR (ActivityTotalTime, ?, ?) WHEN LEN (ActivityTotalTime) = ? THEN ActivityTotalTime END AS ActivityTotalTime , Discipline FROM (SELECT Demographics . Name , Visits . Start_Time , Visits . Stop_Time , Visits . Visit_Date , Visits . Total_Time , EAmain . ActivityStartTime , EAmain . ActivityStopTime , ? || CASE WHEN (EAmain . ActivityStopMin -

再次编辑!:此代码是在 CASE 语句之前实现的,并且有效:

'0' || DATEDIFF(hh,EAmain.ActivityStartTimeHours || ':' ||    
EAmain.ActivityStartTimeMin,EAmain.ActivityStopTimeHours || ':' ||     
EAmain.ActivityStopTimeMin) || ':' || (DATEDIFF(n,EAmain.ActivityStartTimeHours || ':' || 
EAmain.ActivityStartTimeMin,EAmain.ActivityStopTimeHours || ':' ||    
EAmain.ActivityStopTimeMin)#60) || '0' AS ActivityTotalTime,
4

1 回答 1

1

在你得到的最后一行EAmain.ActivityStartTimeMin,EAmain.ActivityStopTimeHours。那个逗号好像放错了地方。)#60)最后一行的几个字符也是如此。

EAmain.ACTIVITYSTOPMIN 不存在。:) 我在您的错误消息中看到 EMain 不是表而是查询。确保在查询中也选择了该字段。

于 2012-08-31T20:27:47.803 回答