I have to insert lookup values into parent table remaining items in chiled table can you please any one explain the logic
CREATE OR REPLACE
PACKAGE BODY xxcsi_ib_data_ob_ecs_pkg
v_update_date DATE := SYSDATE;
PROCEDURE print_log(
i_message IN VARCHAR2)
IS
BEGIN
-- dbms_output.put_line('Log '||TO_CHAR(sysdate,'DD-MON-YYYY HH24:MI:SS :')||i_message);
fnd_file.put_line(fnd_file.LOG,'Log '||TO_CHAR(SYSDATE,'DD-MON-YYYY HH24:MI:SS :')||i_message);
EXCEPTION
WHEN no_data_found THEN
NULL;
WHEN OTHERS THEN
NULL;
END;
PROCEDURE main_prc(
o_chr_errbuff OUT VARCHAR2 ,
o_num_retcode OUT NUMBER ,
i_org_id IN NUMBER)
IS
CURSOR cur_get_parent_ib_rec(c_from DATE ,c_to DATE)
IS
SELECT
/*+ index(a CSI_ITEM_INSTANCES_X3)*/
---CREATE MODE ITEM
A.creation_date ,
A.last_update_date ,
A.last_oe_order_line_id line_id ,
A.inventory_item_id ,
A.instance_id ,
A.instance_type_code ,
msib.segment1
FROM csi_item_instances A ,
mtl_system_items_b msib
WHERE 1=1
-- AND a.instance_id = 33371916
--AND a.instance_id in (33371920,33371921,33371922,33371923,33371924,33371925,33371926,33371927,33371928,33371929,33371930)
AND msib.inventory_item_id=A.inventory_item_id
AND msib.organization_id =
(SELECT mp.organization_id
FROM mtl_parameters mp
WHERE mp.organization_code = 'IMO'
-- AND msib.organization_id = 85
-- and msib.segment1 like '475%'
--AND msib.segment1 like 'TREX%'
AND EXISTS
(SELECT 1
FROM fnd_lookup_values
WHERE lookup_type = 'EMR CSI OUTBOUND INTERFACE PSG'
AND language = 'US'
AND lookup_code = msib.segment1
--and DESCRIPTION = 'Items to be Interfaced from Oracle EBS to ECS'
AND A.last_update_date BETWEEN NVL(c_from ,to_date('07-AUG-2014 00:00:00','DD-MON-YYYY HH24:MI:SS')) AND NVL(c_to ,to_date('22-AUG-2014 00:00:00','DD-MON-YYYY HH24:MI:SS'))
UNION
SELECT
/*+ index(a CSI_ITEM_INSTANCES_X3)*/
---CREATE MODE SEARCH
A.creation_date ,
A.last_update_date ,
A.last_oe_order_line_id line_id ,
A.inventory_item_id ,
A.instance_id ,
A.instance_type_code ,
msib.segment1
FROM csi_item_instances A ,
mtl_system_items_b msib
WHERE 1=1
--AND a.instance_id = 33371916
--AND a.instance_id in (33371920,33371921,33371922,33371923,33371924,33371925,33371926,33371927,33371928,33371929,33371930)
AND msib.inventory_item_id=A.inventory_item_id
AND msib.organization_id =
(SELECT mp.organization_id
FROM mtl_parameters mp
WHERE mp.organization_code = 'IMO'
-- AND msib.organization_id = 85
-- and msib.segment1 like '475%'
--AND msib.segment1 like 'TREX%'
AND EXISTS
(SELECT 1
FROM fnd_lookup_values
WHERE lookup_type = 'EMR CSI OUTBOUND INTERFACE PSG'
AND language = 'US'
AND tag ='ALL TREX ITEMS'
AND SUBSTR(lookup_code,1,4) = SUBSTR(msib.segment1,1,4)
--and DESCRIPTION = 'Items to be Interfaced from Oracle EBS to ECS'
AND A.last_update_date BETWEEN NVL(c_from ,to_date('07-AUG-2014 00:00:00','DD-MON-YYYY HH24:MI:SS')) AND NVL(c_to ,to_date('22-AUG-2014 00:00:00','DD-MON-YYYY HH24:MI:SS'))
UNION
SELECT
/*+ index(a CSI_ITEM_INSTANCES_X3)*/
---UPDATE MODE ITEM
A.creation_date ,
A.last_update_date ,
A.last_oe_order_line_id line_id ,
A.inventory_item_id ,
A.instance_id ,
A.instance_type_code ,
msib.segment1
FROM csi_item_instances A ,
mtl_system_items_b msib
WHERE 1=1
--AND a.instance_id = 33371916
--AND a.instance_id in (33371920,33371921,33371922,33371923,33371924,33371925,33371926,33371927,33371928,33371929,33371930)
AND msib.inventory_item_id=A.inventory_item_id
AND msib.organization_id =
(SELECT mp.organization_id
FROM mtl_parameters mp
WHERE mp.organization_code = 'IMO'
-- AND msib.organization_id = 85
-- and msib.segment1 like '475%'
--AND msib.segment1 like 'TREX%'
AND EXISTS
(SELECT 1
FROM fnd_lookup_values
WHERE lookup_type = 'EMR CSI OUTBOUND INTERFACE PSG'
AND language = 'US'
AND lookup_code = msib.segment1
--and DESCRIPTION = 'Items to be Interfaced from Oracle EBS to ECS'
AND A.last_update_date BETWEEN NVL(c_from ,to_date('07-AUG-2014 00:00:00','DD-MON-YYYY HH24:MI:SS')) AND NVL(c_to ,to_date('22-AUG-2014 00:00:00','DD-MON-YYYY HH24:MI:SS'))
AND EXISTS
(SELECT
/*+ index(ct CSI_TRANSACTIONS_U01)*/
1
FROM csi_item_instances_h h ,
csi_transactions ct
WHERE 1 =1
AND ct.transaction_type_id IN (1)
AND ct.transaction_id = h.transaction_id
AND ct.last_update_date BETWEEN NVL(c_from ,to_date('07-AUG-2014 00:00:00','DD-MON-YYYY HH24:MI:SS')) AND NVL(c_to ,to_date('22-AUG-2014 00:00:00','DD-MON-YYYY HH24:MI:SS'))
AND A.instance_id =h.instance_id
UNION
SELECT
/*+ index(a CSI_ITEM_INSTANCES_X3)*/
---UPDATE MODE SEARCH
A.creation_date ,
A.last_update_date ,
A.last_oe_order_line_id line_id ,
A.inventory_item_id ,
A.instance_id ,
A.instance_type_code ,
msib.segment1
FROM csi_item_instances A ,
mtl_system_items_b msib
WHERE 1=1
--AND a.instance_id = 33371916
--AND a.instance_id in (33371920,33371921,33371922,33371923,33371924,33371925,33371926,33371927,33371928,33371929,33371930)
AND msib.inventory_item_id=A.inventory_item_id
AND msib.organization_id =
(SELECT mp.organization_id
FROM mtl_parameters mp
WHERE mp.organization_code = 'IMO'
-- AND msib.organization_id = 85
-- and msib.segment1 like '475%'
--AND msib.segment1 like 'TREX%'
AND EXISTS
(SELECT 1
FROM fnd_lookup_values
WHERE lookup_type = 'EMR CSI OUTBOUND INTERFACE PSG'
AND language = 'US'
AND tag ='ALL TREX ITEMS'
AND SUBSTR(lookup_code,1,4) = SUBSTR(msib.segment1,1,4)
--and DESCRIPTION = 'Items to be Interfaced from Oracle EBS to ECS'
AND A.last_update_date BETWEEN NVL(c_from ,to_date('07-AUG-2014 00:00:00','DD-MON-YYYY HH24:MI:SS')) AND NVL(c_to ,to_date('22-AUG-2014 00:00:00','DD-MON-YYYY HH24:MI:SS'))
AND EXISTS
(SELECT
/*+ index(ct CSI_TRANSACTIONS_U01)*/
1
FROM csi_item_instances_h h ,
csi_transactions ct
WHERE 1 =1
AND ct.transaction_type_id IN (1)
AND ct.transaction_id = h.transaction_id
AND ct.last_update_date BETWEEN NVL(c_from ,to_date('07-AUG-2014 00:00:00','DD-MON-YYYY HH24:MI:SS')) AND NVL(c_to ,to_date('22-AUG-2014 00:00:00','DD-MON-YYYY HH24:MI:SS'))
AND A.instance_id =h.instance_id
ORDER BY 1 DESC,
2 ;
CURSOR cur_get_child_ib_rec(c_instance_id NUMBER)
IS
SELECT cir.subject_id
FROM csi.csi_ii_relationships cir
WHERE cir.object_id = c_instance_id;
CURSOR cur_get_outbound_data(c_instance_id NUMBER)
IS
SELECT cii.instance_id instance_id,
cii.instance_number instance_number,
cii.inventory_item_id inventory_item_id,
msi.segment1 segment1, --CONCATENATED_SEGMENTS,
msi.description description, --DESCRIPTION,
cii.inv_master_organization_id master_organization_id,
cii.serial_number serial_number,
cii.system_id system_id,
cst.NAME system_name,
cii.quantity quantity,
cii.unit_of_measure uom,
cii.active_start_date active_start_date,
cii.active_end_date active_end_date,
cii.install_date install_date,
cii.object_version_number object_version_number,
cii.last_vld_organization_id,
hou.NAME pre_registration_location,
looh.header_id last_header_id,
looh.order_number emerson_order_number,
cii.last_oe_order_line_id order_line_id,
NVL(lool.actual_shipment_date, lool.fulfillment_date) actual_shipment_date,
(SELECT DISTINCT pap.email_address
FROM fnd_user fu ,
per_all_people_f pap
WHERE fu.employee_id = pap.person_id
and sysdate between pap.effective_start_date and nvl(pap.effective_end_date, sysdate)
AND fu.user_id = NVL(wdd.created_by,lool.created_by)
) email_address,
(SELECT DISTINCT hp.party_name
FROM hz_parties hp,
hz_party_sites hps ,
hz_party_site_uses hpsu ,
hz_locations hl
WHERE hp.party_id = hps.party_id
AND hps.location_id = hl.location_id
AND hps.party_site_id = hpsu.party_site_id(+)
AND hps.party_site_id =
(SELECT hcasa.party_site_id
FROM apps.hz_cust_acct_sites hcasa
WHERE hcasa.cust_acct_site_id =
(SELECT hcsua.cust_acct_site_id
FROM apps.hz_cust_site_uses hcsua
WHERE cia.bill_to_address = hcsua.site_use_id
) AS "Bill_To_company_name",--------------------------CH-ID-1.1 STARTS-----------
(SELECT DISTINCT hps.party_site_id
FROM hz_parties hp,
hz_party_sites hps ,
hz_party_site_uses hpsu ,
hz_locations hl
WHERE hp.party_id = hps.party_id
AND hps.location_id = hl.location_id
AND hps.party_site_id = hpsu.party_site_id(+)
AND hps.party_site_id =
(SELECT hcasa.party_site_id
FROM apps.hz_cust_acct_sites hcasa
WHERE hcasa.cust_acct_site_id =
(SELECT hcsua.cust_acct_site_id
FROM apps.hz_cust_site_uses hcsua
WHERE cia.bill_to_address = hcsua.site_use_id
) AS "BILL_TO_party_SITE_ID",
(SELECT DISTINCT hl.state
FROM hz_parties hp,
hz_party_sites hps ,
hz_party_site_uses hpsu ,
hz_locations hl
WHERE hp.party_id = hps.party_id
AND hps.location_id = hl.location_id
AND hps.party_site_id = hpsu.party_site_id(+)
AND hps.party_site_id =
(SELECT hcasa.party_site_id
FROM apps.hz_cust_acct_sites hcasa
WHERE hcasa.cust_acct_site_id =
(SELECT hcsua.cust_acct_site_id
FROM apps.hz_cust_site_uses hcsua
WHERE cia.bill_to_address = hcsua.site_use_id
) AS "BILL_TO_STATE",
(SELECT DISTINCT hl.country
FROM hz_parties hp,
hz_party_sites hps ,
hz_party_site_uses hpsu ,
hz_locations hl
WHERE hp.party_id = hps.party_id
AND hps.location_id = hl.location_id
AND hps.party_site_id = hpsu.party_site_id(+)
AND hps.party_site_id =
(SELECT hcasa.party_site_id
FROM apps.hz_cust_acct_sites hcasa
WHERE hcasa.cust_acct_site_id =
(SELECT hcsua.cust_acct_site_id
FROM apps.hz_cust_site_uses hcsua
WHERE cia.bill_to_address = hcsua.site_use_id
) AS "BILL_TO_COUNTRY",
(SELECT DISTINCT hl.city
FROM hz_parties hp,
hz_party_sites hps ,
hz_party_site_uses hpsu ,
hz_locations hl
WHERE hp.party_id = hps.party_id
AND hps.location_id = hl.location_id
AND hps.party_site_id = hpsu.party_site_id(+)
AND hps.party_site_id =
(SELECT hcasa.party_site_id
FROM apps.hz_cust_acct_sites hcasa
WHERE hcasa.cust_acct_site_id =
(SELECT hcsua.cust_acct_site_id
FROM apps.hz_cust_site_uses hcsua
WHERE cia.bill_to_address = hcsua.site_use_id
) AS "BILL_TO_CITY",
(SELECT DISTINCT hl.address1
FROM hz_parties hp,
hz_party_sites hps ,
hz_party_site_uses hpsu ,
hz_locations hl
WHERE hp.party_id = hps.party_id
AND hps.location_id = hl.location_id
AND hps.party_site_id = hpsu.party_site_id(+)
AND hps.party_site_id =
(SELECT hcasa.party_site_id
FROM apps.hz_cust_acct_sites hcasa
WHERE hcasa.cust_acct_site_id =
(SELECT hcsua.cust_acct_site_id
FROM apps.hz_cust_site_uses hcsua
WHERE cia.bill_to_address = hcsua.site_use_id
) AS "BILL_TO_LOCATION",
(SELECT DISTINCT hp.party_name
FROM hz_parties hp,
hz_party_sites hps,
hz_party_site_uses hpsu,
hz_locations hl
WHERE hp.party_id = hps.party_id
AND hps.location_id = hl.location_id
AND hps.party_site_id = hpsu.party_site_id(+)
AND hps.party_site_id =
(SELECT hcasa.party_site_id
FROM apps.hz_cust_acct_sites hcasa
WHERE hcasa.cust_acct_site_id =
(SELECT hcsua.cust_acct_site_id
FROM apps.hz_cust_site_uses hcsua
WHERE cia.ship_to_address = hcsua.site_use_id
) AS "Ship_to_company_name",
(SELECT DISTINCT hps.party_site_id
FROM hz_parties hp,
hz_party_sites hps ,
hz_party_site_uses hpsu ,
hz_locations hl
WHERE hp.party_id = hps.party_id
AND hps.location_id = hl.location_id
AND hps.party_site_id = hpsu.party_site_id(+)
AND hps.party_site_id =
(SELECT hcasa.party_site_id
FROM apps.hz_cust_acct_sites hcasa
WHERE hcasa.cust_acct_site_id =
(SELECT hcsua.cust_acct_site_id
FROM apps.hz_cust_site_uses hcsua
WHERE cia.bill_to_address = hcsua.site_use_id
) AS "SHIP_TO_party_SITE_ID",
(SELECT DISTINCT hl.state
FROM hz_parties hp,
hz_party_sites hps ,
hz_party_site_uses hpsu ,
hz_locations hl
WHERE hp.party_id = hps.party_id
AND hps.location_id = hl.location_id
AND hps.party_site_id = hpsu.party_site_id(+)
AND hps.party_site_id =
(SELECT hcasa.party_site_id
FROM apps.hz_cust_acct_sites hcasa
WHERE hcasa.cust_acct_site_id =
(SELECT hcsua.cust_acct_site_id
FROM apps.hz_cust_site_uses hcsua
WHERE cia.bill_to_address = hcsua.site_use_id
) AS "SHIP_TO_STATE",
(SELECT DISTINCT hl.country
FROM hz_parties hp,
hz_party_sites hps ,
hz_party_site_uses hpsu ,
hz_locations hl
WHERE hp.party_id = hps.party_id
AND hps.location_id = hl.location_id
AND hps.party_site_id = hpsu.party_site_id(+)
AND hps.party_site_id =
(SELECT hcasa.party_site_id
FROM apps.hz_cust_acct_sites hcasa
WHERE hcasa.cust_acct_site_id =
(SELECT hcsua.cust_acct_site_id
FROM apps.hz_cust_site_uses hcsua
WHERE cia.bill_to_address = hcsua.site_use_id
) AS "SHIP_TO_COUNTRY",
(SELECT DISTINCT hl.city
FROM hz_parties hp,
hz_party_sites hps ,
hz_party_site_uses hpsu ,
hz_locations hl
WHERE hp.party_id = hps.party_id
AND hps.location_id = hl.location_id
AND hps.party_site_id = hpsu.party_site_id(+)
AND hps.party_site_id =
(SELECT hcasa.party_site_id
FROM apps.hz_cust_acct_sites hcasa
WHERE hcasa.cust_acct_site_id =
(SELECT hcsua.cust_acct_site_id
FROM apps.hz_cust_site_uses hcsua
WHERE cia.bill_to_address = hcsua.site_use_id
) AS "SHIP_TO_CITY",
(SELECT DISTINCT hl.address1
FROM hz_parties hp,
hz_party_sites hps ,
hz_party_site_uses hpsu ,
hz_locations hl
WHERE hp.party_id = hps.party_id
AND hps.location_id = hl.location_id
AND hps.party_site_id = hpsu.party_site_id(+)
AND hps.party_site_id =
(SELECT hcasa.party_site_id
FROM apps.hz_cust_acct_sites hcasa
WHERE hcasa.cust_acct_site_id =
(SELECT hcsua.cust_acct_site_id
FROM apps.hz_cust_site_uses hcsua
WHERE cia.bill_to_address = hcsua.site_use_id
) AS "SHIP_TO_LOCATION",
(SELECT DISTINCT hl.postal_code
FROM hz_parties hp,
hz_party_sites hps ,
hz_party_site_uses hpsu ,
hz_locations hl
WHERE hp.party_id = hps.party_id
AND hps.location_id = hl.location_id
AND hps.party_site_id = hpsu.party_site_id(+)
AND hps.party_site_id =
(SELECT hcasa.party_site_id
FROM apps.hz_cust_acct_sites hcasa
WHERE hcasa.cust_acct_site_id =
(SELECT hcsua.cust_acct_site_id
FROM apps.hz_cust_site_uses hcsua
WHERE cia.bill_to_address = hcsua.site_use_id
) AS "SHIP_TO_PIN_CODE",
(SELECT DISTINCT hl.postal_code
FROM hz_parties hp,
hz_party_sites hps ,
hz_party_site_uses hpsu ,
hz_locations hl
WHERE hp.party_id = hps.party_id
AND hps.location_id = hl.location_id
AND hps.party_site_id = hpsu.party_site_id(+)
AND hps.party_site_id =
(SELECT hcasa.party_site_id
FROM apps.hz_cust_acct_sites hcasa
WHERE hcasa.cust_acct_site_id =
(SELECT hcsua.cust_acct_site_id
FROM apps.hz_cust_site_uses hcsua
WHERE cia.bill_to_address = hcsua.site_use_id
) AS "BILL_TO_PIN_CODE",
(SELECT hcsua.LOCATION
FROM apps.hz_cust_site_uses_all hcsua
WHERE cia.ship_to_address = hcsua.site_use_id
) "SHIP_TO_NUMBER",
(SELECT hcsua.LOCATION
FROM apps.hz_cust_site_uses_all hcsua
WHERE cia.bill_to_address = hcsua.site_use_id
) "BILL_TO_NUMBER",
(SELECT DISTINCT hca.account_number
FROM hz_cust_accounts hca
WHERE hca.cust_account_id =
(SELECT hcasa.cust_account_id
FROM apps.hz_cust_acct_sites hcasa
WHERE hcasa.cust_acct_site_id =
(SELECT hcsua.cust_acct_site_id
FROM apps.hz_cust_site_uses hcsua
WHERE cia.bill_to_address = hcsua.site_use_id
)AS "CUSTOMER_NUMBER", --------------------------CH-ID-1.1 ENDS -----------
(SELECT civ.attribute_value
FROM csi_iea_values civ,
csi_i_extended_attribs ciea
WHERE civ.attribute_id = ciea.attribute_id
AND ciea.attribute_code = '011 LICENSE NUMBER'
AND civ.instance_id = cii.instance_id
) AS "EA_LICENSE_NUMBER",
(SELECT civ.attribute_value
FROM csi_iea_values civ,
csi_i_extended_attribs ciea
WHERE civ.attribute_id = ciea.attribute_id
AND ciea.attribute_code = 'VA_SALES_ORDER_NUMBER'
AND civ.instance_id = cii.instance_id
) AS "EA_VA_SALES_ORDER_NUM",
(SELECT NAME
FROM hr_all_organization_units
WHERE organization_id = cii.inv_master_organization_id
) master_organization_name
FROM csi_item_instances cii,
csi_systems_tl cst,
-- MTL_SYSTEM_ITEMS_VL MSIKFV,
-- MTL_SYSTEM_ITEMS MSI,
mtl_system_items_b msi,
hr_all_organization_units hou,
oe_order_lines lool,
oe_order_headers looh,
wsh_delivery_details wdd,
csi_i_parties cip,
csi_ip_accounts cia
WHERE cii.last_vld_organization_id = msi.organization_id
AND cii.inventory_item_id = msi.inventory_item_id
-- AND CII.LAST_VLD_ORGANIZATION_ID = MSIKFV.ORGANIZATION_ID
-- AND CII.INVENTORY_ITEM_ID = MSIKFV.INVENTORY_ITEM_ID
AND hou.organization_id(+) = cii.last_vld_organization_id
AND cii.last_oe_order_line_id = lool.line_id
AND lool.header_id = looh.header_id
AND cii.last_oe_order_line_id = wdd.source_line_id
-- AND WDD.SOURCE_LINE_ID = LOOL.LINE_ID
-- AND WDD.SOURCE_HEADER_ID = LOOH.HEADER_ID
AND cii.instance_id = cip.instance_id
AND cii.system_id = cst.system_id(+)
AND cip.party_source_table = 'HZ_PARTIES'
AND cip.relationship_type_code = 'OWNER'
AND cip.instance_party_id = cia.instance_party_id
AND cia.relationship_type_code(+) = 'OWNER'
AND cii.instance_status_id = 1052
AND cst.language(+) = 'US'
AND cii.instance_id = c_instance_id;
CURSOR cur_get_ib_warranty (c_instance_id NUMBER)
IS
SELECT kh.contract_number,
kh.scs_code,
kh.start_date,
kh.end_date,
(kh.end_date-kh.start_date) duration,
clet.NAME coverage_name,
clet.item_description coverage_desc,
b.segment1 service_name,
t.description service_desc
FROM okc_k_headers_b kh,
okc_k_lines_b kl,
okc_k_items ki,
csi_item_instances c,
mtl_system_items_b i,
okc_k_lines_b cleb,
okc_k_lines_tl clet,
okc_k_items ki1,
mtl_system_items_b_kfv b,
mtl_system_items_tl t
WHERE kh.contract_number_modifier IS NULL
AND kh.ID = kl.dnz_chr_id
AND kh.ID = ki.dnz_chr_id
AND kl.ID = ki.cle_id
AND ki.jtot_object1_code IN ('OKX_CUSTPROD')
AND c.last_vld_organization_id = i.organization_id
AND ki.object1_id1 = TO_CHAR(c.instance_id)
AND c.inventory_item_id = i.inventory_item_id
AND kl.cle_id = cleb.cle_id
AND cleb.ID = clet.ID
AND clet.language = userenv('LANG')
AND cleb.lse_id IN (2,15,20)
AND cleb.cle_id = ki1.cle_id
AND b.inventory_item_id = t.inventory_item_id
AND b.organization_id = t.organization_id
AND t.language = userenv('LANG')
AND to_number(ki1.object1_id1) = b.inventory_item_id
AND to_number(ki1.object1_id2) = b.organization_id
AND c.instance_id = c_instance_id;
--v1.2 comment ends
CURSOR cur_get_to_date( c_req_id NUMBER,c_conc_prog_id NUMBER)
IS
SELECT requested_start_date
FROM fnd_concurrent_requests
WHERE request_id = c_req_id
AND concurrent_program_id = c_conc_prog_id;
/*Record Type Declaration*/
TYPE ib_ecs_dat_record
IS
record
instance_id csi_item_instances.instance_id%TYPE,
instance_number csi_item_instances.instance_number%TYPE,
inventory_item_id csi_item_instances.inventory_item_id%TYPE,
segment1 mtl_system_items_b.segment1%TYPE,
description mtl_system_items_b.description%TYPE,
master_organization_id csi_item_instances.inv_master_organization_id%TYPE,
serial_number csi_item_instances.serial_number%TYPE,
system_id csi_item_instances.system_id%TYPE,
system_name csi_systems_tl.NAME%TYPE,
quantity csi_item_instances.quantity%TYPE,
uom csi_item_instances.unit_of_measure%TYPE,
active_start_date csi_item_instances.active_start_date%TYPE,
active_end_date csi_item_instances.active_end_date%TYPE,
install_date csi_item_instances.install_date%TYPE,
obj_version_num csi_item_instances.object_version_number%TYPE,
last_vld_organization_id csi_item_instances.last_vld_organization_id%TYPE,
pre_registration_location VARCHAR2(500),
order_header_id oe_order_headers_all.header_id%TYPE,
order_number oe_order_headers_all.order_number%TYPE,
order_line_id csi_item_instances.last_oe_order_line_id%TYPE,
actual_shipment_date oe_order_lines_all.actual_shipment_date%TYPE,
email_address per_all_people_f.email_address%TYPE,
bill_to_company_name hz_parties.party_name%TYPE,
bill_to_site_id hz_party_sites.party_site_id%TYPE,
bill_to_state hz_locations.state%TYPE,
bill_to_country hz_locations.country%TYPE,
bill_to_city hz_locations.city%TYPE,
bill_to_location hz_locations.address1%TYPE,
ship_to_company_name hz_parties.party_name%TYPE,
ship_to_site_id hz_party_sites.party_site_id%TYPE,
ship_to_state hz_locations.state%TYPE,
ship_to_country hz_locations.country%TYPE,
ship_to_city hz_locations.city%TYPE,
ship_to_location hz_locations.address1%TYPE,
ship_to_pin_code hz_locations.postal_code%TYPE,
bill_to_pin_code hz_locations.postal_code%TYPE,
ship_to_number hz_cust_site_uses_all.LOCATION%TYPE,
bill_to_number hz_cust_site_uses_all.LOCATION%TYPE,
customer_number hz_cust_accounts.account_number%TYPE,
ea_license_number csi_iea_values.attribute_value%TYPE,
ea_va_sales_order_num csi_iea_values.attribute_value%TYPE,
master_organization_name hr_all_organization_units.NAME%TYPE );
TYPE tab_typ_ib_ecs_dat
IS
TABLE OF ib_ecs_dat_record INDEX BY binary_integer;
TYPE ib_parent_dat_record
IS
record
creation_date DATE,
last_update_date DATE,
order_line_id csi_item_instances.last_oe_order_line_id%TYPE,
inventory_item_id csi_item_instances.inventory_item_id%TYPE,
instance_id csi_item_instances.instance_id%TYPE,
instance_type_code csi_item_instances.instance_type_code%TYPE,
segment1 mtl_system_items_b.segment1%TYPE );
TYPE tab_typ_ib_parent_dat
IS
TABLE OF ib_parent_dat_record INDEX BY binary_integer;
--/*Record Type Declaration*/
-- TYPE parent_ib_record IS RECORD (
-- creation_date csi_item_instances.creation_date%TYPE,
-- last_update_date csi_item_instances.last_update_date%TYPE,
-- inventory_item_id csi_item_instances.inventory_item_id%TYPE,
-- instance_id csi_item_instances.instance_id%TYPE,
-- instance_type_code csi_item_instances.instance_type_code%TYPE,
-- segment1 mtl_system_items_b.segment1%type
-- TYPE tab_typ_par_ib_collection IS TABLE OF parent_ib_record
-- INDEX BY BINARY_INTEGER;
-- tab_par_ib_rec tab_typ_par_ib_collection;
v_segment1 mtl_system_items_b.segment1%TYPE;
v_request_id NUMBER := fnd_global.conc_request_id;
v_conc_prog_id NUMBER := fnd_global.conc_program_id;
v_created_by NUMBER := fnd_profile.VALUE('USER_ID');
v_last_update_login NUMBER := fnd_global.login_id;
v_to DATE := SYSDATE;
v_from DATE := SYSDATE-100;
v_count NUMBER := NULL;
-- v_header_id NUMBER := NULL;
-- v_line_id NUMBER := NULL;
-- v_org_id NUMBER := NULL;
-- v_ship_from_org_id NUMBER := NULL;
--v1.2 begin
-- v_master_org_id NUMBER := NULL;
-- v_item_type VARCHAR2(100) := null;
-- v_top_model_line_id NUMBER := NULL;
-- v_serial_tag_number VARCHAR2(100) := null;
TYPE tbl_req_start_date_type
IS
TABLE OF DATE INDEX BY pls_integer;
tbl_req_start_date tbl_req_start_date_type;
--v1.2 ends
--v1.3 starts
-- v_flow_status_code VARCHAR2(100) := null;
-- v_line_number NUMBER := NULL;
-- v_shipment_number NUMBER := NULL;
-- v_option_number NUMBER := NULL;
-- v_component_number NUMBER := NULL;
-- v_service_number NUMBER := NULL;
--v1.3 ends
-- v_model_string VARCHAR2(100) := NULL;
-- v_end_cust NUMBER := NULL;
-- v_end_cust_site_id NUMBER := NULL;
-- v_location_type_code VARCHAR2(100) := null;
-- v_location_id NUMBER := NULL;
-- v_tag VARCHAR2(100) := NULL;
-- v_inventory_item_status VARCHAR2(100) := NULL;
-- v_serial_number VARCHAR2(100) := NULL;
-- v_serial_return VARCHAR2(200) := NULL;
--rec_ext_attr Rec_Ext_Attr_type ;
v_ret_error_message VARCHAR2(2000):= NULL;
v_ret_error_flag VARCHAR2(1) := NULL;
v_error_message VARCHAR2(2000):= NULL;
v_error_flag VARCHAR2(1) := NULL;
v_error_at VARCHAR2(100) := NULL;
-- v_to1 DATE := sysdate;
-- v_from1 DATE := sysdate-45;
tab_ib_parent_dat tab_typ_ib_parent_dat;
tab_ib_ecs_dat tab_typ_ib_ecs_dat;
tab_ib_ecs_dat_c tab_typ_ib_ecs_dat;
BEGIN
print_log('*********************************************************************');
print_log('print log message 01');
print_log('Process Starts... : '||to_date(SYSDATE,'DD-MON-YYYY HH24:MI:SS'));
v_error_at := 'Start of the process';
fnd_client_info.set_org_context(i_org_id);
-- v1.2 begins, to get from date ----==----
BEGIN
print_log('print log message 02');
--OPEN get_from_date( v_request_id,v_conc_prog_id);
--FETCH get_from_date INTO v_from;
--CLOSE get_from_date;
v_error_at := 'main Process/ before from ';
-- v_from := Sysdate-15;
v_from := SYSDATE-45;
--Added v1.4 ,AND ARGUMENT1 = i_org_id
SELECT
/*+ index(a FND_CONCURRENT_REQUESTS_N6) index(a FND_CONCURRENT_REQUESTS_N7)*/
requested_start_date BULK COLLECT
INTO tbl_req_start_date
FROM fnd_concurrent_requests
WHERE request_id < v_request_id
AND concurrent_program_id = v_conc_prog_id
AND argument1 = i_org_id
AND status_code ='C'
AND phase_code ='C';
v_error_at := 'main Process/ after from selection ';
IF tbl_req_start_date.count >0 THEN
FOR i IN tbl_req_start_date.FIRST .. tbl_req_start_date.LAST
LOOP
IF v_from < tbl_req_start_date(i) THEN
v_from := tbl_req_start_date(i);
print_log( 'Tabel Req StartDate : '||tbl_req_start_date(i));
print_log( 'In the Loop VFrom : '||v_from);
END IF;
END LOOP;
END IF;
v_error_at := 'main Process/ after from Loop ';
print_log( 'Out the loop v_from is : '||v_from);
EXCEPTION
WHEN no_data_found THEN
print_log('Error in from_date process exception : '||sqlerrm);
print_log('Error at : '||v_error_at);
v_from := NULL;
WHEN OTHERS THEN
print_log('Error in from_date process exception : '||sqlerrm);
print_log('Error at : '||v_error_at);
v_from := NULL;
END;
-- v1.2 ends---==----
print_log('print log message 03');
BEGIN
OPEN cur_get_to_date ( v_request_id,v_conc_prog_id);
FETCH cur_get_to_date INTO v_to;
CLOSE cur_get_to_date;
--v1.3 starts
v_update_date := v_to -(1/86400);
--v1.3 ends
v_error_at := 'main Process/ after from and to date';
print_log('v_from1... : '||TO_CHAR(v_from,'DD-MON-YYYY HH24:MI:SS'));
print_log('v_to1 ... : '||TO_CHAR(v_to ,'DD-MON-YYYY HH24:MI:SS'));
--v1.3 starts
print_log('Updated v_to ... : '||TO_CHAR(v_update_date ,'DD-MON-YYYY HH24:MI:SS'));
--v1.3 ends
EXCEPTION
WHEN no_data_found THEN
print_log('Error in main process1 : '||sqlerrm);
print_log('Error at : '||v_error_at);
WHEN OTHERS THEN
print_log('Error in main process1 : '||sqlerrm);
print_log('Error at : '||v_error_at);
END;
BEGIN
print_log('print log message 04');
OPEN cur_get_parent_ib_rec(v_from ,v_to);
LOOP
print_log('After Loop Get Records v_from... : '||TO_CHAR(v_from,'DD-MON-YYYY HH24:MI:SS'));
print_log('After Loop Get Records v_to ... : '||TO_CHAR(v_to ,'DD-MON-YYYY HH24:MI:SS'));
FETCH cur_get_parent_ib_rec BULK COLLECT INTO tab_ib_parent_dat;
print_log('Parent Instance first : ');
-- FOR i IN 1 .. tab_ib_parent_dat.COUNT
print_log('print log message 05');
FOR i IN tab_ib_parent_dat.FIRST .. tab_ib_parent_dat.LAST
LOOP
BEGIN
print_log('Parent Instance : '||tab_ib_parent_dat(i).instance_id);
print_log('====================================================================');
v_error_at := 'main Process/ start of the loop';
v_ret_error_flag := NULL;
v_segment1 := NULL;
EXCEPTION
WHEN no_data_found THEN
print_log('Error in main process exception1 : '||sqlerrm);
print_log('Error at : '||v_error_at);
WHEN OTHERS THEN
print_log('Error in main process exception1 : '||sqlerrm);
print_log('Error at : '||v_error_at);
END;
OPEN cur_get_outbound_data(tab_ib_parent_dat(i).instance_id);
LOOP
FETCH cur_get_outbound_data BULK COLLECT INTO tab_ib_ecs_dat;
--FOR j IN 1 .. tab_ib_ecs_dat.COUNT
FOR j IN tab_ib_ecs_dat.FIRST .. tab_ib_ecs_dat.LAST
LOOP
BEGIN
BEGIN
SELECT COUNT(1)
INTO v_count
FROM apps.xxcsi_trex_ob_ecs_mhm
WHERE instance_id = NVL(tab_ib_ecs_dat_c(j).instance_id,'');
EXCEPTION
WHEN OTHERS THEN
v_count := 0;
END;
print_log('v_count : '||v_count);
IF v_count = 0 THEN
-- print_log('PARENT_DAT: '||NVL(tab_ib_ecs_dat(j).instance_id);
print_log('print log message 06');
INSERT
INTO xxcsi_trex_ob_ecs_mhm
instance_id,
instance_number,
inventory_item_id,
unit,
unit_name,
master_organization_id,
serial_number,
quantity,
uom,
active_start_date,
active_end_date,
install_date,
object_version_number,
last_vld_organization_id,
pre_registration_location,
order_header_id,
order_number,
order_line_id,
pre_registration_date,
pre_registration_operator,
bill_to_customer_name,
bill_to_site_id ,
bill_to_state ,
bill_to_country ,
bill_to_city ,
bill_to_location ,
ship_to_customer_name,
ship_to_site_id ,
ship_to_state ,
ship_to_country ,
ship_to_city ,
ship_to_location,
ship_to_pin_code,
bill_to_pin_code,
ship_to_number,
bill_to_number,
customer_number,
ea_license_number,
ea_va_sales_order_number,
parent_instance_id,
parent_y_n,
process_flag,
error_code,
error_details,
request_id,
created_by,
creation_date,
last_updated_by,
last_update_date,
last_update_login,
eai_process_flag,
master_organization_name,
system_id,
system_name
VALUES
NVL(tab_ib_ecs_dat(j).instance_id,''),
NVL(tab_ib_ecs_dat(j).instance_number,''),
NVL(tab_ib_ecs_dat(j).inventory_item_id,''),
NVL(tab_ib_ecs_dat(j).segment1,''),
NVL(tab_ib_ecs_dat(j).description,''),
NVL(tab_ib_ecs_dat(j).master_organization_id,''),
NVL(tab_ib_ecs_dat(j).serial_number,''),
NVL(tab_ib_ecs_dat(j).quantity,''),
NVL(tab_ib_ecs_dat(j).uom,''),
NVL(tab_ib_ecs_dat(j).active_start_date,''),
NVL(tab_ib_ecs_dat(j).active_end_date,''),
NVL(tab_ib_ecs_dat(j).install_date,''),
NVL(tab_ib_ecs_dat(j).obj_version_num,''),
NVL(tab_ib_ecs_dat(j).last_vld_organization_id,''),
NVL(tab_ib_ecs_dat(j).pre_registration_location,''),
NVL(tab_ib_ecs_dat(j).order_header_id,''),
NVL(tab_ib_ecs_dat(j).order_number,''),
NVL(tab_ib_ecs_dat(j).order_line_id,''),
NVL(tab_ib_ecs_dat(j).actual_shipment_date,''),
NVL(tab_ib_ecs_dat(j).email_address,''),
NVL(tab_ib_ecs_dat(j).bill_to_company_name,''),
NVL(tab_ib_ecs_dat(j).bill_to_site_id,''),
NVL(tab_ib_ecs_dat(j).bill_to_state,''),
NVL(tab_ib_ecs_dat(j).bill_to_country,''),
NVL(tab_ib_ecs_dat(j).bill_to_city,''),
NVL(tab_ib_ecs_dat(j).bill_to_location,''),
NVL(tab_ib_ecs_dat(j).ship_to_company_name,''),
NVL(tab_ib_ecs_dat(j).ship_to_site_id,''),
NVL(tab_ib_ecs_dat(j).ship_to_state,''),
NVL(tab_ib_ecs_dat(j).ship_to_country,''),
NVL(tab_ib_ecs_dat(j).ship_to_city,''),
NVL(tab_ib_ecs_dat(j).ship_to_location,''),
NVL(tab_ib_ecs_dat(j).ship_to_pin_code,''),
NVL(tab_ib_ecs_dat(j).bill_to_pin_code,''),
NVL(tab_ib_ecs_dat(j).ship_to_number,''),
NVL(tab_ib_ecs_dat(j).bill_to_number,''),
NVL(tab_ib_ecs_dat(j).customer_number,''),
NVL(tab_ib_ecs_dat(j).ea_license_number,''),
NVL(tab_ib_ecs_dat(j).ea_va_sales_order_num,''),
NULL,
'P',
'N',
NULL,
NULL,
v_request_id,
v_created_by,
SYSDATE,
v_created_by,
SYSDATE,
v_last_update_login,
'N',
NVL(tab_ib_ecs_dat(j).master_organization_name,''),
NVL(tab_ib_ecs_dat(j).system_id,''),
NVL(tab_ib_ecs_dat(j).system_name,'')
ELSE
Update apps.xxcsi_trex_ob_ecs_mhm set
instance_id=NVL(tab_ib_ecs_dat_c(j).instance_id,''),
instance_number= NVL(tab_ib_ecs_dat_c(j).instance_number,''),
inventory_item_id= NVL(tab_ib_ecs_dat_c(j).inventory_item_id,''),
unit = NVL(tab_ib_ecs_dat_c(j).segment1,''),
unit_name = NVL(tab_ib_ecs_dat_c(j).description,''),
master_organization_id=NVL(tab_ib_ecs_dat_c(j).master_organization_id,''),
--serial_number=NVL(tab_ib_ecs_dat_c(j).serial_number,''),
quantity= NVL(tab_ib_ecs_dat_c(j).quantity,''),
uom=NVL(tab_ib_ecs_dat_c(j).uom,''),
active_start_date= NVL(tab_ib_ecs_dat_c(j).active_start_date,''),
active_end_date= NVL(tab_ib_ecs_dat_c(j).active_end_date,''),
install_date= NVL(tab_ib_ecs_dat_c(j).install_date,''),
object_version_number=NVL(tab_ib_ecs_dat_c(j).obj_version_num,''),
last_vld_organization_id= NVL(tab_ib_ecs_dat_c(j).last_vld_organization_id,''),
pre_registration_location=NVL(tab_ib_ecs_dat_c(j).pre_registration_location,''),
order_header_id=NVL(tab_ib_ecs_dat_c(j).order_header_id,''),
order_number= NVL(tab_ib_ecs_dat_c(j).order_number,''),
order_line_id=NVL(tab_ib_ecs_dat_c(j).order_line_id,''),
pre_registration_date= NVL(tab_ib_ecs_dat_c(j).actual_shipment_date,''),
pre_registration_operator= NVL(tab_ib_ecs_dat_c(j).email_address,''),
bill_to_customer_name=NVL(tab_ib_ecs_dat_c(j).bill_to_company_name,''),
bill_to_site_id = NVL(tab_ib_ecs_dat_c(j).bill_to_site_id,''),
bill_to_state = NVL(tab_ib_ecs_dat_c(j).bill_to_state,''),
bill_to_country =NVL(tab_ib_ecs_dat_c(j).bill_to_country,''),
bill_to_city = NVL(tab_ib_ecs_dat_c(j).bill_to_city,''),
bill_to_location = NVL(tab_ib_ecs_dat_c(j).bill_to_location,''),
ship_to_customer_name=NVL(tab_ib_ecs_dat_c(j).ship_to_company_name,''),
ship_to_site_id = NVL(tab_ib_ecs_dat_c(j).ship_to_site_id,''),
ship_to_state =NVL(tab_ib_ecs_dat_c(j).ship_to_state,''),
ship_to_country=NVL(tab_ib_ecs_dat_c(j).ship_to_country,''),
ship_to_city =NVL(tab_ib_ecs_dat_c(j).ship_to_city,''),
ship_to_location= NVL(tab_ib_ecs_dat_c(j).ship_to_location,''),
ship_to_pin_code= NVL(tab_ib_ecs_dat_c(j).ship_to_pin_code,''),
bill_to_pin_code=NVL(tab_ib_ecs_dat_c(j).bill_to_pin_code,''),
ship_to_number=NVL(tab_ib_ecs_dat_c(j).ship_to_number,''),
bill_to_number= NVL(tab_ib_ecs_dat_c(j).bill_to_number,''),
customer_number= NVL(tab_ib_ecs_dat_c(j).customer_number,''),
ea_license_number= NVL(tab_ib_ecs_dat_c(j).ea_license_number,''),
ea_va_sales_order_number= NVL(tab_ib_ecs_dat_c(j).ea_va_sales_order_num,''),
parent_instance_id=NVL(tab_ib_parent_dat(i).instance_id,''),
parent_y_n='C',
process_flag='N',
error_code= NULL,
error_details= NULL,
request_id=v_request_id,
created_by=v_created_by,
creation_date= SYSDATE,
last_updated_by=v_created_by,
last_update_date=SYSDATE,
last_update_login= v_last_update_login,
eai_process_flag='Y',
master_organization_name=NVL(tab_ib_ecs_dat_c(j).master_organization_name,''),
system_id= NVL(tab_ib_ecs_dat_c(j).system_id,''),
system_name= NVL(tab_ib_ecs_dat_c(j).system_name,'')
WHERE instance_id = NVL(tab_ib_ecs_dat_c(j).instance_id,'');
END IF; --V_COUNT
EXCEPTION
WHEN no_data_found THEN
print_log('Error in inserting Parent Instance : '||tab_ib_ecs_dat(j).instance_id||': '||sqlerrm);
WHEN OTHERS THEN
print_log('Error in inserting Parent Instance : '||tab_ib_ecs_dat(j).instance_id||': '||sqlerrm);
END;
-- END LOOP;
END LOOP;
EXIT
WHEN cur_get_outbound_data%notfound;
END LOOP;
CLOSE cur_get_outbound_data;
print_log('print log message 07');
BEGIN
FOR rec_get_child_ib_rec IN cur_get_child_ib_rec
tab_ib_parent_dat(i).instance_id
LOOP
print_log
'cur_get_child_ib_rec : '||tab_ib_parent_dat(i).instance_id
OPEN cur_get_outbound_data(rec_get_child_ib_rec.subject_id);
LOOP
FETCH cur_get_outbound_data BULK COLLECT INTO tab_ib_ecs_dat_c;
-- tab_ib_ecs_dat_c1 := tab_ib_ecs_dat_c;
-- FOR k IN 1 .. tab_ib_ecs_dat_c.COUNT
FOR k IN tab_ib_ecs_dat_c.FIRST .. tab_ib_ecs_dat_c.LAST
LOOP
print_log('Child Instance : '||tab_ib_ecs_dat_c(k).instance_id);
-- BEGIN
BEGIN
SELECT COUNT(1)
INTO v_count
FROM apps.xxcsi_trex_ob_ecs_mhm
WHERE instance_id = NVL(tab_ib_ecs_dat_c(k).instance_id,'');
EXCEPTION
WHEN OTHERS THEN
v_count := 0;
END;
print_log('v_count : '||v_count);
IF v_count = 0 THEN
BEGIN
INSERT
INTO xxcsi_trex_ob_ecs_mhm
instance_id,
instance_number,
inventory_item_id,
unit,
unit_name,
master_organization_id,
serial_number,
quantity,
uom,
active_start_date,
active_end_date,
install_date,
object_version_number,
last_vld_organization_id,
pre_registration_location,
order_header_id,
order_number,
order_line_id,
pre_registration_date,
pre_registration_operator,
bill_to_customer_name,
bill_to_site_id ,
bill_to_state ,
bill_to_country ,
bill_to_city ,
bill_to_location ,
ship_to_customer_name,
ship_to_site_id ,
ship_to_state ,
ship_to_country ,
ship_to_city ,
ship_to_location ,
ship_to_pin_code,
bill_to_pin_code,
ship_to_number,
bill_to_number,
customer_number,
ea_license_number,
ea_va_sales_order_number,
parent_instance_id,
parent_y_n,
process_flag,
error_code,
error_details,
request_id,
created_by,
creation_date,
last_updated_by,
last_update_date,
last_update_login,
eai_process_flag,
master_organization_name,
system_id,
system_name
VALUES
NVL(tab_ib_ecs_dat_c(k).instance_id,''),
NVL(tab_ib_ecs_dat_c(k).instance_number,''),
NVL(tab_ib_ecs_dat_c(k).inventory_item_id,''),
NVL(tab_ib_ecs_dat_c(k).segment1,''),
NVL(tab_ib_ecs_dat_c(k).description,''),
NVL(tab_ib_ecs_dat_c(k).master_organization_id,''),
NVL(tab_ib_ecs_dat_c(k).serial_number,''),
NVL(tab_ib_ecs_dat_c(k).quantity,''),
NVL(tab_ib_ecs_dat_c(k).uom,''),
NVL(tab_ib_ecs_dat_c(k).active_start_date,''),
NVL(tab_ib_ecs_dat_c(k).active_end_date,''),
NVL(tab_ib_ecs_dat_c(k).install_date,''),
NVL(tab_ib_ecs_dat_c(k).obj_version_num,''),
NVL(tab_ib_ecs_dat_c(k).last_vld_organization_id,''),
NVL(tab_ib_ecs_dat_c(k).pre_registration_location,''),
NVL(tab_ib_ecs_dat_c(k).order_header_id,''),
NVL(tab_ib_ecs_dat_c(k).order_number,''),
NVL(tab_ib_ecs_dat_c(k).order_line_id,''),
NVL(tab_ib_ecs_dat_c(k).actual_shipment_date,''),
NVL(tab_ib_ecs_dat_c(k).email_address,''),
NVL(tab_ib_ecs_dat_c(k).bill_to_company_name,''),
NVL(tab_ib_ecs_dat_c(k).bill_to_site_id,''),
NVL(tab_ib_ecs_dat_c(k).bill_to_state,''),
NVL(tab_ib_ecs_dat_c(k).bill_to_coun
The logic is:
1. Create any new lookup table rows that may be needed
2. Create new data rows that reference the lookup table
All you did was post a buch of code. You didn't post ANYTHING that shows how you executed that code or what the result was.
You need to SHOW US (not tell us):
1. WHAT you do
2. HOW you do it
3. WHAT results you get
4. WHAT results you expected to get
The code you posted has some SERIOUS ISSUES. Here are just three of them
1. You are using BULK COLLECT without a LIMIT clause
2. You are using unnecessary IF . . .COUNT statements to test collections for values. The FOR clause will simply NOT execute if the collection is empty so the IF statements add unnecessary clutter.
3. The first loop iterates a collection but sets a single SCALAR value - making that loop totally USELESS
LOOP
IF v_from < tbl_req_start_date(i) THEN
v_from := tbl_req_start_date(i);
print_log( 'Tabel Req StartDate : '||tbl_req_start_date(i));
print_log( 'In the Loop VFrom : '||v_from);
END IF;
END LOOP;
That checks EVERY row in the collection and appears to save the MAX value of 'tbl_req_state_date' into the 'v_from' variable.
What is the point of that?
Similar Messages
-
after there being an error in trying to update the software it said i have to restore my phone which i have done but says time remaining is about 24 hours . can you please help ? i just want to switch my phone on again .
Hello lyndsey1430,
From what I can gather, it sounds like you're having issues restoring your device. After reviewing your post, I have located an article that can help in this situation. It contains helpful advice concerning recovery mode:
If you can't update or restore your iPhone, iPad, or iPod touch
Use recovery mode
You might need to use recovery mode to restore your device in these cases:
iTunes doesn't recognize your device or says it's in recovery mode.
You see the Apple logo onscreen for several minutes with no progress bar.
You see the Connect to iTunes screen.
Learn what to do if you see the progress bar onscreen for several minutes.
To put your device into recovery mode, follow these steps:
Turn off your device and leave it off.
Plug in your device's USB cable to a computer with iTunes.
Hold down the Home button on your device as you connect the USB cable. Keep holding down the Home button until you see the Connect to iTunes screen.
When you see this screen, release the Home button. If you don't see this screen, try steps 1 through 3 again.
When your device is connected, iTunes will open. You'll see a message saying that iTunes has detected an iPhone, iPad, or iPod touch in recovery mode.
Use iTunes to restore your device. Restoring in recovery mode will erase your device. If you previously synced with iTunes or iCloud, you might be able to restore from your backup.
Get more help
Learn what to do if you don't see your device in iTunes for OS X, or in iTunes for Windows.
If you put your device into recovery mode by mistake, restart it. Or you can wait 15 minutes and your device will exit recovery mode by itself.
Thank you for contributing to Apple Support Communities.
Cheers,
BobbyD -
select fu.user_id,
fu.user_name,
hcp_phone1.phone_number primary_phone_number ,
hcp_phone1.last_update_date cnts_last_update_date,
fu.last_update_date user_last_update_date,
(select hcp_phone2.phone_number
from ar.hz_contact_points hcp_phone2
where hcp_phone2.contact_point_type(+) = 'PHONE'
and hcp_phone2.status(+) = 'A'
and hp.party_id =hcp_phone2.owner_table_id(+)
and hcp_phone2.owner_table_name(+) ='HZ_PARTIES'
and hcp_phone2.primary_flag = 'N'
and rownum = 1
) secondary_phone_number,
(select hcp_email.email_address
from ar.hz_contact_points hcp_email
where hcp_email.contact_point_type(+) = 'EMAIL'
and hcp_email.status(+) = 'A'
and hp.party_id =hcp_email.owner_table_id(+)
and hcp_email.owner_table_name(+) ='HZ_PARTIES'
and hcp_email.primary_flag = 'Y'
) email_address,
hp.person_first_name ,
hp.person_middle_name ,
hp.person_last_name ,
hp.party_name,
hp.person_title ,(
nvl(hp.address1,' ') ||
nvl(hp.address2,' ') ||
nvl(hp.address3,' ') ||
nvl(hp.address4,' ')
) address1,
hp.city,
hp.state ,
hp.country ,
hp.postal_code,
' ' industry_group,
from fnd_user fu,
ar.hz_parties hp,
fnd_user_resp_groups furg,
fnd_responsibility_tl frt,
ar.hz_contact_points hcp_phone1
where hp.party_id =fu.person_party_id
and furg.user_id =fu.user_id
-- and ( to_date(fu.last_update_date,'dd-mm-yyyy') > to_date(nvl(p_in_date,sysdate),'dd-mm-yyyy')
-- or to_date(hcp_phone1.last_update_date,'dd-mm-yyyy')> to_date(nvl(p_in_date,sysdate),'dd-mm-yyyy')
and furg.responsibility_id = frt.responsibility_id
and frt.responsibility_name = 'EMR IBE Customer PSG US'
and frt.language = 'US'
and hcp_phone1.contact_point_type(+) = 'PHONE'
and hcp_phone1.status(+) = 'A'
and hp.party_id =hcp_phone1.owner_table_id(+)
and hcp_phone1.owner_table_name(+) ='HZ_PARTIES'
and hcp_phone1.primary_flag = 'Y';SELECT d.NAME
FROM
(SELECT jta.NAME
FROM apps.jtf_terr_values_all jtva,
apps.jtf_terr_qual_all jtqa,
apps.jtf_terr_all jta ,
apps.hz_party_sites ps,
apps.hz_locations hl
WHERE jtva.terr_qual_id = jtqa.terr_qual_id
AND jtqa.terr_id = jta.terr_id
AND jtva.low_value_char = hl.postal_code
AND jtqa.org_id = jtva.org_id
AND jta.org_id = jtqa.org_id
AND ps.location_id = hl.location_id
AND hl.country in( 'CA', 'US')) D;
UNION
SELECT jta.NAME
FROM apps.jtf_terr_values_all jtva,
apps.jtf_terr_qual_all jtqa,
apps.jtf_terr_all jta,
apps.hz_party_sites ps,
apps.hz_locations hl
WHERE jtva.terr_qual_id = jtqa.terr_qual_id
AND jtqa.terr_id = jta.terr_id
AND ps.location_id = hl.location_id
AND jtqa.org_id = jtva.org_id
AND jta.org_id = jtqa.org_id
AND hl.country = 'US'
AND hl.postal_code BETWEEN jtva.low_value_char AND jtva.high_value_char
)d; -
I have a huge file which is in GB and I want to split the video into clip and export each clip individually. Can you please help me how to split and export the videos to computer? It will be of great help!!
video
What version of Premiere Elements do you have and on what computer operating system is it running?
Please review the following workflow.
ATR Premiere Elements Troubleshooting: PE11: Project Assets Organization for Scene and Highlight Grabs from Collection o…
But please also determine if your project goal is supported by
a. format of your source
and
b. computer resources
More later based on details that you will post.
ATR -
HI Experts,
I have a scenario. Import IDOC into PI and PI transform IDOC to Excel. Using mail adapter attach that Excel using pi and send to vendor. Can you please help me on the same?
Thanks
SaiSreevastavHi Sai,
you can use XSLT or java mapping or adapter module to convert IDOC xml to XLS. Please refer the below blog
Convert incoming XML to Excel or Excel XML – Part 1 - XSLT Way
Convert incoming XML to Excel Sheet Part 2 – Adapter Module way
Convert incoming XML to Excel Sheet
then after converting to Excel, you can use the payloadswap bean in mail adapter
XI: Sender mail adapter - PayloadSwapBean - Step by step
regards,
Harish -
Up until about a month ago I was able to shrink my photos with shrink pic. I use yahoo for my emails and since they did an update I can no longer shrink my photos using Mozilla Firefox. I thought this was a yahoo problem but yesterday I tried Internet Explorer with yahoo and shrink pic is working in their format. Can you please help?
> I am running Windows 2000 and LabVIEW 6i which is some student version
> of LabVIEW. I have a AT-MIO-16E-10 DAQ card installed on this
> computer. MAX sees the DAQ and when I test it, everything works
> great. However, when I start a new VI, the Acquire Waveforms subVI
> will not work. There is one VI about 5 layers deep that says that the
> Code interface nodes and Call library function are not supported by
> this version of LabVIEW. Is there anything I can do to fix this
> problem? Please help!
It sounds like you are running the student edition which comes with a
textbook and doesn't support external code such as DLLs, CINs, or
ActiveX. You might want to check with others at your university and see
about getting access to an academic edition or a
full edition.
Greg McKaskle -
I would like to build a desktop computer for video editing, business management and online learning and also have a small laptop, tablet or ipad to take to university, Can someone please advise me of the best set up for this?
Let's see if I understand this... You're asking for advice on building a desktop computer, in the Apple developer's forum? Why not just buy a Mac?
-
How to insert a value into a table
I have an ordering system. It displays all the orders by
customer ID. If an order is complete, a check number is entered for
the corresponding line item, otherwise it is left blank.
My code uses the following code to display the form. All are
display fields only, except for the last one, where the check
number can be entered.
<cfoutput query="qryDetail" group="partNumber">
<tr>
<td valign="top" class="TitleText"
align="center">#lineItem#</td>
<td valign="top" class="TitleText"
align="center">#OrderNumber#</td>
<td valign="top" class="TitleText"
align="center">#partNumber#</td>
<td valign="top" class="TitleText"
align="center">#dollarformat(qryDetail.unitValue)#</td>
<td valign="top" class="TitleText" align="center">
<cfinput type="text" name="checkNumber#keyID#">
<input type="hidden" name="keyID"
value="#qryDetail.keyID#">
</td>
I use something like the following to update the table with
the check numbers entered.
<cfloop index="KeyID" list="#form.KeyID#"
delimiters=",">
<cfquery name="qryUpdate" datasource="dbName">
update tblChecks
set checkNumber = '#Evaluate("form.checkNumber#KeyID#")#'
where custID = '#form.custID#'
and KeyID = '#KeyID#'
</cfquery>
</cfloop>
Now we have another table that will contain the customer
order history. If the check number was entered for a particular
line item, I need to insert that line item nubmer into this table,
along with some other columns. I tried to use the same loop, then
other loops, but cannot seem to get this to work. Seems simple
enough, but I obvisouly am missing something.
How would I insert the line item number (only if a check
number was entered for that line item) into the table ?Here is the code with the queries commented out :
<cfloop list="#form.fieldnames#" index="field">
<cfif left(field, 11) is "checkNumber" AND
len(trim(form[field]))>
<cfset keyID = listlast(field, '_')>
<cfset lineItem = listgetat(field, 2, '_')>
<cfset checknum = form[field]>
<!---cfquery name="qryUpdate" datasource="dbName">
UPDATE tblChecks
SET checkNumber = '#checknum#'
WHERE custID = #form.custID#
AND KeyID = #keyid#
</cfquery--->
<cfoutput> loop is
field: <b>#field#</b><br>
checknum: #checknum#<br>
lineitem: #lineitem#<br>
keyID: #keyID#<br>
</cfoutput>
<cfelse>
<cfoutput>Else is
field: <b>#field#</b><br>
form[field]: #form[field]#<br>
len: #len(trim(form[field]))#<br>
</cfoutput><cfabort>
</cfif>
</cfloop>
This is the output. If I do not put in cfabort, the code just
drops thru and I never see any output display, so I use cfabort to
stop so I can see the output.
loop is field: CHECKNUMBER_11_218
CHECKNum: xxxxxxxxxxxxxxxxxxxx
lineitem: 11
keyID: 218
Else is field: CHECKNUMBER_1_24
form[field]:
I entered the x's into checknum for line item 11, so that is
correct.
I then took out the comments from the update query and tried
it again and it updated for line item 11 (you were right, I had to
take out the single quotes in the query). I then removed the
commets for the insert query and it did not insert. I tried the
whole thing again and tried to add to line item 10 and it dropped
straight to the else part, displaying :
Else is field: CHECKNUMBER_1_24
form[field]:
len: 0
So it seems the if statement if failing the second time thru
the loop :
<cfif left(field, 11) is "checkNumber" AND
len(trim(form[field]))>
This is my input statement :
<cfinput type="text"
name="checkNumber_#lineItem#_#keyID#">
I am really confused now. It seems to work the first time
thru the loop, then the second time it fails. -
I dont want to erase the iPod so can please help me?
As teh manual says, you will have to restore your ipod.
-
I purchased a MacBook Air in July, 2013. I have later learnt that Apple has made iWorks free for OSX Mavericks users. However, the App Store still shows the package as paid for me. I want to know a way of downloading it for free.
http://www.apple.com/creativity-apps/mac/up-to-date/
-
Hello . jus ask for help. I installed 2 Denon receivers AVR 2112ci. This amplifiers says built in airplay feature. I can not do anything. The airplay con not appears at Itunes in my toshiba lap, and same happen with my iPhone and with Ipad. Some says that we need to turn on Home sharing . I did it, but icon still missing.
The only thing that i want is stream my music with Denon amplifiers at those 2 diferrent zones.
Please any help ?Hello . jus ask for help. I installed 2 Denon receivers AVR 2112ci. This amplifiers says built in airplay feature. I can not do anything. The airplay con not appears at Itunes in my toshiba lap, and same happen with my iPhone and with Ipad. Some says that we need to turn on Home sharing . I did it, but icon still missing.
The only thing that i want is stream my music with Denon amplifiers at those 2 diferrent zones.
Please any help ? -
How to insert Legacy data into QP_RLTD_MODIFIERS table?
How to insert Legacy data into QP_RLTD_MODIFIERS table in R12 instance.
I would use the API QP_Modifiers_PUB.Process_Modifiers for pushing legacy pricing data into R12. QP_RLTD_MODIFIERS is only used for certain types of discounts (in my prod environnment, only promos have data in this table).
-
HI
I have 2 IPads, I am unable to use one of it because I have forgotten my pass code and also logged out from iCloud accidentially. Can you please help me to solve this problem.
Cheers
RaveenaFollow the instructions on this page : Forgot passcode for your iPhone, iPad, or iPod touch, or your device is disabled - Apple Support
-
my iphone 4 turned off by itself and will not turn back on. i have tried to 2 methods of recharge and it will not turn on. can you please help?
my iphone 4 turned off by itself and will not turn back on. i have tried to 2 methods of recharge and it will not turn on. can you please help?
-
Need to update row in the table if any one of the value is getting updated
Hi All,
I am new to SQL, I need to update the table's row if any one of the value of the row is getting updated, if none of the value is updated then do nothing.
Advice requestedIt is not clear what you meant... Perhaps a trigger
CREATE TRIGGER ShowUpdatedColumns ON Test FOR UPDATE
AS
DECLARE @ColumnID int, @Columns nvarchar(4000), @ObjectID int, @LastColumnID int
SET @ObjectID=(SELECT id FROM sysobjects WHERE name='test')
SET @LastColumnID=(SELECT MAX(colid) FROM syscolumns WHERE id=@ObjectID)
SET @ColumnID=1
WHILE @ColumnID<=@LastColumnID BEGIN
IF (SUBSTRING(COLUMNS_UPDATED(),(@ColumnID - 1) / 8 + 1, 1)) &
POWER(2, (@ColumnID - 1) % 8) = POWER(2, (@ColumnID - 1) % 8)
SET @Columns = ISNULL(@Columns+',','') + COL_NAME(@ObjectID,@ColumnID)
SET @ColumnID=@ColumnID+1
END
PRINT 'Updated columns are :' + @Columns
Best Regards,Uri Dimant SQL Server MVP,
http://sqlblog.com/blogs/uri_dimant/
MS SQL optimization: MS SQL Development and Optimization
MS SQL Consulting:
Large scale of database and data cleansing
Remote DBA Services:
Improves MS SQL Database Performance
SQL Server Integration Services:
Business Intelligence
Maybe you are looking for
-
Where can I obtain the AHT on disk for my Mac Pro 4.1?
Where can I obtain a disk (iso) of the AHT for my Mac Pro 4.1 (latest OS X Yosemite) that I am busy upgrading?
-
How do I re-install the OS and keep all data?
I have K9 WebProtection and forgot which e-mail address I signed up with (as well as admin password..stupid I know). Today it blocked yahoo and google (it isn't supposed to block anything but adult material which we needed when my son still lived wit
-
How do I unlock iphone 4s to change provider?
Question; How do I unlock iphone 4S?
-
Hello SD Gurus, I have a basic question about customer invoice. I have been in sales for about five years but new to SAP. I was reading through some documentation on how to post invoices. But the way I have always seen it done in an organization is e
-
IPhone Update from different computer
I am currently overseas in Spain but did not bring my MacBook that I sync my iPhone with. I was wondering if I will be able to install the 2.0 update connecting to my friends laptop which has iTunes. I won't be back in the states for another 2 months