I want to generate dates between 2 dates coming from parameters in oracle fusion using the connect by level statement
SELECT papf.person_number emp_id,
(SELECT to_date(:p_from_date,'dd-mm-yyyy') + level - 1 dt
from dual
connect by level <= (
to_date(:p_to_date,'dd-mm-yyyy') - to_date(:p_from_date,'dd-mm-yyyy') + 1
) ),
....
I get error ORA-01861: literal does not match format string, I tried to use to_char and change the format but doesn't work, the parameter date format is also dd-mm-yyyy, what is wrong here?
Your inner query selects just the dt column, FROM was missing, brackets in wrong places... Anyway with variables bound as 01-01-2023 and 10-01-2023 the result is:
If your parameters are of DATE data type then