I am working on an assignment where I need to display the system date in a very specific way in SQL. The form is supposed to be as follows:
Day of the week with just the first letter capitalized, the month number in Roman Numerals (capitalized), the day of the month, the year spelled out in capital letters with anno domini, the day of the year from the Julian calendar with the phrase "Day of the year", number of seconds past midnight with the phrase "Seconds past midnight"
I reached up to the actual number of seconds past midnight, but I can't seem to add "Seconds past midnight" to it.
I have looked for syntax online and didn't find exactly what I needed. It's possible my search queries weren't worded correctly or that I didn't look far enough. My textbook isn't very clear to me on this, either. The only thing I've seen in there is an explanation of the difference between CURRENTDATE
and SYSDATE
.
This is what I have so far. I realize it may be entirely wrong. I have attempted it without the +
and also without the quotes around the phrase.
SELECT TO_CHAR
(SYSDATE, 'Dy, RM, D, YEAR AD, DDD "Day of the year", SSSSS "Seconds past midnight") "NOW"
FROM DUAL;
I expected the output to say Fri, IV, 19, TWENTY NINETEEN AD, 109 Day of the year, 73829 Seconds past midnight
but it's giving me the following error: ORA-01801: date format is too long for internal buffer