oracle 存储过程里的if else

我这里想用if else,如果S_date=4;跑p_temp这个过程,如果S_date不等于4就跑p_temp2这个过程,应该怎么写,不需要输出输入。谢谢
create or replace procedure p_run_temp is
S_DATE=to_number(to_char(sysdate,'4');
if S_date=4;
begin
p_temp();
end ;

第1个回答  推荐于2018-02-11
create or replace procedure p_run_temp as
S_DATE:=to_number(to_char(sysdate,'d'),'9');--查询下to_char这个函数是否有问题
begin
if S_date=4 then
p_temp();
else
p_temp2();
end if ;
end p_run_temp;

存储过程一般用AS。而且题中的存储过程语法也有问题。本回答被提问者和网友采纳
第2个回答  2015-11-25
if  S_date = 4 then 
    p_temp();
elsif  S_date != 4 then
    p_temp2();
end if;

第3个回答  2015-11-25
if S_date=4 then
p_temp();
else
p_temp2();
end if;