October 13, 2015

Delete Element and its link to Assignment

declare
CURSOR   rec_check is
select  peef.ELEMENT_ENTRY_ID,peef.EFFECTIVE_START_DATE,peef.OBJECT_VERSION_NUMBER,paaf.ASSIGNMENT_NUMBER
 from
pay_element_entries_f peef,
pay_element_types_f petf,
pay_element_links_f pelf,
per_all_assignments_f paaf
where petf.ELEMENT_TYPE_ID=pelf.ELEMENT_TYPE_ID
and peef.ELEMENT_LINK_ID=pelf.ELEMENT_LINK_ID
and peef.ELEMENT_TYPE_ID=petf.ELEMENT_TYPE_ID
and peef.ASSIGNMENT_ID=paaf.ASSIGNMENT_ID
and petf.ELEMENT_NAMe='Final Processing'
and  sysdate between paaf.effective_start_date and paaf.effective_end_date
and  sysdate between petf.effective_start_date and petf.effective_end_date
and  sysdate between peef.effective_start_date and peef.effective_end_date
and  sysdate between pelf.effective_start_date and pelf.effective_end_date;

v_object_version_number number:=1;
v_start_date date:=null;
v_end_date date:=null;
v_delete_wrg boolean ;
v_date date:=null;
begin
FOR cur in rec_check
loop
dbms_output.put_line(1);
begin
pay_element_entry_api.delete_element_entry
(p_validate=>false
,p_datetrack_delete_mode =>'ZAP'
,p_effective_date =>cur.EFFECTIVE_START_DATE---TO_DATE('22-06-2008','DD-MM-YYYY')--v_date
,p_element_entry_id =>cur.ELEMENT_ENTRY_ID
,p_object_version_number =>v_object_version_number
,p_effective_start_date =>v_start_date
,p_effective_end_date =>v_end_date
,p_delete_warning =>v_delete_wrg
);
dbms_output.put_line('Done');
EXCEPTION
when others then
dbms_output.put_line(sqlcode||sqlerrm||'Assignment'||cur.ASSIGNMENT_NUMBER);
end;
end loop;

end;


commit;

No comments:

Post a Comment

Thanks for your comments submitted.,will review and Post soon! by admin.

COALESCE-SQL

Coalesce- return the null values from the expression. It works similar to a case statement where if expression 1 is false then goes to expr...