【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 ...
随机推荐
- We could not complete your iTunes Store request
We could not complete your iTunes Store request.An unknown error occurred(502). There was an error i ...
- DB2 日期时间函数
db2日期时间函数 (DATE(TRIM(CHAR(DT#11Y))||'-'||TRIM(CHAR(DT#11M))||'-'||TRIM(CHAR(DT#11D))) BETWEEN DATE(' ...
- C语言实现 读取写入ini文件实现(转)
#include <stdio.h> #include <string.h> /* * 函数名: GetIniKeyString * 入口参数: title * 配置文件中一组 ...
- X264编码流程详解(转)
http://blog.csdn.net/xingyu19871124/article/details/7671634 对H.264编码标准一直停留在理解原理的基础上,对于一个实际投入使用的编码器是如 ...
- 【常见CPU架构对比】维基百科
Comparison of instruction set architectures https://en.wikipedia.org/wiki/Comparison_of_instruction_ ...
- 基础常用JS函数和语法
100多个基础常用JS函数和语法集合大全 来源:http://www.cnblogs.com/hnyei/p/4605103.html 网站特效离不开脚本,javascript是最常用的脚本语言,我 ...
- java 数字金额转换中文金额
public static String digitUppercase(double n){ String fraction[] = {"角", "分"}; S ...
- golang apns升级到http2
记录一下golang中升级apns,使用http2替换http1.1的详细过程. apns使用http2的好处就不用再说了,网上一搜一堆信息.苹果的apns推送在2015年8月就支持了http2协议, ...
- Docs命令大全 备用
#1 一: net use \\ip\ipc$ " " /user:" " 建立IPC空链接 net use \\ip\ipc$ "密码" ...
- select_shape_proto算子的几种特征模式含义解析
select_shape_proto是一个非常有用的region筛选算子,但是由于难以理解,因此一般人使用得不是太多. 算子签名如下: select_shape_proto(Regions, Patt ...