发布网友 发布时间:2022-04-19 23:59
共5个回答
懂视网 时间:2022-04-08 22:36
v_month int:=2; begin if v_month>=1 and v_month<=3 then dbms_output.put_line(‘春季‘); elsif v_month>=4 and v_month<=6 then dbms_output.put_line(‘夏季‘) ; elsif v_month>=7 and v_month<=9 then dbms_output.put_line(‘秋季‘) ; elsif v_month>=10 and v_month<=12 then dbms_output.put_line(‘冬季‘) ; else dbms_output.put_line(‘你输入的季节不存在!‘) ; end if; end;输出结果为:
春季
-----------------------------------但使龙城飞将在,不教胡马度阴山
Oracle中的if...then...elsif
标签:
热心网友 时间:2022-04-08 19:44
if 条件 then
语句
elsif 条件 then
语句
else
语句
end if;
热心网友 时间:2022-04-08 21:02
if a is not null or b != '01' then
......
elsif (b =1 or b=2) and a is null then
......
end if;追问if 或者是 elsif 中再写个if 要结束的话,还用不用在if下写个end if?
追答用,这些都是成对出现的,例如:
if a is not null or b != '01' then
......
elsif (b =1 or b=2) and a is null then
if b=1 then
......
end if;
......
end if;
热心网友 时间:2022-04-08 22:36
if 1=1 then
--
eles
--
end if ;追问能写个存储过程带IF的例子么
追答create or replace procere update_ply_base_status is
vOrderId TB_TSWWW_PLY.C_ORDERID_RELATE%TYPE;
vProdNo TB_TSWWW_PLY.c_Prod_No%TYPE;
vFinS TB_TSWWW_PLY.c_Fin_Stat%TYPE;
vState TB_TSWWW_PLY.c_Stat%TYPE;
CURSOR CUR_EDR IS
select t.c_orderid_relate,
t.c_prod_no,
t.c_fin_stat,
t.c_stat
from TB_TSWWW_PLY t where t.t_crt_date>=sysdate-1/24 or t.t_upd_date>=sysdate-1/24;
BEGIN
BEGIN
OPEN CUR_EDR;
LOOP
FETCH CUR_EDR
INTO vOrderId, vProdNo, vFinS, vState;
EXIT WHEN CUR_EDR%NOTFOUND;
IF vFinS='0' and vState='1' THEN
BEGIN
IF substr(vOrderId,0,2)='00' THEN
update t_ply_base a set a.c_order_status='005' where a.c_orderid_relate=vOrderId;
ELSE
update t_ply_base a set a.c_order_status='005' where a.c_orderid_relate=vOrderId and a.c_prod_no=vProdNo;
END IF;
END;
END IF;
IF vFinS='1' and vState='1' THEN
BEGIN
IF substr(vOrderId,0,2)='00' THEN
update t_ply_base a set a.c_order_status='008',a.c_payment_status='1' where a.c_orderid_relate=vOrderId;
ELSE
update t_ply_base a set a.c_order_status='008',a.c_payment_status='1' where a.c_orderid_relate=vOrderId and a.c_prod_no=vProdNo;
END IF;
END;
END IF;
END LOOP;
CLOSE CUR_EDR;
COMMIT;
END;
end update_ply_base_status;
热心网友 时间:2022-04-09 00:28
恩 然后呢!