I'm writing a query in postgresql and I've hardcoded the month value in multiple places in the code. E.g, if I'm running the query for December then I've used 12 everywhere in the calculations. But the issue is everytime I need to change the month I need to change the number 12 in all locations which is not a great way to code. How do I declare the month as 12 at the very top so I need to make only one change in my query at the top?
I tried using the following -
DECLARE month_number numeric := 50
but no luck.