IF (Type != 'p' and Type != 'T') or (Source != 'N' and Source != 'P' and Source != 'G' and Source != 'D')
THEN
szTemp := '1';怎么不对啊,逻辑与&&和逻辑或||在存储过程中怎么写啊。
THEN
szTemp := '1';怎么不对啊,逻辑与&&和逻辑或||在存储过程中怎么写啊。
调试欢乐多
2、&& || 对应and 和 or。
3、IF ....THEN ...END IF,应该有 END IF
--oracle中变量的命名最好不要使用oracle保留字:
SQL> select keyword
2 from v_$reserved_words
3 /
KEYWORD
------------------------------
MODE
BULK
WAIT
SESSIONTIMEZONE
EXTENTS
SESSION_CACHED_CURSORS
SET_TO_JOIN
PUSH_SUBQ
......--闰年判断的例子:
create or replace procedure pro_leap_year(year_in in number)
as
v_mod1 number(4) :=mod(year_in,4);
v_mod2 number(4) :=mod(year_in,100);
v_mod3 number(4) :=mod(year_in,400);
begin
if ((v_mod1=0 and v_mod2<>0) or v_mod3=0) then
--逻辑&&:v_mod1=0 and v_mod2<>0
--逻辑||:(v_mod1=0 and v_mod2<>0) or v_mod3=0
dbms_output.put_line(year_in||' is a leap year');
else dbms_output.put_line(year_in||' is not a leap year');
end if;
exception
when others then
dbms_output.put_line(sqlerrm);
end pro_leap_year;
/
--
if 语句应该是这样的:
1.if .. then ... else ... end if;
2.if .. then ... elsif ... then ... else ... end if;