declare
i_product_id inventory.product_id%type;
i_product_description inventory.product_description%type;
i_product_status inventory.product_status%type;
i_std_shipping_qty inventory.std_shipping_qty%type;
be
gin //
SQL语句,将查询出来的值放到定义的变量中
select product_id, product_description, product_status, std_shipping_qty
into i_product_id, i_product_description, i_product_status, i_std_shipping_qty
From inventory where product_id=(
select product_id f
rom contract_item where contract_no=
&&contract_no and item_no=&
amp;&item_no
);
if i_product_status='shipped' then
update contract_item set arrival_date=
Sysdate+7 contract_no=&&contract_no and item_no=&&item_no;
//这里的els
eif 是连着写的
elseif i_product_status='ordered'then
updatecontract_item
setarrival_date=add_months(sysdate,1)//加一个月
whereitem_no=&&itemnoandcontract_no=&&contractno;
else
updatecontract_item
setarrival_date=add_months(sysdate,2)
whereitem_no=&&itemnoandcontract_no=&&contractno;
insertintoorders
values(100,i_product_id,i_std_shipping_qty);
end if;
end if;
commit;
end;