Which two queries give the required output?

You need to calculate the number of days from 1st January 2019 until today.
Dates are stored in the default format of DD-MON-RR.
Which two queries give the required output?
A. SELECT TO_CHAR(SYSDATE, ‘DD-MON-YYYY’) – ’01-JAN-2019′ FROM DUAL;
B. SELECT SYSDATE – TO_DATE(’01-JANUARY-2019′) FROM DUAL;
C. SELECT ROUND(SYSDATE – ’01-JAN-2019′) FROM DUAL;
D. SELECT ROUND(SYSDATE – TO_DATE(’01/JANUARY/2019′)) FROM DUAL;
E. SELECT TO_DATE(SYSDATE, ‘DD/MONTH/YYYY’) – ’01/JANUARY/2019′ FROM DUAL;

Download Printable PDF. VALID exam to help you PASS.

5 thoughts on “Which two queries give the required output?

  1. B,D

    A returns ORA-01722: invalid number
    B returns 1428.458483796296296296296296296296296296
    C returns ORA-01722: invalid number
    D returns 1428
    E returns ORA-01722: invalid number

  2. B and D are correct, only date values can be. subtracted each other, it is not possible with character

Leave a Reply

Your email address will not be published. Required fields are marked *


The reCAPTCHA verification period has expired. Please reload the page.