我有这段代码嵌入在我的sql中。出于某种原因,我看到每次我的最后一个ELSE块被执行时。这是我的代码:
IF REGEXP_LIKE (UPPER(V_TEMP_DEPT_1),
'DEP|DPT$|ABT|DIP.|DIPART|AFDEL|AVDEL|AVD.|DIV|PGRD|PGP|PPG|FAC|AMU|LAB|WING|
UNIT|SERV|AFT|CENT|CLIN|KLIN|ETHICS COM|EC|IRB') THEN
V_DEPT_N := V_TEMP_DEPT_1;
V_ADDR_LINE1:= NULL;
ELSE
IF REGEXP_LIKE (UPPER(V_TEMP_DEPT_2),
'DEP|DPT$|ABT|DIP.|DIPART|AFDEL|AVDEL|AVD.|DIV|PGRD|PGP|PPG|FAC|AMU|LAB|WING|
UNIT|SERV|AFT|CENT|CLIN|KLIN|ETHICS COM|EC|IRB') THEN
V_DEPT_N := V_TEMP_DEPT_2;
V_ADDR_LINE2:= NULL;
ELSE
IF REGEXP_LIKE (UPPER(V_TEMP_DEPT_3),
'DEP|DPT$|ABT|DIP.|DIPART|AFDEL|AVDEL|AVD.|DIV|PGRD|PGP|PPG|FAC|AMU|LAB|WING|
UNIT|SERV|AFT|CENT|CLIN|KLIN|ETHICS COM|EC|IRB') THEN
V_DEPT_N := V_TEMP_DEPT_3;
V_ADDR_LINE3:= NULL;
ELSE
IF REGEXP_LIKE (UPPER(V_TEMP_DEPT_4),
'DEP|DPT$|ABT|DIP.|DIPART|AFDEL|AVDEL|AVD.|DIV|PGRD|PGP|PPG|FAC|AMU|LAB|WING|
UNIT|SERV|AFT|CENT|CLIN|KLIN|ETHICS COM|EC|IRB') THEN
V_DEPT_N := V_TEMP_DEPT_4;
V_ADDR_LINE4:= NULL;
ELSE
-- The below line always gets executed.
V_DEPT_N:= NULL;
END IF;
END IF;
END IF;
END IF;
任何想法我做错了什么?
答案 0 :(得分:0)
IF REGEXP_LIKE (UPPER(V_TEMP_DEPT_1),
'DEP|DPT$|ABT|DIP.|DIPART|AFDEL|AVDEL|AVD.|DIV|PGRD|PGP|PPG|FAC|AMU|LAB|WING|
UNIT|SERV|AFT|CENT|CLIN|KLIN|ETHICS COM|EC|IRB') THEN
V_DEPT_N := V_TEMP_DEPT_1;
V_ADDR_LINE1:= NULL;
ELSIF REGEXP_LIKE (UPPER(V_TEMP_DEPT_2),
'DEP|DPT$|ABT|DIP.|DIPART|AFDEL|AVDEL|AVD.|DIV|PGRD|PGP|PPG|FAC|AMU|LAB|WING|
UNIT|SERV|AFT|CENT|CLIN|KLIN|ETHICS COM|EC|IRB') THEN
V_DEPT_N := V_TEMP_DEPT_2;
V_ADDR_LINE2:= NULL;
ELSIF REGEXP_LIKE (UPPER(V_TEMP_DEPT_3),
'DEP|DPT$|ABT|DIP.|DIPART|AFDEL|AVDEL|AVD.|DIV|PGRD|PGP|PPG|FAC|AMU|LAB|WING|
UNIT|SERV|AFT|CENT|CLIN|KLIN|ETHICS COM|EC|IRB') THEN
V_DEPT_N := V_TEMP_DEPT_3;
V_ADDR_LINE3:= NULL;
ELSIF REGEXP_LIKE (UPPER(V_TEMP_DEPT_4),
'DEP|DPT$|ABT|DIP.|DIPART|AFDEL|AVDEL|AVD.|DIV|PGRD|PGP|PPG|FAC|AMU|LAB|WING|
UNIT|SERV|AFT|CENT|CLIN|KLIN|ETHICS COM|EC|IRB') THEN
V_DEPT_N := V_TEMP_DEPT_4;
V_ADDR_LINE4:= NULL;
ELSE
-- Now this works!!
V_DEPT_N:= NULL;
END IF;