Case......end 语句
insert into bnd_consumption_demand
(demand_id,
INVENTORY_ITEM_ID,
DEMAND_QTY,
ORIGINAL_SOURCE_TYPE,
original_ref_number,
PROCESS_STATUS,
CREATED_BY)
values
(v_demand_id,
r_wo.inventory_item_id,
r_wo.total_dd_qty,
(case when r_wo.wip_entity_id > 0 then 3 when r_wo.wip_entity_id < 0 then 2 end),
r_wo.wip_entity_id,
0,
fnd_global.USER_ID);
-------------------------------------------------------------------------
update bnd_wo_consumptions
set remain_qty = remain_qty - v_consumption_qty,
consumption_status = (case when(remain_qty - v_consumption_qty) > 0 then 0 else 1 end),
last_update_date = sysdate
case when userenv('CLIENT_INFO') is not null then
(select gb.attribute1
from gl_sets_of_books gb
where set_of_books_id = (select set_of_books_id)
from financials_system_params_all
where org_id =userenv('CLIENT_INFO'))
and rownum =1 )
else 1 end