کوئری زیر اطلاعات مربوط به بیمه شدگان دارای تاریخ اعتبار بین 13990701 و 14000101 را استخراج کرده و آماده تغییر می کند.
create table sharifi.bku_changeAccountValidationV1_13990807 as select -- count(1) a.id, a.membernn, product_id, to_char(validfrom, 'yyyymmdd', 'nls_calendar=persian') validfrom, to_char(validto, 'yyyymmdd', 'nls_calendar=persian') validto, a.status from ticpfamily f,ticpmember m,OMID.ticpaccount a where f.id=m.familyowner_id and m.id=a.memberowner_id and product_id <>6 and trunc(validto) >=to_date('13990701', 'yyyymmdd', 'nls_calendar=persian') and trunc(validto) <to_date('14000101', 'yyyymmdd', 'nls_calendar=persian') and a.status in ('D') and a.dto is null and f.dto is null and m.dto is null;
بعد از استخراج اطلاعات، کوئری زیر را جهت افزایش اعتبار استفاده می کنیم.
declare v_result number; begin for v_cur in ( select s.* from sharifi.bku_changeAccountValidationV1_13990807 s,ticpaccount a where s.id=a.id and a.status='D' and nvl(a.isactive,'Y')='Y'--8290267 )loop v_result:=pkgacountmanagement.fncchangeaccountvalidation(v_cur.id ,TO_DATE('14000131', 'YYYYMMDD', 'NLS_CALENDAR = PERSIAN') ,'افزایش اعتبار پیرو نامه سازمان مورخ 13990719 جهت پیشگیری از شیوع کرونا'); if (v_result!=1) then DBMS_OUTPUT.PUT_LINE(v_cur.Id || ':' || v_result); end if; end loop; end;