The following lines contain the word 'select', 'insert', 'update' or 'delete':
select organization_id
Bulk Collect
into l_all_orgs
from MTL_PARAMETERS;
select organization_id
into p_organization_id
from MTL_PARAMETERS
where organization_code = p_organization_code;
select
PULL_SEQUENCE_ID,
KANBAN_CARD_ID,
INVENTORY_ITEM_ID,
ORGANIZATION_ID,
SUBINVENTORY_NAME,
( select Meaning from mfg_lookups where Lookup_type = 'MTL_KANBAN_SUPPLY_STATUS' and lookup_code=MKC.SUPPLY_STATUS) SUPPLY_STATUS,
( select Meaning from mfg_lookups where Lookup_type = 'MTL_KANBAN_CARD_STATUS' and lookup_code=MKC.CARD_STATUS) CARD_STATUS,
( select Meaning from mfg_lookups where Lookup_type = 'MTL_KANBAN_CARD_TYPE' and lookup_code=MKC.KANBAN_CARD_TYPE) KANBAN_CARD_TYPE,
( select Meaning from mfg_lookups where Lookup_type = 'MTL_KANBAN_SOURCE_TYPE' and lookup_code=MKC.SOURCE_TYPE) SOURCE_TYPE,
KANBAN_SIZE,
CURRENT_REPLNSH_CYCLE_ID
FROM MTL_KANBAN_CARDS MKC
WHERE ORGANIZATION_ID = p_organization_id
-- AND PULL_SEQUENCE_ID = l_pull_sequence_id
AND LAST_UPDATE_DATE > l_last_run_date;
Select
PULL_SEQUENCE_ID,
ORGANIZATION_ID
FROM MTL_KANBAN_PULL_SEQUENCES
where ORGANIZATION_ID = p_organization_id
and kanban_plan_id = -1 ;
select Actual_demand_run_date
into l_last_run_date
from flm_ekb_run_details
where organization_id = p_organization_id;
Insert into FLM_EKB_ACT_SNAPSHOT(
ORGANIZATION_ID
,PULL_SEQUENCE_ID
,KANBAN_CARD_ID
,REPLENISHMENT_ACTIVITY_ID
,REPLENISHMENT_CYCLE_ID
,REPLENISHMENT_DATE
,RECEIVED_ACTIVITY_ID
,RECEIVED_DATE
,LEAD_TIME
,KANBAN_SIZE
,Creation_date
,Created_by
,Last_update_date
,Last_updated_by
,Last_Update_login
)
Select
c_card_activity.organization_id,
c_card_activity.pull_sequence_id,
c_card_activity.kanban_card_id,
min(KANBAN_ACTIVITY_ID),
REPLENISHMENT_CYCLE_ID,
null,
null,
Null,
0,
null,
sysdate,
G_USER_ID,
sysdate,
G_USER_ID,
null
FROM MTL_KANBAN_CARD_ACTIVITY MKCA
WHERE KANBAN_CARD_ID = c_card_activity.kanban_card_id
AND ( ( SUPPLY_STATUS >= 4 AND SUPPLY_STATUS < 5 AND SOURCE_TYPE <> 3 ) OR
( SUPPLY_STATUS >= 5 AND SUPPLY_STATUS < 6 AND SOURCE_TYPE = 3 )
) -- Supply status Inprocess for Intra org kanban and Empty for other kanban types
AND CREATION_DATE > l_last_run_date
group by c_card_activity.organization_id, c_card_activity.pull_sequence_id,c_card_activity.kanban_card_id , REPLENISHMENT_CYCLE_ID
Order by REPLENISHMENT_CYCLE_ID;
Update FLM_EKB_ACT_SNAPSHOT FEAS
Set ( REPLENISHMENT_DATE , KANBAN_SIZE ) = (Select CREATION_DATE,KANBAN_SIZE
from MTL_KANBAN_CARD_ACTIVITY MKCA
where MKCA.Kanban_Activity_id = FEAS.REPLENISHMENT_ACTIVITY_ID)
where REPLENISHMENT_DATE is null;
select count(*)
into l_row_count
from flm_ekb_run_details
where organization_id = p_organization_id;
insert into flm_ekb_run_details(
Organization_id,
Actual_demand_run_date,
Last_demand_request_id,
Lead_time_run_date,
Last_lead_time_request_id,
Health_status_run_date,
Last_Health_status_request_id,
Unmoved_cards_run_date,
Last_Unmoved_cards_request_id,
creation_date,
created_by,
last_updated_by,
last_update_date,
last_update_login
)
values(p_organization_id
,sysdate
,G_REQUEST_ID
,null
,null
,null
,null
,null
,null
,sysdate
,G_USER_ID
,G_USER_ID
,sysdate
,G_LOGIN_ID
);
Update flm_ekb_run_details
set Actual_demand_run_date = sysdate,
Last_demand_request_id = G_REQUEST_ID,
last_updated_by = G_USER_ID,
last_update_date = sysdate,
last_update_login = G_LOGIN_ID
where organization_id = p_organization_id;
select count(*)
into l_row_count
from flm_ekb_act_snapshot
where organization_id = p_organization_id;