The following lines contain the word 'select', 'insert', 'update' or 'delete':
p_update_events IN NUMBER
);
p_update_events IN NUMBER,
p_ind IN NUMBER
);
select value
INTO l_utl_file_dir
FROM v$parameter
WHERE name = 'utl_file_dir';
p_update_events IN NUMBER,
x_token_tbl OUT NOCOPY Error_Handler.Token_Tbl_Type,
x_err_msg OUT NOCOPY VARCHAR2,
x_return_status OUT NOCOPY VARCHAR2
) IS
-- Select all the operations in the routing that do NOT have a FROM
-- operation. These are valid starting points for multiple paths (i.e.
-- it includes feeder lines)
/* CURSOR start_ops_cur IS
SELECT DISTINCT from_op_seq_id start_op_seq_id,
from_seq_num start_op_seq_num,
nvl(yield, 1) start_op_yield
FROM bom_operation_networks_v bonv,
bom_operation_sequences bos
WHERE bonv.routing_sequence_id = p_routing_sequence_id
AND bonv.operation_type = p_operation_type
AND bonv.transition_type <> 3
AND bonv.from_op_seq_id = bos.operation_sequence_id
AND NOT EXISTS (SELECT NULL
FROM bom_operation_networks net
WHERE net.to_op_seq_id = bonv.from_op_seq_id
AND net.transition_type <> 3)
ORDER BY from_seq_num;*/
SELECT DISTINCT from_op_seq_id start_op_seq_id,
from_seq_num start_op_seq_num,
DECODE(borv.cfm_routing_flag, 3, (DECODE(bos.operation_yield_enabled, 1, NVL(bos.yield, 1), 1)), NVL(bos.yield, 1)) start_op_yield
FROM bom_operation_networks_v bonv,
bom_operation_sequences bos,
bom_operational_routings_v borv
WHERE bonv.routing_sequence_id = borv.routing_Sequence_id
AND bonv.routing_sequence_id = p_routing_sequence_id
AND bonv.operation_type = p_operation_type
AND bonv.transition_type <> 3
AND bonv.from_op_seq_id = bos.operation_sequence_id
AND NOT EXISTS (SELECT NULL
FROM bom_operation_networks net
WHERE net.to_op_seq_id = bonv.from_op_seq_id
AND net.transition_type <> 3)
ORDER BY from_seq_num;
SELECT null FROM DUAL
WHERE exists
( SELECT null FROM bom_operation_networks_v bonv
WHERE bonv.routing_sequence_id = p_routing_sequence_id
AND bonv.operation_type = p_operation_type
AND bonv.transition_type <> 3 );
SELECT cfm_routing_flag
FROM BOM_OPERATIONAL_ROUTINGS bor
WHERE bor.routing_sequence_id = p_routing_sequence_id;
SELECT COUNT(*) FROM bom_operation_networks
WHERE from_op_seq_id IN
( SELECT operation_sequence_id FROM bom_operation_sequences
WHERE routing_sequence_id = p_rtg_seq_id )
OR to_op_SEQ_ID IN
( SELECT operation_sequence_id FROM bom_operation_sequences
WHERE routing_sequence_id = p_rtg_seq_id );
SELECT nvl(cfm_routing_flag, 2)
FROM bom_operational_routings
WHERE routing_sequence_id = p_rtg_seq_id;
start_tbl.DELETE;
ntwk_op_tbl.DELETE;
main_ntwk_op_tbl.DELETE;
prim_path_tbl.DELETE;
rework_effect_tbl.DELETE;
calc_primary_network(p_routing_sequence_id,p_operation_type,p_update_events);
ntwk_op_tbl.DELETE;
prim_path_tbl.DELETE;
rework_effect_tbl.DELETE;
calc_feeder_network(p_routing_sequence_id,p_operation_type,p_update_events, i);
start_tbl.DELETE;
ntwk_op_tbl.DELETE;
main_ntwk_op_tbl.DELETE;
prim_path_tbl.DELETE;
rework_effect_tbl.DELETE;
p_update_events IN NUMBER
) IS
-- Select all the operations in the routing that do NOT have a FROM
-- operation. These are valid starting points for multiple paths (i.e.
-- it includes feeder lines)
/* CURSOR start_ops_cur IS
SELECT DISTINCT from_op_seq_id start_op_seq_id,
from_seq_num start_op_seq_num,
nvl(yield, 1) start_op_yield
FROM bom_operation_networks_v bonv,
bom_operation_sequences bos
WHERE bonv.routing_sequence_id = p_routing_sequence_id
AND bonv.operation_type = p_operation_type
AND bonv.transition_type <> 3
AND bonv.from_op_seq_id = bos.operation_sequence_id
AND NOT EXISTS (SELECT NULL
FROM bom_operation_networks net
WHERE net.to_op_seq_id = bonv.from_op_seq_id
AND net.transition_type <> 3)
ORDER BY from_seq_num;*/
SELECT DISTINCT from_op_seq_id start_op_seq_id,
from_seq_num start_op_seq_num,
DECODE(borv.cfm_routing_flag, 3, (DECODE(bos.operation_yield_enabled, 1, NVL(bos.yield, 1), 1)), NVL(bos.yield, 1)) start_op_yield
FROM bom_operation_networks_v bonv,
bom_operation_sequences bos,
bom_operational_routings_v borv
WHERE bonv.routing_sequence_id = borv.routing_Sequence_id
AND bonv.routing_sequence_id = p_routing_sequence_id
AND bonv.operation_type = p_operation_type
AND bonv.transition_type <> 3
AND bonv.from_op_seq_id = bos.operation_sequence_id
AND NOT EXISTS (SELECT NULL
FROM bom_operation_networks net
WHERE net.to_op_seq_id = bonv.from_op_seq_id
AND net.transition_type <> 3)
ORDER BY from_seq_num;
SELECT null FROM DUAL
WHERE exists
( SELECT null FROM bom_operation_networks_v bonv
WHERE bonv.routing_sequence_id = p_routing_sequence_id
AND bonv.operation_type = p_operation_type
AND bonv.transition_type <> 3 );
SELECT COUNT(*) FROM bom_operation_networks
WHERE from_op_seq_id IN
( SELECT operation_sequence_id FROM bom_operation_sequences
WHERE routing_sequence_id = p_rtg_seq_id )
OR to_op_SEQ_ID IN
( SELECT operation_sequence_id FROM bom_operation_sequences
WHERE routing_sequence_id = p_rtg_seq_id );
SELECT nvl(cfm_routing_flag, 2)
FROM bom_operational_routings
WHERE routing_sequence_id = p_rtg_seq_id;
SELECT cfm_routing_flag
FROM BOM_OPERATIONAL_ROUTINGS bor
WHERE bor.routing_sequence_id = p_routing_sequence_id;
start_tbl.DELETE;
ntwk_op_tbl.DELETE;
main_ntwk_op_tbl.DELETE;
prim_path_tbl.DELETE;
rework_effect_tbl.DELETE;
calc_primary_network(p_routing_sequence_id,p_operation_type,p_update_events);
ntwk_op_tbl.DELETE;
prim_path_tbl.DELETE;
rework_effect_tbl.DELETE;
calc_feeder_network(p_routing_sequence_id,p_operation_type,p_update_events, i);
start_tbl.DELETE;
ntwk_op_tbl.DELETE;
main_ntwk_op_tbl.DELETE;
prim_path_tbl.DELETE;
rework_effect_tbl.DELETE;
p_update_events IN NUMBER
)
IS
i NUMBER;
update bom_operation_sequences
set cumulative_yield = ntwk_op_tbl(i).cumulative_yield,
reverse_cumulative_yield = ntwk_op_tbl(i).rev_cumulative_yield,
net_planning_percent = ntwk_op_tbl(i).net_planning_pct
where operation_sequence_id = ntwk_op_tbl(i).operation_seq_id;
if p_update_events = 1 then
if p_operation_type = 2 then
update bom_operation_sequences
set cumulative_yield = ntwk_op_tbl(i).cumulative_yield,
reverse_cumulative_yield = ntwk_op_tbl(i).rev_cumulative_yield,
net_planning_percent = ntwk_op_tbl(i).net_planning_pct
where routing_sequence_id = p_routing_sequence_id
and process_op_seq_id = ntwk_op_tbl(i).operation_seq_id;
update bom_operation_sequences
set cumulative_yield = ntwk_op_tbl(i).cumulative_yield,
reverse_cumulative_yield = ntwk_op_tbl(i).rev_cumulative_yield,
net_planning_percent = ntwk_op_tbl(i).net_planning_pct
where routing_sequence_id = p_routing_sequence_id
and line_op_seq_id = ntwk_op_tbl(i).operation_seq_id;
SELECT to_op_seq_id next_op_seq_id,
to_seq_num next_op_seq_num,
transition_type
FROM bom_operation_networks_v bonv
WHERE routing_sequence_id = g_rtg_seq_id
AND from_op_seq_id = cv_start_op_seq_id
AND operation_type = g_op_type
-- AND transition_type <> 3
ORDER BY transition_type -- the order is important - primary, alternate and then rework loop shud be considered
, next_op_seq_num;
SELECT from_op_seq_id prev_op, planning_pct
FROM bom_operation_networks
WHERE to_op_seq_id = cv_to_seq_id
AND transition_type = 3;
SELECT bonv.transition_type, bonv.planning_pct
FROM bom_operation_networks_v bonv
WHERE routing_sequence_id = g_rtg_seq_id
AND bonv.from_op_seq_id = cv_start_op_seq_id
AND bonv.operation_type = g_op_type
AND bonv.transition_type <> 3;
p_update_events IN NUMBER
) IS
CURSOR end_op_cur IS
SELECT max(to_op_seq_id) end_op_seq_id
FROM bom_operation_networks_v bonv
WHERE bonv.routing_sequence_id = p_routing_sequence_id
AND bonv.operation_type = p_operation_type
AND bonv.transition_type <> 3
AND NOT EXISTS (SELECT NULL
FROM bom_operation_networks net
WHERE net.from_op_seq_id = bonv.to_op_seq_id
AND net.transition_type <> 3);
SELECT to_op_seq_id next_op_seq_id,
to_seq_num next_op_seq_num,
transition_type
FROM bom_operation_networks_v bonv
WHERE routing_sequence_id = p_routing_sequence_id
AND from_op_seq_id = cv_start_op_seq_id
AND operation_type = p_operation_type
AND transition_type <> 3
ORDER BY transition_type desc, next_op_seq_num;
SELECT to_op_seq_id next_op_seq_id,
to_seq_num next_op_seq_num,
transition_type
FROM bom_operation_networks_v bonv
WHERE routing_sequence_id = p_routing_sequence_id
AND from_op_seq_id = cv_op_seq_id
AND operation_type = p_operation_type
AND transition_type = 2
ORDER BY transition_type desc, next_op_seq_num;
SELECT to_op_seq_id, to_seq_num,
transition_type, nvl(planning_pct, 0) planning_pct,
from_op_seq_id, from_seq_num
FROM bom_operation_networks_v bonv
WHERE routing_sequence_id = p_routing_sequence_id
AND from_op_seq_id = cv_start_op_seq_id
AND operation_type = p_operation_type
AND transition_type = 3
ORDER BY to_seq_num;
SELECT to_op_seq_id, to_seq_num,
transition_type, nvl(planning_pct, 0) planning_pct,
from_op_seq_id, from_seq_num
FROM bom_operation_networks_v bonv
WHERE routing_sequence_id = p_routing_sequence_id
AND from_op_seq_id = cv_start_op_seq_id
AND operation_type = p_operation_type
AND transition_type = 3
ORDER BY to_seq_num;
select bon.to_op_seq_id prim_op_seq_id
from bom_operation_networks bon
connect by prior to_op_seq_id = from_op_seq_id
and
nvl(bon.transition_type, 0) not in (2, 3)
start with from_op_seq_id = cv_start_op_seq_id
and
nvl(bon.transition_type, 0) not in (2, 3);
visited.DELETE;
temp_op_tbl.DELETE;
select nvl(yield, 1)
into l_yield
from bom_operation_sequences
where operation_sequence_id = ntwk_op_tbl(i).operation_seq_id;*/
select DECODE(bor.cfm_routing_flag, 3, (DECODE(bos.operation_yield_enabled, 1, NVL(bos.yield, 1), 1)), NVL(bos.yield, 1))
into l_yield
from bom_operational_routings bor, bom_operation_sequences bos
where bor.routing_sequence_id = bos.routing_sequence_id
and bos.operation_sequence_id = ntwk_op_tbl(i).operation_seq_id;
temp_op_tbl.DELETE;
updt_db(p_routing_sequence_id, p_operation_type, p_update_events);
SELECT max(to_op_seq_id) end_op_seq_id
FROM bom_operation_networks_v bonv
WHERE bonv.routing_sequence_id = p_routing_sequence_id
AND bonv.operation_type = p_operation_type
AND bonv.transition_type <> 3
AND NOT EXISTS (SELECT NULL
FROM bom_operation_networks net
WHERE net.from_op_seq_id = bonv.to_op_seq_id
AND net.transition_type <> 3);
SELECT to_op_seq_id next_op_seq_id,
to_seq_num next_op_seq_num,
transition_type
FROM bom_operation_networks_v bonv
WHERE routing_sequence_id = p_routing_sequence_id
AND from_op_seq_id = cv_start_op_seq_id
AND operation_type = p_operation_type
AND transition_type <> 3
ORDER BY transition_type desc, next_op_seq_num;
SELECT to_op_seq_id next_op_seq_id,
to_seq_num next_op_seq_num,
transition_type
FROM bom_operation_networks_v bonv
WHERE routing_sequence_id = p_routing_sequence_id
AND from_op_seq_id = cv_op_seq_id
AND operation_type = p_operation_type
AND transition_type = 2
ORDER BY transition_type desc, next_op_seq_num;
SELECT to_op_seq_id, to_seq_num,
transition_type, nvl(planning_pct, 0) planning_pct,
from_op_seq_id, from_seq_num
FROM bom_operation_networks_v bonv
WHERE routing_sequence_id = p_routing_sequence_id
AND from_op_seq_id = cv_start_op_seq_id
AND operation_type = p_operation_type
AND transition_type = 3
ORDER BY to_seq_num;
SELECT to_op_seq_id, to_seq_num,
transition_type, nvl(planning_pct, 0) planning_pct,
from_op_seq_id, from_seq_num
FROM bom_operation_networks_v bonv
WHERE routing_sequence_id = p_routing_sequence_id
AND from_op_seq_id = cv_start_op_seq_id
AND operation_type = p_operation_type
AND transition_type = 3
ORDER BY to_seq_num;
p_update_events IN NUMBER,
p_ind IN NUMBER
)
IS
cursor prim_path_fdr_cur (cv_start_op_seq_id number) is
select bon.to_op_seq_id prim_op_seq_id
from bom_operation_networks bon
connect by prior to_op_seq_id = from_op_seq_id
and
nvl(bon.transition_type, 0) not in (2, 3)
start with from_op_seq_id = cv_start_op_seq_id
and
nvl(bon.transition_type, 0) not in (2, 3);
visited.DELETE;
temp_op_tbl.DELETE;
select nvl(yield, 1)
into l_yield
from bom_operation_sequences
where operation_sequence_id = ntwk_op_tbl(i).operation_seq_id;*/
select DECODE(bor.cfm_routing_flag, 3, (DECODE(bos.operation_yield_enabled, 1, NVL(bos.yield, 1), 1)), NVL(bos.yield, 1))
into l_yield
from bom_operational_routings bor, bom_operation_sequences bos
where bor.routing_sequence_id = bos.routing_sequence_id
and bos.operation_sequence_id = ntwk_op_tbl(i).operation_seq_id;
temp_op_tbl.DELETE;
updt_db(p_routing_sequence_id, p_operation_type, p_update_events);
SELECT from_op_seq_id prev_op, planning_pct
--FROM bom_operation_networks_v
FROM bom_operation_networks
WHERE to_op_seq_id = cv_to_seq_id
AND transition_type <> 3;
SELECT from_op_seq_id prev_op, planning_pct
FROM bom_operation_networks
WHERE to_op_seq_id = cv_to_seq_id
AND transition_type <> 3;
select nvl(yield, 1)
into l_yield
from bom_operation_sequences
where operation_sequence_id = ntwk_op_tbl(op_ptr).operation_seq_id;*/
select DECODE(bor.cfm_routing_flag, 3, (DECODE(bos.operation_yield_enabled, 1, NVL(bos.yield, 1), 1)), NVL(bos.yield, 1))
into l_yield
from bom_operational_routings bor, bom_operation_sequences bos
where bor.routing_sequence_id = bos.routing_sequence_id
and bos.operation_sequence_id = ntwk_op_tbl(op_ptr).operation_seq_id;
SELECT to_op_seq_id next_op, planning_pct
FROM bom_operation_networks
WHERE from_op_seq_id = cv_to_seq_id
AND transition_type <> 3;
select nvl(yield, 1)
into l_yield
from bom_operation_sequences
where operation_sequence_id = ntwk_op_tbl(op_ptr).operation_seq_id;*/
select DECODE(bor.cfm_routing_flag, 3, (DECODE(bos.operation_yield_enabled, 1, NVL(bos.yield, 1), 1)), NVL(bos.yield, 1))
into l_yield
from bom_operational_routings bor, bom_operation_sequences bos
where bor.routing_sequence_id = bos.routing_sequence_id
and bos.operation_sequence_id = ntwk_op_tbl(op_ptr).operation_seq_id;
SELECT from_op_seq_id prev_op_seq_id,
transition_type
FROM bom_operation_networks bonv
--WHERE routing_sequence_id = p_routing_sequence_id
WHERE to_op_seq_id = cv_op_seq_id;
SELECT to_op_seq_id next_op_seq_id,
transition_type
FROM bom_operation_networks bonv
--WHERE routing_sequence_id = p_routing_sequence_id
WHERE from_op_seq_id = cv_op_seq_id;
SELECT from_op_seq_id prev_op, planning_pct
FROM bom_operation_networks
WHERE to_op_seq_id = cv_to_seq_id
AND transition_type = 3;
SELECT from_op_seq_id prev_op, planning_pct
FROM bom_operation_networks
WHERE to_op_seq_id = cv_to_seq_id
AND transition_type <> 3;
SELECT SUM(planning_pct) pct_sum
FROM bom_operation_networks
WHERE from_op_seq_id = cv_from_seq_id
AND transition_type <> 3;
SELECT to_op_seq_id next_op
FROM bom_operation_networks
WHERE from_op_seq_id = cv_from_seq_id
AND transition_type <> 3;
SELECT PLANNING_PCT npp
FROM bom_operation_networks
WHERE from_op_seq_id = cv_from_seq_id
AND to_op_seq_id = cv_to_seq_id
AND transition_type <> 3;
SELECT to_op_seq_id next_op
FROM bom_operation_networks
WHERE from_op_seq_id = cv_from_seq_id
AND transition_type <> 3;
SELECT from_op_seq_id prev_op, planning_pct
FROM bom_operation_networks
WHERE to_op_seq_id = cv_to_seq_id
AND transition_type <> 3;
SELECT PLANNING_PCT npp
FROM bom_operation_networks
WHERE from_op_seq_id = cv_from_seq_id
AND to_op_seq_id = cv_to_seq_id
AND transition_type <> 3;
SELECT from_op_seq_id prev_op, planning_pct
FROM bom_operation_networks
WHERE to_op_seq_id = cv_to_seq_id
AND transition_type <> 3;
SELECT count(*) count
FROM bom_operation_networks
WHERE to_op_seq_id = cv_to_seq_id
AND transition_type <> 3;
SELECT from_op_seq_id prev_op, planning_pct
FROM bom_operation_networks
WHERE to_op_seq_id = cv_to_seq_id
AND transition_type <> 3;
SELECT to_op_seq_id next_op, planning_pct
FROM bom_operation_networks
WHERE from_op_seq_id = cv_from_seq_id
AND transition_type = 3;
SELECT to_op_seq_id next_op, planning_pct
FROM bom_operation_networks
WHERE from_op_seq_id = cv_op_seq_id
AND transition_type = 3;
SELECT to_op_seq_id next_op, planning_pct
FROM bom_operation_networks
WHERE from_op_seq_id = cv_op_seq_id
AND transition_type <> 3;
SELECT to_op_seq_id next_op, planning_pct
FROM bom_operation_networks
WHERE from_op_seq_id = cv_op_seq_id
AND transition_type <> 3;
rework_effect_tbl.DELETE;
rework_effect_tbl.DELETE;