2024-11-22 19:19:20
2024-11-22 10:50:08
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;
2024-11-22 19:38:54
能写个存储过程带IF的例子么
create or replace procedure 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;
2024-11-22 14:28:55