Thanks for the question, RK.
Asked: July 23, 2022 - 12:24 pm UTC
Last updated: July 26, 2022 - 7:24 am UTC
Version: Oracle 12C
Viewed 1000+ times
You Asked
Hi Tom,
I work in the insurance industry and I'm having trouble calculating the quarter. My insurance policy runs from 1-Feb-2022 to 31-Jan-2023, and I pay my premiums quarterly.
Inst No Inst date
1 01-Feb-2022 ( Collect premium for Feb,Mar, Apr)
2 01-May-2022 ( Collect premium for May, Jun, Jul)
3 01-Aug-2022 ( Collect premium for Aug, Sep, Oct)
4 01-Nov-2022 ( Collect premium for Nov, Dec, Jan)
Suppose in the above policy a new risk is added from 01-Jun-2022 to 31-Jan-2023, then the premium for this risk should be collected on the following dates
Inst No Inst Date
2 01-Jun-2022 ( Collect premium for Jun, Jul)
3 01-Aug-2022 ( Collect premium for Aug, Sep, Oct)
4 01-Nov-2022 ( Collect premium for Nov, Dec, Jan)
Using the above example, kindly guide me on how can I arrive the instalment dates for the newly added risk
and Connor said...
TRUNC(date_col, 'Q') will round a date down to the start of the quarter.
TO_CHAR(date_col,'Q') will return the quater (1,2,3,4) which you can TO_NUMBER on if needed.
Is this answer out of date? If it is, please let us know via a Comment