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

    89. You need to display the date 11-oct-2007 in words as 'Eleventh of October, Two Thousand Seven'.

    Which SQL statement would give the required result?

    A. SELECT TO_CHAR('11-oct-2007', 'fmDdspth "of" Month, Year') 

    FROM DUAL;

    B. SELECT TO_CHAR(TO_DATE('11-oct-2007'), 'fmDdspth of month, year') 

    FROM DUAL;

    C. SELECT TO_CHAR(TO_DATE('11-oct-2007'), 'fmDdthsp "of" Month, Year')

    FROM DUAL;

    D. SELECT TO_DATE(TO_CHAR('11-oct-2007','fmDdspth ''of'' Month, Year'))  错。

    FROM DUAL;

    Answer: C
    答案解析:
    A错误,'11-oct-2007'本来就是字符,就不用再to_char
    B中'fmDdspth of month, year'的of需要用双引号引起来。
    C正确。
    D跟A一样的错误,'11-oct-2007'本来就是字符,就不用再to_char。
     
    实验验证:
    A,
    scott@TEST0924> SELECT TO_CHAR('11-oct-2007', 'fmDdspth "of" Month, Year') FROM DUAL;
    SELECT TO_CHAR('11-oct-2007', 'fmDdspth "of" Month, Year') FROM DUAL
                   *
    ERROR at line 1:
    ORA-01722: invalid number

    B
    scott@TEST0924> SELECT TO_CHAR(TO_DATE('11-oct-2007'), 'fmDdspth of month, year') FROM DUAL;
    SELECT TO_CHAR(TO_DATE('11-oct-2007'), 'fmDdspth of month, year') FROM DUAL
                                           *
    ERROR at line 1:
    ORA-01821: date format not recognized

    C
    scott@TEST0924> SELECT TO_CHAR(TO_DATE('11-oct-2007'), 'fmDdthsp "of" Month, Year') FROM DUAL;

    TO_CHAR(TO_DATE('11-OCT-2007'),'FMDDTHS
    ---------------------------------------
    Eleventh of October, Two Thousand Seven
    D
    scott@TEST0924> SELECT TO_DATE(TO_CHAR('11-oct-2007','fmDdspth ''of'' Month, Year')) FROM DUAL;
    SELECT TO_DATE(TO_CHAR('11-oct-2007','fmDdspth ''of'' Month, Year')) FROM DUAL
                           *
    ERROR at line 1:
    ORA-01722: invalid number

  • 相关阅读:
    Java学习之内部类
    Java学习之方法内部类
    CTFHub:RCE命令注入
    C++ :string 用法详解
    oracle数据类型
    a[0]=1,a[1]=11,a[2]=21,a[3]=1211找出规律,输入下标,得出对应的值
    python计算登山队最远坐标
    子网掩码
    实现点赞功能
    获取评论数和细节处理
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13316884.html
Copyright © 2011-2022 走看看