DBA Data[Home] [Help]

APPS.BEN_EXT_UTIL dependencies on DUAL

Line 1592: into l_rslt_dt from dual ;

1588: elsif p_ext_date_cd = 'PM' then
1589: -- Perivious Monday
1590: select trunc(p_abs_date-(to_number(to_char((p_abs_date),'D')) -2)
1591: -decode(greatest((to_number(to_char(p_abs_date,'D')) -2),0.99) ,0.99,7,0))
1592: into l_rslt_dt from dual ;
1593:
1594: elsif p_ext_date_cd = 'PT' then
1595: -- Perious Tuesday
1596: select trunc(p_abs_date-(to_number(to_char((p_abs_date),'D')) -3)

Line 1598: into l_rslt_dt from dual ;

1594: elsif p_ext_date_cd = 'PT' then
1595: -- Perious Tuesday
1596: select trunc(p_abs_date-(to_number(to_char((p_abs_date),'D')) -3)
1597: -decode(greatest((to_number(to_char(p_abs_date,'D')) -3),0.99) ,0.99,7,0))
1598: into l_rslt_dt from dual ;
1599: elsif p_ext_date_cd = 'PW' then
1600: -- Perivious Wednesday
1601: select trunc(p_abs_date-(to_number(to_char((p_abs_date),'D')) -4)
1602: -decode(greatest((to_number(to_char(p_abs_date,'D')) -4),0.99) ,0.99,7,0))

Line 1603: into l_rslt_dt from dual ;

1599: elsif p_ext_date_cd = 'PW' then
1600: -- Perivious Wednesday
1601: select trunc(p_abs_date-(to_number(to_char((p_abs_date),'D')) -4)
1602: -decode(greatest((to_number(to_char(p_abs_date,'D')) -4),0.99) ,0.99,7,0))
1603: into l_rslt_dt from dual ;
1604:
1605: elsif p_ext_date_cd = 'PTH' then
1606: -- Perivious THURSDAY
1607: select trunc(p_abs_date-(to_number(to_char((p_abs_date),'D')) -5)

Line 1609: into l_rslt_dt from dual ;

1605: elsif p_ext_date_cd = 'PTH' then
1606: -- Perivious THURSDAY
1607: select trunc(p_abs_date-(to_number(to_char((p_abs_date),'D')) -5)
1608: -decode(greatest((to_number(to_char(p_abs_date,'D')) -5),0.99) ,0.99,7,0))
1609: into l_rslt_dt from dual ;
1610:
1611: elsif p_ext_date_cd = 'PF' then
1612: -- Perivious FRIDAY
1613: select trunc(p_abs_date-(to_number(to_char((p_abs_date),'D')) -6)

Line 1615: into l_rslt_dt from dual ;

1611: elsif p_ext_date_cd = 'PF' then
1612: -- Perivious FRIDAY
1613: select trunc(p_abs_date-(to_number(to_char((p_abs_date),'D')) -6)
1614: -decode(greatest((to_number(to_char(p_abs_date,'D')) -6),0.99) ,0.99,7,0))
1615: into l_rslt_dt from dual ;
1616:
1617: elsif p_ext_date_cd = 'PSA' then
1618: -- Perivious SATURDAY
1619: select trunc(p_abs_date-(to_number(to_char((p_abs_date),'D')) -7)

Line 1621: into l_rslt_dt from dual ;

1617: elsif p_ext_date_cd = 'PSA' then
1618: -- Perivious SATURDAY
1619: select trunc(p_abs_date-(to_number(to_char((p_abs_date),'D')) -7)
1620: -decode(greatest((to_number(to_char(p_abs_date,'D')) -7),0.99) ,0.99,7,0))
1621: into l_rslt_dt from dual ;
1622:
1623: elsif p_ext_date_cd = 'PSU' then
1624: -- Perivious SUNDAY
1625: select trunc(p_abs_date-(to_number(to_char((p_abs_date),'D')) -8)

Line 1627: into l_rslt_dt from dual ;

1623: elsif p_ext_date_cd = 'PSU' then
1624: -- Perivious SUNDAY
1625: select trunc(p_abs_date-(to_number(to_char((p_abs_date),'D')) -8)
1626: -decode(greatest((to_number(to_char(p_abs_date,'D')) -8),0.99) ,0.99,7,0))
1627: into l_rslt_dt from dual ;
1628: --RCHASE - Bug 1550072 - Add new date calc codes
1629: -- tilak changed the sysdate to p_abs_date
1630: --added Next day - NM, NT, NW, NTH, NF, NSA, NSU
1631: --added Day of next week - MONW, TONW, WONW, THONW, FONW, SAONW, SUONW

Line 1639: into l_rslt_dt from dual;

1635: elsif p_ext_date_cd = 'NM' then
1636: -- Next Monday
1637: select trunc(p_abs_date-(to_number(to_char((p_abs_date),'D')) -2)
1638: +decode(greatest(2-(to_number(to_char(p_abs_date,'D'))),0.99) ,0.99,7,0))
1639: into l_rslt_dt from dual;
1640: elsif p_ext_date_cd = 'NT' then
1641: -- Next Tuesday
1642: select trunc(p_abs_date-(to_number(to_char((p_abs_date),'D')) -3)
1643: +decode(greatest(3-(to_number(to_char(p_abs_date,'D'))),0.99) ,0.99,7,0))

Line 1644: into l_rslt_dt from dual;

1640: elsif p_ext_date_cd = 'NT' then
1641: -- Next Tuesday
1642: select trunc(p_abs_date-(to_number(to_char((p_abs_date),'D')) -3)
1643: +decode(greatest(3-(to_number(to_char(p_abs_date,'D'))),0.99) ,0.99,7,0))
1644: into l_rslt_dt from dual;
1645: elsif p_ext_date_cd = 'NW' then
1646: -- Next Wednesday
1647: select trunc(p_abs_date-(to_number(to_char((p_abs_date),'D')) -4)
1648: +decode(greatest(4-(to_number(to_char(p_abs_date,'D'))),0.99) ,0.99,7,0))

Line 1649: into l_rslt_dt from dual;

1645: elsif p_ext_date_cd = 'NW' then
1646: -- Next Wednesday
1647: select trunc(p_abs_date-(to_number(to_char((p_abs_date),'D')) -4)
1648: +decode(greatest(4-(to_number(to_char(p_abs_date,'D'))),0.99) ,0.99,7,0))
1649: into l_rslt_dt from dual;
1650: elsif p_ext_date_cd = 'NTH' then
1651: -- Next THURSDAY
1652: select trunc(p_abs_date-(to_number(to_char((p_abs_date),'D')) -5)
1653: +decode(greatest(5-(to_number(to_char(p_abs_date,'D'))),0.99) ,0.99,7,0))

Line 1654: into l_rslt_dt from dual;

1650: elsif p_ext_date_cd = 'NTH' then
1651: -- Next THURSDAY
1652: select trunc(p_abs_date-(to_number(to_char((p_abs_date),'D')) -5)
1653: +decode(greatest(5-(to_number(to_char(p_abs_date,'D'))),0.99) ,0.99,7,0))
1654: into l_rslt_dt from dual;
1655: elsif p_ext_date_cd = 'NF' then
1656: -- Next FRIDAY
1657: select trunc(p_abs_date-(to_number(to_char((p_abs_date),'D')) -6)
1658: +decode(greatest(6-(to_number(to_char(p_abs_date,'D'))),0.99) ,0.99,7,0))

Line 1659: into l_rslt_dt from dual;

1655: elsif p_ext_date_cd = 'NF' then
1656: -- Next FRIDAY
1657: select trunc(p_abs_date-(to_number(to_char((p_abs_date),'D')) -6)
1658: +decode(greatest(6-(to_number(to_char(p_abs_date,'D'))),0.99) ,0.99,7,0))
1659: into l_rslt_dt from dual;
1660: elsif p_ext_date_cd = 'NSA' then
1661: -- Next SATURDAY
1662: select trunc(p_abs_date-(to_number(to_char((p_abs_date),'D')) -7)
1663: +decode(greatest(7-(to_number(to_char(p_abs_date,'D'))),0.99) ,0.99,7,0))

Line 1664: into l_rslt_dt from dual;

1660: elsif p_ext_date_cd = 'NSA' then
1661: -- Next SATURDAY
1662: select trunc(p_abs_date-(to_number(to_char((p_abs_date),'D')) -7)
1663: +decode(greatest(7-(to_number(to_char(p_abs_date,'D'))),0.99) ,0.99,7,0))
1664: into l_rslt_dt from dual;
1665: elsif p_ext_date_cd = 'NSU' then
1666: -- Next SUNDAY
1667: select trunc(p_abs_date-(to_number(to_char((p_abs_date),'D')) -1)
1668: +decode(greatest(1-(to_number(to_char(p_abs_date,'D'))),0.99) ,0.99,7,0))

Line 1669: into l_rslt_dt from dual;

1665: elsif p_ext_date_cd = 'NSU' then
1666: -- Next SUNDAY
1667: select trunc(p_abs_date-(to_number(to_char((p_abs_date),'D')) -1)
1668: +decode(greatest(1-(to_number(to_char(p_abs_date,'D'))),0.99) ,0.99,7,0))
1669: into l_rslt_dt from dual;
1670: elsif p_ext_date_cd = 'MONW' then
1671: -- Monday of next week
1672: l_rslt_dt := trunc(p_abs_date+(2 -to_number(to_char(p_abs_date,'D'))+7));
1673: elsif p_ext_date_cd = 'TONW' then

Line 1729: into l_rslt_dt from dual;

1725: -- if i am on feb 29 the perious period is feb 1- 15 o return feb 1
1726: select trunc(trunc(p_abs_date-15,'MM')
1727: +decode(greatest(to_number(to_char(p_abs_date,'DD')),15.9) , 15.9 , 15,0 )
1728: )
1729: into l_rslt_dt from dual;
1730:
1731: elsif p_ext_date_cd = 'FCSMS1R16' then
1732: -- First of current Semi Month Starting 1st or 16th of Month
1733: -- Tilak :is should go to the current semi period and pick up the firs date of the period

Line 1737: into l_rslt_dt from dual;

1733: -- Tilak :is should go to the current semi period and pick up the firs date of the period
1734: select trunc(trunc(p_abs_date,'MM')
1735: +decode(greatest(to_number(to_char(p_abs_date,'DD')),15.9) , 15.9 , 0,15 )
1736: )
1737: into l_rslt_dt from dual;
1738:
1739: elsif p_ext_date_cd = 'LPSME15RL' then
1740: -- Last of Prior Semi Month Ending 15th or Last of Month (Previous 15th or Last Day of Month)
1741: -- like FPSMS1R16 it has to pikcup the last date of the previous semi month

Line 1743: into l_rslt_dt from dual;

1739: elsif p_ext_date_cd = 'LPSME15RL' then
1740: -- Last of Prior Semi Month Ending 15th or Last of Month (Previous 15th or Last Day of Month)
1741: -- like FPSMS1R16 it has to pikcup the last date of the previous semi month
1742: select trunc(p_abs_date,'MM')+decode(greatest(to_number(to_char(p_abs_date,'DD')),15),15, -1, 14)
1743: into l_rslt_dt from dual;
1744:
1745: elsif p_ext_date_cd = 'LCSME15RL' then
1746: -- Last of current Semi Month Ending 15th or Last of Month
1747: -- like FCSMS1R16 it has to pikcup the last date of the previous semi month

Line 1750: into l_rslt_dt from dual;

1746: -- Last of current Semi Month Ending 15th or Last of Month
1747: -- like FCSMS1R16 it has to pikcup the last date of the previous semi month
1748: select decode(greatest(to_number(to_char(p_abs_date,'DD')),15),15,
1749: trunc(p_abs_date,'MM') +14 , trunc(add_months(p_abs_date,1),'MM') -1)
1750: into l_rslt_dt from dual;
1751:
1752:
1753: elsif p_ext_date_cd = 'CM16' then
1754: -- 16th of current month

Line 1768: into l_rslt_dt from dual ;

1764: elsif p_ext_date_cd = 'MOPW' then
1765: -- Perivious monday previous
1766: select trunc(p_abs_date-(to_number(to_char((p_abs_date),'D')) -2)
1767: -decode(greatest((to_number(to_char(p_abs_date,'D')) -2),0.99) ,0.99,14,7))
1768: into l_rslt_dt from dual ;
1769: elsif p_ext_date_cd = 'TOPW' then
1770: -- Perivious TUE previous
1771: select trunc(p_abs_date-(to_number(to_char((p_abs_date),'D')) -3)
1772: -decode(greatest((to_number(to_char(p_abs_date,'D')) -3),0.99) ,0.99,14,7))

Line 1773: into l_rslt_dt from dual ;

1769: elsif p_ext_date_cd = 'TOPW' then
1770: -- Perivious TUE previous
1771: select trunc(p_abs_date-(to_number(to_char((p_abs_date),'D')) -3)
1772: -decode(greatest((to_number(to_char(p_abs_date,'D')) -3),0.99) ,0.99,14,7))
1773: into l_rslt_dt from dual ;
1774: elsif p_ext_date_cd = 'WOPW' then
1775: -- Perivious wednesday previous
1776: select trunc(p_abs_date-(to_number(to_char((p_abs_date),'D')) -4)
1777: -decode(greatest((to_number(to_char(p_abs_date,'D')) -4),0.99) ,0.99,14,7))

Line 1778: into l_rslt_dt from dual ;

1774: elsif p_ext_date_cd = 'WOPW' then
1775: -- Perivious wednesday previous
1776: select trunc(p_abs_date-(to_number(to_char((p_abs_date),'D')) -4)
1777: -decode(greatest((to_number(to_char(p_abs_date,'D')) -4),0.99) ,0.99,14,7))
1778: into l_rslt_dt from dual ;
1779: elsif p_ext_date_cd = 'THOPW' then
1780: -- Perivious thursday of previous
1781: select trunc(p_abs_date-(to_number(to_char((p_abs_date),'D')) -5)
1782: -decode(greatest((to_number(to_char(p_abs_date,'D')) -5),0.99) ,0.99,14,7))

Line 1783: into l_rslt_dt from dual ;

1779: elsif p_ext_date_cd = 'THOPW' then
1780: -- Perivious thursday of previous
1781: select trunc(p_abs_date-(to_number(to_char((p_abs_date),'D')) -5)
1782: -decode(greatest((to_number(to_char(p_abs_date,'D')) -5),0.99) ,0.99,14,7))
1783: into l_rslt_dt from dual ;
1784: elsif p_ext_date_cd = 'FOPW' then
1785: -- Perivious friday of previous
1786: select trunc(p_abs_date-(to_number(to_char((p_abs_date),'D')) -6)
1787: -decode(greatest((to_number(to_char(p_abs_date,'D')) -6),0.99) ,0.99,14,7))

Line 1788: into l_rslt_dt from dual ;

1784: elsif p_ext_date_cd = 'FOPW' then
1785: -- Perivious friday of previous
1786: select trunc(p_abs_date-(to_number(to_char((p_abs_date),'D')) -6)
1787: -decode(greatest((to_number(to_char(p_abs_date,'D')) -6),0.99) ,0.99,14,7))
1788: into l_rslt_dt from dual ;
1789: elsif p_ext_date_cd = 'SAOPW' then
1790: -- Perivious saturday of previous
1791: select trunc(p_abs_date-(to_number(to_char((p_abs_date),'D')) -7)
1792: -decode(greatest((to_number(to_char(p_abs_date,'D')) -7),0.99) ,0.99,14,7))

Line 1793: into l_rslt_dt from dual ;

1789: elsif p_ext_date_cd = 'SAOPW' then
1790: -- Perivious saturday of previous
1791: select trunc(p_abs_date-(to_number(to_char((p_abs_date),'D')) -7)
1792: -decode(greatest((to_number(to_char(p_abs_date,'D')) -7),0.99) ,0.99,14,7))
1793: into l_rslt_dt from dual ;
1794: elsif p_ext_date_cd = 'SUOPW' then
1795: -- Perivious sunday of previous
1796: select trunc(p_abs_date-(to_number(to_char((p_abs_date),'D')) -1)
1797: -decode(greatest((to_number(to_char(p_abs_date,'D')) -1),0.99) ,0.99,14,7))

Line 1798: into l_rslt_dt from dual ;

1794: elsif p_ext_date_cd = 'SUOPW' then
1795: -- Perivious sunday of previous
1796: select trunc(p_abs_date-(to_number(to_char((p_abs_date),'D')) -1)
1797: -decode(greatest((to_number(to_char(p_abs_date,'D')) -1),0.99) ,0.99,14,7))
1798: into l_rslt_dt from dual ;
1799:
1800: elsif p_ext_date_cd = 'CM16' then
1801: -- 16th of current month
1802: l_rslt_dt := trunc(trunc(p_abs_date,'MM')+15);