declare v_count number(5); v_role_name varchar2(100); v_user_name varchar2(100); v_buyer_end_date date; begin select category_name,BUYER_END_DATE into v_role_name,v_buyer_end_date-- into v_count from XX_ITEM_CAT_BUYER where buyer_end_date = trunc(sysdate); if v_buyer_end_date = trunc(sysdate) then WF_DIRECTORY.RemoveUsersFromAdHocRole(v_role_name); dbms_output.put_line('end date reached to sysdate'); else null; dbms_output.put_line('end date is not entered'); end if; exception when no_data_found then dbms_output.put_line('No data found'); when others then dbms_output.put_line(sqlerrm); end;