那年秋天
oracle如何使⽤if,触发器中如何使⽤IF条件偶写的⼀个trigger就是不能按我的意思更新,请⼤侠们帮忙看看是哪的问题?谢谢!
红楼梦刘姥姥人物分析更新结果如下
打印机怎么pn qty receive_quantity status
a 500 500 clo
a 500 500 clo
a 500 500 clo
我要的结果是
pn qty receive_quantity status
a 500 500 clo
a 500 500 clo
a 500 200 open
电梯采购
当输⼊rcv_t.quantity 1200时把它拆分到app表更新receive_quantity。
CREATE OR REPLACE TRIGGER rcv_inrtion
BEFORE INSERT
ON DEVS.RCV_T FOR EACH ROW
DECLARE
p_app_part_number VARCHAR2 (200);
p_app_qty NUMBER;
p_app_receive_quantity NUMBER;
感冒疏风丸
p_count_pn NUMBER;
p_rcv_part_number VARCHAR2 (200) := :NEW.part_number;
p_rcv_quantity VARCHAR2 (200) := :NEW.quantity;
rcv_q number;
v_value number;
CURSOR cur_app
IS
SELECT part_number, qty, receive_quantity
FROM devs.app
WHERE part_number = p_rcv_part_number AND status = 'open'
order by creation_date
FOR UPDATE;
纳罕是什么意思BEGIN清宫长春胶囊
SELECT COUNT (*)
INTO p_count_pn
FROM devs.app
WHERE part_number = p_rcv_part_number AND status = 'open';
if p_count_pn = 0 then
inrt v_t(transaction_id, part_number, item_description, quantity, creation_date)
values(:ansaction_id, :new.part_number, :new.item_description, :new.quantity, :ation_date); inrt v_excess(transaction_id, part_number, item_description, excess_quantity, creation_date) values(:ansaction_id, :new.part_number, :new.item_description, :new.quantity, :ation_date); el if p_count_pn > 0 then
OPEN cur_kanban_app;
loop
FETCH cur_app
INTO p_app_part_number, p_app_qty,
p_app_receive_quantity;
EXIT WHEN cur_app%NOTFOUND;
v_value := p_rcv_quantity;
loop
v_value := v_value - p_app_qty;
exit when v_value < p_app_qty;
if v_value > p_app_qty then
rcv_q := p_app_qty;
el if v_value < p_app_qty then
rcv_q := v_value;
end if;
end if;
end loop;
update devs.app
t receive_quantity = rcv_q, status = clo
where current of cur_kanban_app;
end loop;
clo cur_kanban_app;
end if;怎样制作红烧肉
end if;
end;