我判断陈述时出错了
错误:PLS-00103:符号" ELSE" (开始案例宣告结束 如果loop mod null pragma raise return select,则退出goto 同时更新 << 继续关闭当前删除获取锁定插入打开回滚 savepoint set sql execute commit forall merge pipe purge 行:134
FETCH date_time into r_pernr,r_aedtm,r_tprog,r_nobeg,r_noend,r_sollz,r_pabeg,r_paend,r_pdunb;
IF l_time_s < r_nobeg THEN
raise e_req_hour_error2;
ELSE IF l_time_e > r_noend THEN
raise e_req_hour_error3;
ELSE IF l_time_e IS NULL AND l_time_s IS NULL THEN
l_time := r_sollz;
ELSE IF l_time_s IS NOT NULL AND l_time_e IS NULL THEN
IF l_time_s >= r_nobeg AND l_time_s <= r_pabeg THEN
l_time := r_pabeg - l_time_s + ( r_noend - r_paend );
ELSE IF l_time_s >= r_paend AND l_time_s <= r_noend THEN
l_time := r_noend - l_time_s;
ELSE IF l_time_s > r_pabeg AND l_time_s < r_paend THEN
l_time := r_noend - r_paend;
END IF;
ELSE IF l_time_s IS NULL AND l_time_e IS NOT NULL THEN
IF l_time_e <= r_pabeg THEN
l_time := l_time_e - r_pabeg;
ELSE IF l_time_e <= r_noend AND l_time_e >= r_nobeg THEN
l_time := r_noend - r_paend;
ELSE IF l_time_e >= r_paend AND l_time_e <= r_noend THEN
l_time := r_pabeg - r_nobeg + ( l_time_e - r_paend );
END IF;
ELSE IF l_time_s IS NOT NULL AND l_time_e IS NOT NULL THEN
IF l_time_s >= r_nobeg AND l_time_e <= r_pabeg THEN
l_time := l_time_e - l_time_s;
ELSE IF l_time_s >= r_nobeg AND l_time_e >= r_pabeg AND l_time_e <= r_paend THEN
l_time := r_pabeg - l_time_s;
ELSE IF l_time_s >= r_pabeg AND l_time_e <= r_noend THEN
l_time := l_time_e - r_paend;
ELSE IF l_time_s >= r_paend AND l_time_e <= r_noend THEN
l_time := l_time_e - l_time_s;
END IF;
IF l_time = 0 THEN
raise e_req_hour_error4;
END IF;
END IF;
答案 0 :(得分:2)
语法错误是因为在Oracle中if else应该采用如下所示的格式。
IF condition1 THEN
{...statements to execute when condition1 is TRUE...}
ELSIF condition2 THEN
{...statements to execute when condition2 is TRUE...}
ELSE
{...statements to execute when both condition1 and condition2 are FALSE...}
END IF;