The following lines contain the word 'select', 'insert', 'update' or 'delete':
SELECT rowid
FROM oki_wip_by_customers wbc
WHERE wbc.period_set_name = p_period_set_name
AND wbc.period_name = p_period_name
AND wbc.authoring_org_id = p_authoring_org_id
AND wbc.customer_party_id = p_customer_id
AND wbc.scs_code = p_scs_code ;
SELECT oki_wip_by_customers_s1.nextval seq
FROM dual
;
INSERT INTO oki_wip_by_customers
( id
, period_set_name
, period_name
, period_type
, authoring_org_id
, authoring_org_name
, customer_party_id
, customer_name
, scs_code
, base_forecast_amount
, base_booked_amount
, base_lost_amount
, request_id
, program_application_id
, program_id
, program_update_date )
VALUES ( l_sequence
, p_period_set_name
, p_period_name
, p_period_type
, p_authoring_org_id
, p_authoring_org_name
, p_customer_party_id
, p_customer_name
, p_scs_code
, p_base_forecast_amount
, p_base_booked_amount
, p_base_lost_amount
, oki_load_wbc_pvt.g_request_id
, oki_load_wbc_pvt.g_program_application_id
, oki_load_wbc_pvt.g_program_id
, oki_load_wbc_pvt.g_program_update_date ) ;
UPDATE oki_wip_by_customers SET
base_forecast_amount = p_base_forecast_amount
, base_booked_amount = p_base_booked_amount
, base_lost_amount = p_base_lost_amount
, request_id = oki_load_wbc_pvt.g_request_id
, program_application_id = oki_load_wbc_pvt.g_program_application_id
, program_id = oki_load_wbc_pvt.g_program_id
, program_update_date = oki_load_wbc_pvt.g_program_update_date
WHERE ROWID = p_wbc_rowid ;
SELECT NVL(SUM(shd.base_forecast_amount), 0) base_forecast_amount
FROM oki_sales_k_hdrs shd
-- Contract is a renewal contract
WHERE shd.is_new_yn IS NULL
-- Contract must have undergone forecasting
AND shd.close_date IS NOT NULL
AND shd.win_percent IS NOT NULL
-- Expected close date is in the period
AND shd.close_date BETWEEN p_glpr_start_date AND p_glpr_end_date
AND shd.customer_party_id = p_customer_party_id
AND shd.authoring_org_id = p_authoring_org_id
AND shd.scs_code = p_scs_code
;
SELECT NVL(SUM(shd.base_contract_amount), 0) base_contract_amount
FROM oki_sales_k_hdrs shd
-- Contract is a renewal contract
WHERE shd.is_new_yn IS NULL
-- Contract is signed or active
AND shd.ste_code IN ('SIGNED', 'ACTIVE')
-- Lesser of the signed date or the start date falls within
-- the period
AND LEAST(NVL(shd.date_signed, shd.start_date),shd.start_date)
BETWEEN p_glpr_start_date AND p_glpr_end_date
AND shd.customer_party_id = p_customer_party_id
AND shd.authoring_org_id = p_authoring_org_id
AND shd.scs_code = p_scs_code
;
SELECT NVL(SUM(cpl.base_price_negotiated), 0) base_price_negotiated
/*11510 change removed oki_Expired_lines and joined to oki_cov_prd_lines*/
FROM oki_cov_prd_lines cpl
, oki_sales_k_hdrs shd
WHERE shd.chr_id = cpl.chr_id
/*11510 change start*/
AND cpl.is_exp_not_renewed_yn='Y'
/*11510 change start*/
-- expiration date is in the period
AND cpl.end_date BETWEEN p_glpr_start_date AND p_glpr_end_date
AND shd.customer_party_id = p_customer_party_id
AND shd.authoring_org_id = p_authoring_org_id
AND shd.scs_code = p_scs_code ;
SELECT DISTINCT(shd.customer_party_id) customer_id
, /*11510 change*/ NULL customer_name
, shd.authoring_org_id authoring_org_id
, /*11510 change*/ NULL authoring_org_name
, shd.scs_code scs_code
FROM oki_sales_k_hdrs shd
;
l_loc := 'Opening cursor to determine if insert or update should occur.' ;
l_loc := 'Insert the new record.' ;
l_loc := 'Update the existing record.' ;
SELECT NVL(SUM(shd.base_forecast_amount), 0) base_forecast_amount
FROM oki_sales_k_hdrs shd
-- Contract is a renewal contract
WHERE shd.is_new_yn IS NULL
-- Contract must have undergone forecasting
AND shd.close_date IS NOT NULL
AND shd.win_percent IS NOT NULL
-- Expected close date is in the period
AND shd.close_date BETWEEN p_glpr_start_date AND p_glpr_end_date
AND shd.customer_party_id = p_customer_party_id
AND shd.scs_code = p_scs_code
;
SELECT NVL(SUM(shd.base_contract_amount), 0) base_contract_amount
FROM oki_sales_k_hdrs shd
-- Contract is a renewal contract
WHERE shd.is_new_yn IS NULL
-- Contract is signed or active
AND shd.ste_code IN ('SIGNED', 'ACTIVE')
-- Lesser of the signed date or the start date falls within
-- the period
AND LEAST(NVL(shd.date_signed, shd.start_date), shd.start_date)
BETWEEN p_glpr_start_date AND p_glpr_end_date
AND shd.customer_party_id = p_customer_party_id
AND shd.scs_code = p_scs_code
;
SELECT NVL(SUM(cpl.base_price_negotiated), 0) base_price_negotiated
/*11510 change removed oki_Expired_lines and joined to oki_cov_prd_lines*/
FROM oki_cov_prd_lines cpl
, oki_sales_k_hdrs shd
-- expiration date is in the period
WHERE shd.chr_id = cpl.chr_id
/*11510 change start*/
AND cpl.is_exp_not_renewed_yn = 'Y'
/*11510 change end*/
AND cpl.end_date BETWEEN p_glpr_start_date AND p_glpr_end_date
AND shd.customer_party_id = p_customer_party_id
AND shd.scs_code = p_scs_code
;
SELECT DISTINCT(shd.customer_party_id) customer_id
, /*11510 change*/NULL customer_name
, shd.scs_code
FROM oki_sales_k_hdrs shd ;
l_loc := 'Opening cursor to determine if insert or update should occur.' ;
l_loc := 'Insert the new record.' ;
l_loc := 'Update the existing record.' ;
SELECT NVL(SUM(shd.base_forecast_amount), 0) base_forecast_amount
FROM oki_sales_k_hdrs shd
-- Contract is a renewal contract
WHERE shd.is_new_yn IS NULL
-- Contract must have undergone forecasting
AND shd.close_date IS NOT NULL
AND shd.win_percent IS NOT NULL
-- Expected close date is in the period
AND shd.close_date BETWEEN p_glpr_start_date AND p_glpr_end_date
AND shd.customer_party_id = p_customer_party_id
;
SELECT NVL(SUM(shd.base_contract_amount), 0) base_contract_amount
FROM oki_sales_k_hdrs shd
-- Contract is a renewal contract
WHERE shd.is_new_yn IS NULL
-- Contract is signed or active
AND shd.ste_code IN ('SIGNED', 'ACTIVE')
-- Lesser of the signed date or the start date falls within
-- the period
AND LEAST(NVL(shd.date_signed, shd.start_date), shd.start_date)
BETWEEN p_glpr_start_date AND p_glpr_end_date
AND shd.customer_party_id = p_customer_party_id
;
SELECT NVL(SUM(cpl.base_price_negotiated), 0) base_price_negotiated
/*11510 change removed oki_Expired_lines and joined to oki_cov_prd_lines*/
FROM oki_cov_prd_lines cpl
, oki_sales_k_hdrs shd
-- expiration date is in the period
WHERE shd.chr_id = cpl.chr_id
/*11510 change start*/
AND cpl.is_exp_not_renewed_yn = 'Y'
/*11510 change end*/
AND cpl.end_date BETWEEN p_glpr_start_date AND p_glpr_end_date
AND shd.customer_party_id = p_customer_party_id
;
SELECT DISTINCT(shd.customer_party_id) customer_id,
/*11510 Change*/ NULL customer_name
FROM oki_sales_k_hdrs shd
;
l_loc := 'Opening cursor to determine if insert or update should occur.' ;
l_loc := 'Insert the new record.' ;
l_loc := 'Update the existing record.' ;
oki_refresh_pvt.update_oki_refresh( l_table_name, l_retcode ) ;
g_program_update_date := SYSDATE ;