【12c OCP】最新CUUG OCP-071考试题库(49题)
49、(11-1) choose the best answer
Examine the structure of the SHIPMENTS table:

You want to generate a report that displays the PO_ID and the penalty amount to be paid(罚款数额) if the SHIPMENT_DATE is later than one month from the PO_DATE. The penalty is $20 per day.
Evaluate the following two queries:
SQL> SELECT po_id, CASE
WHEN MONTHS_BETWEEN (shipment_date,po_date)>1 THEN
TO_CHAR((shipment_date - po_date)*20) ELSE 'No Penalty' END PENALTY
FROM shipments;
SQL>SELECT po_id, DECODE
(MONTHS_BETWEEN(po_date,shipment_date)>1,
TO_CHAR((shipment_date - po_date) * 20, 'NO Penalty') PENALTY
FROM shipments;
Which statement is true regarding the above commands?
A) Only the second query executes successfully but gives a wrong result.
B) Only the second query executes successfully and gives the correct result.
C) Only the first query executes successfully but gives a wrong result.
D) Both execute successfully and give correct results.
E) Only the first query executes successfully and gives the correct result.
Answer:E
(解析:decode 函数的语法是,decode(条件,值 1,返回值 1,值 2,返回值 2,...值 n,返回值 n,缺省值),
所以不能有>1 的条件判断。原来 051 的题。
该语句可以改写为下面的语句:
SELECT empno,hiredate,
CASE
WHEN MONTHS_BETWEEN (sysdate,hiredate)>1
THEN TO_CHAR((sysdate - hiredate )*20)
ELSE 'No Penalty'
END PENALTY
FROM emp;)
【12c OCP】最新CUUG OCP-071考试题库(49题)的更多相关文章
- 【OCP题库-12c】最新CUUG OCP 071考试题库(72题)
72.View the exhibit for the structure of the STUDENTand FACULTYtables. STUDENT Name Null? Type ----- ...
- 【OCP题库-12c】最新CUUG OCP 071考试题库(71题)
71.(32-18) choose three Which three statements indicate the end of a transaction? (Choose three.) A) ...
- 【OCP题库-12c】最新CUUG OCP 071考试题库(70题)
70.(31-2)choose the best answer: View the Exhibit and examine the structure of the Book table. The B ...
- 【OCP题库-12c】最新CUUG OCP 071考试题库(69题)
69.(31-1)choose the best answer: Evaluate the following query: SELECT INTERVAL '300' MONTH, INTERVAL ...
- 【OCP题库】最新CUUG OCP 12c 071考试题库(68题)
68.(29-13)choose two: Which two statements are true? (Choose two.) A) DICTIONARY is a view that cont ...
- 【OCP题库】最新CUUG OCP 12c 071考试题库(67题)
67.(25-8)choose the best answer: View the Exhibit and examine the structure of CUSTOMERS table. Eval ...
- 【OCP题库】最新CUUG OCP 12c 071考试题库(66题)
66.(22-19)choose two Examine the structure proposed for the TRANSACTIONS table: Which two statements ...
- 【OCP题库】最新CUUG OCP 12c 071考试题库(65题)
65.(22-16) choose the best answer: The CUSTOMERS table has the following structure: You need to writ ...
- 【OCP 12c】最新CUUG OCP-071考试题库(64题)
64.(22-7) choose the best answer: View the Exhibit and examine the structure of the ORDERS and ORDER ...
- 【OCP 12c】最新CUUG OCP-071考试题库(63题)
63.(22-4) choose the best answer: View the Exhibit and examine the data in the PRODUCTS table. Which ...
随机推荐
- Java 堆栈,内存分配理解
Java虚拟机的堆.栈.堆栈 https://www.zhihu.com/question/29833675
- 解决Notepad++ Plugin Manager无法加载插件的方法
今天正好安装了Notepad++,结果发现Plugin Manager里插件一个也没有,网上对应的方法都没有,最后无意间看到Plugin Manager Settings 里的提示,试了一下居然成功了 ...
- linux命令之scp远程文件复制
scp是linux中功能最强大的文件传输命令,可以实现从本地到远程以及远程到本地的轻松文件传输操作.下面简单的讲解一些关于scp命令的操作,给有用的人一些参考: 首先是本地到远程的操作:操作的格式如下 ...
- 若a与m互质,则a不影响m的完全剩余组
[若a与m互质,则a不影响m的完全剩余组] 设t通过m的完全剩余组,若at不通过m的完全剩余组, 则会有at1=at2(mod m),即a(t1-t2)|m. 因为(a,m)=1,所以(t1-t2)| ...
- flume 配置说明
Flume中的HDFS Sink应该是非常常用的,其中的配置参数也比较多,在这里记录备忘一下. channel type hdfs path 写入hdfs的路径,需要包含文件系统标识,比如:hdfs: ...
- 基于 Web 的远程 Terminal 模拟器安装使用详解
http://lzw.me/a/shellinabox.html 一.Shellinabox 简介 Shellinabox 是一个基于 web 的终端模拟器,采用 C 语言编写,使用 Ajax 与后端 ...
- ubuntu 12.04安装jdk 8
转载:http://www.itnose.net/detail/6196130.html Ubuntu12.4安装jdk1.8 1.要安装的jdk,我把它拷在了共享文件夹里面. (用优盘拷也可以 ...
- Mosquitto服务器的搭建以及SSL/TLS安全通信配置
Mosquitto服务器的搭建以及SSL/TLS安全通信配置 摘自:https://segmentfault.com/a/1190000005079300 openhab raspberry-pi ...
- WCF技术剖析(卷1)WCF全面解析文摘
第1章 wcf简介 soa体现的是一种对关注点进行分解的思想,与技术无关 soa的基本思想: a.服务自治 独立部署,不依赖其他 b.依赖于开放的标准 采用xml,xsd,及wsdl作为服务描述的 ...
- git 回退到某个特定提交
1.先用git log commit aba290c570d3894f4f39a1fdf52aa512c0231525 Author: huzhengbo <@qq.com> Date: ...