zoukankan      html  css  js  c++  java
  • OCP-1Z0-051-V9.02-87题

    87. You want to display the date for the first Mon day of the next  month and issue the following

    command:

    SQL>SELECT TO_CHAR(NEXT_DAY(LAST_DAY(SYSDATE),'MON'),

    dd "is the first Monday for" fmmonth rrrr')

     FROM DUAL;

    What is the outcome?

    A. It executes successfully and returns the correct result.

    B. It executes successfully but does not return the correct result.

    C. It generates an error because TO_CHAR should be replaced with TO_DATE.

    D. It generates an error because rrrr should be replaced by rr in the format string.

    E. It generates an error because fm and double quotation marks should not be used in the format string.

    Answer: A

    答案解析:

    参考:http://blog.csdn.net/rlhua/article/details/12848395

    http://blog.csdn.net/rlhua/article/details/12832885


    题意要输出下个月第一个星期一。

    实验验证:


    下个月的星期一是4号。由结果得知可以正确执行,并且结果是正确的。


    scott@TEST0924>  SELECT TO_CHAR(NEXT_DAY(LAST_DAY(SYSDATE),'MON'),

      2    'dd "is the first Monday for" fmmonth rrrr')

      3   from dual;


    TO_CHAR(NEXT_DAY(LAST_DAY(SYSDATE),'MON'),'DD"ISTHEFIRSTMONDAYFOR"FM

    --------------------------------------------------------------------

    04 is the first Monday for november 2013

     

    SYSDATE输出当前日期,即18-OCT-13

    scott@TEST0924> select sysdate from dual;


    SYSDATE

    ------------------

    18-OCT-13

    LAST_DAY(SYSDATE)输出当月最后一天,即10月31号。

     scott@TEST0924> select LAST_DAY(SYSDATE) from dual;


    LAST_DAY(SYSDATE)

    ------------------

    31-OCT-13

    NEXT_DAY(LAST_DAY(SYSDATE),输出指定日期的下一个日期,指定的日期是星期一,即是11月4号。

    scott@TEST0924> SELECT NEXT_DAY(LAST_DAY(SYSDATE),'MON') FROM DUAL;


    NEXT_DAY(LAST_DAY(

    ------------------

    04-NOV-13

    最后以特定的格式输出。

  • 相关阅读:
    python
    spice-vdagent
    no ia32-libs
    git conflict
    wget mirror
    docker !veth
    libprotobuff8.so not found
    angular 列表渲染机制
    Java测试技巧
    react组件生命周期
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13316886.html
Copyright © 2011-2022 走看看