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

    最后以特定的格式输出。

  • 相关阅读:
    2013,爱上暗色调
    [转]Sublime Text 使用介绍、全套快捷键及插件推荐
    委托、事件
    ASP.NET中常用的三十三种代码 .NET技术 / ASP.NET
    台湾综艺节目
    C# 中的委托和事件
    ASP.net 静态化页面之的URL重写
    源码
    毕业5年决定你的一生
    常见错误 不能打开注册表关键字
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13316886.html
Copyright © 2011-2022 走看看