Wednesday, February 23, 2022

Script to Find All Sundays Date for a given Date Within that Year

DECLARE
   l_date       DATE := '&P_ENTER_ANY_DATE';
   l_first_sunday   DATE;
   l_last_sunday    DATE;
BEGIN
   --Find 1st Sunday
   l_first_sunday := NEXT_DAY (TRUNC (l_date, 'YYYY') - 1, 'SUN');
   --Find last Sunday
   l_last_sunday := NEXT_DAY (ADD_MONTHS (TRUNC (l_date, 'YYYY') - 1, 12), 'SUN') - 7;

   WHILE l_first_sunday <= l_last_sunday
   LOOP
      DBMS_OUTPUT.PUT_LINE ( l_first_sunday);
      l_first_sunday := l_first_sunday + 7;
   END LOOP;
END;

1 comment:

SupplierAddressImportTemplate.xlsm South Africa Suburb Field mapping in POZ_SUPPLIER_ADDRESSES_INT

Suburb mpping in Supplier Address Import Template will be mapped to Address Element Attribute2 (HZ_LOCATIONS. ADDR_ELEMENT_ATTRIBUTE2)