Why PS Query converts a date field to character when used in an expression
I am trying to frame a simple query using PS Query. It is find the number of days between 2 dates. The query is
SELECT A.EMPLID, (A.END_DT - A.BGN_DT) + 1 FROM PS_GP_ABS_EVENT A
However, when I create an expression as A.END_DT - A.BGN_DT, PS Query converts it to TO_CHAR(A.END_DT,'YYYY-MM-DD') - TO_CHAR(A.BGN_DT,'YYYY-MM-DD').
This results into the query going into error. I have tried this using various methods, but none of them works.
So, what is the right way (as per PS Query) to perform operations on dates and use them as fields.