Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- else -- wbs record doesn't exist
- update oc_poi_load_data
- set existing_record = 'N'
- where oc_poi_load_data_id = r_ld.oc_poi_load_data_id;
- commit;
- -- search the last active POI with name=r_ld.poi_name
- if r_ld.poi_short_name is not null
- then
- select max(p.poi_id)
- into v_poi_id
- from oc_poi p
- where p.oc_poi_category_id = v_oc_poi_category_id
- and p.oc_poi_status_id = 0
- and TRIM (UPPER(r_ld.poi_short_name)) = TRIM (UPPER(p.short_name));
- else
- select max(p.poi_id)
- into v_poi_id
- from oc_poi p
- where p.oc_poi_category_id = v_oc_poi_category_id
- and p.oc_poi_status_id = 0
- and TRIM (UPPER(r_ld.poi_name)) = TRIM (UPPER(p.name));
- end if;
- if v_poi_id is not null
- then
- -- add the WBS to the POI
- if r_ld.ref_number is not null and (r_ld.to_date is null or r_ld.to_date > trunc (sysdate))
- then
- addWBS(v_poi_id, r_ld.wbs_name, '', r_ld.from_date, r_ld.to_date, r_ld.ref_number, sysdate, r_ld.tin);
- end if;
- commit;
- p_db_trc.trc(11000, 'Ref Number created v_nbr_poi_id <> 1 ' || r_ld.ref_number);
- commit;
- -- update the POI
- select street, street_nr, post_code, location, country, short_name
- into v_street, v_street_nr, v_post_code, v_location, v_country, v_poi_short_name
- from oc_poi
- where poi_id = v_poi_id;
- if (v_street is null and v_post_code is null and v_location is null)
- then
- updatePoiAddr(v_poi_id,r_ld.street, r_ld.street_nr, r_ld.post_code, r_ld.location, r_ld.country);
- p_db_trc.trc(11000, 'POI ' || to_char(v_poi_id) || ' v_nbr_poi_id <> 1 address updated');
- commit;
- end if;
- updateStatusOnWbsToDate(v_poi_id, sysdate);
- commit;
- end if;
- if v_poi_id is null and (r_ld.to_date is null or r_ld.to_date > sysdate)
- then
- -- create the POI
- v_poi_id := createPoi(v_oc_poi_category_id, r_ld.poi_short_name, r_ld.poi_name);
- updatePoiAddr(v_poi_id,r_ld.street, r_ld.street_nr, r_ld.post_code, r_ld.location, r_ld.country);
- p_db_trc.trc(11000, 'POI created v_nbr_poi_id <> 1 ' || r_ld.poi_name);
- commit;
- update oc_poi
- set contact_first_name=r_ld.poi_contact_first_name, contact_last_name=r_ld.poi_contact_last_name, contact_phone=r_ld.poi_contact_phone, lm_date = sysdate
- where poi_id = v_poi_id;
- -- add the WBS to the POI
- if r_ld.ref_number is not null and (r_ld.to_date is null or r_ld.to_date > trunc (sysdate))
- then
- addWBS(v_poi_id, r_ld.wbs_name, '', r_ld.from_date, r_ld.to_date, r_ld.ref_number, sysdate, r_ld.tin);
- end if;
- p_db_trc.trc(11000, 'Ref Number created v_nbr_poi_id <> 1 ' || r_ld.ref_number);
- commit;
- end if;
- end if; -- wbs record(s) exist
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement