0

I'm trying to understand some notes from a Uni assignment. The lecturer is calling a function and sending the function the parameter "sysdate-to_date['1-Jan-2014']". What is this parameter actually doing and what type of variable does it send?

Brendon Rother
  • 119
  • 4
  • 17

1 Answers1

0

It looks like the actual code would be

SYSDATE - TO_DATE('1-Jan-2014')

In other words, the date 01-Jan-2014 is being subtracted from SYSDATE, giving the difference in days between the current date and the first of the year.

This is slightly dangerous because no date format string is supplied to the TO_DATE function. It would be better expressed as

SYSDATE - TO_DATE('01-Jan-2014', 'DD-MON-YYYY')

Share and enjoy.