You could use some more or less complex CASE calculation based on your definition of a quarter and the date range you want to cover.
But this looks like quarters of a financial year, so you probably got a calendar table doing that calculation and then it's easy...
when col mod 10000 <= 0128 or col mod 10000 >= 1030 then "With-in-Quarter"
when col mod 10000 < 1030 and col mod 10000 > 0730 then "Prior-Quarter"
where col mod 10000 not between 0430 and 0730 --exclude Q4 whatever it is
Did you check for an existing calendar table?
When you're on TD13.10 you can create a UDF for this.
When you tested your calculation you simply copy it to a SQL UDF:
REPLACE FUNCTION myfunc (d DATE)
RETURNS NULL ON NULL INPUT
SQL SECURITY DEFINER
INLINE TYPE 1
your CASE statement here
Thank you for the quick responce.
I am on TD13.0....i am trying to create udf but i am getting below error like
CREATE FUNCTION Failed. 3707: Syntax error, expected something like a name or Unicode delimited identifier between teh 'LANGUAGE' keyword and the'SQL' keyword.
can you please guide me how to create an UDF on TD13.0
If you're on TD13.0 you can't create SQL UDFs, they simply not supported.
Use your CASE as is or check your calendar table.