QuestionQ246

VerifiedUsing Conversion Functions and Conditional Expressions

You need to calculate the number of days from 1st January 2007 until today. Dates are stored in the default dd-mon-rr format. Which two SQL statements produce the required output?

Choose two
Explanation

Subtracting one Oracle DATE value from another returns the number of days between them. A character value in the session’s default date format can be implicitly converted to DATE in a date expression. Oracle's non-exact datetime input matching also allows MONTH to match MON and RRRR to match RR, making the conversion in C valid. Character arithmetic and converting an existing DATE with TO_DATE do not provide the required date subtraction.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!