I have an SQL Query in PostgreSQL to extract doy
(day of year) from dates. My query is:
select extract(doy from date_col) as n
from mytable
order by n
I want to turn it into a function like extract_doy(tablename, date_column_name)
.
How would I do that?