OCP-1Z0-051-V9.02-75题

75. The following data exists in the PRODUCTS table:

PROD_ID     PROD_LIST_PRICE

123456        152525.99

You issue the following query:

SQL> SELECT RPAD(( ROUND(prod_list_price)), 10,'*')     

FROM products     

WHERE prod_id = 123456;

What would be the outcome?

A. 152526 ****

B. **152525.99

C. 152525** **

D. an error message

Answer: A

 答案解析:

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


Round( ) 函数 

传回一个数值,该数值是按照指定的小数位元数进行四舍五入运算的结果 
语法
ROUND( number, decimal_places ) 
number : 需四舍五入处理的数值 
decimal_places : 四舍五入 , 小数取几位 ( 预设为 0 )

 RPAD:返回一个表达式,右边使用一个字符表达式填充到n 个字符的长度。

实验验证:
scott@TESTDB> create table products(prod_id number,prod_list_price number);
 
Table created.
 
scott@TESTDB> insert into products values(123456,152525.99);
 
1 row created.
 
scott@TESTDB> select * from  products;
 
   PROD_ID PROD_LIST_PRICE
---------- ---------------
    123456       152525.99
 
scott@TESTDB> select round(PROD_LIST_PRICE) from products;
 
ROUND(PROD_LIST_PRICE)
----------------------
                152526
scott@TESTDB> select rpad((round(PROD_LIST_PRICE)),10,'*') from products;
 
RPAD((ROUND(PROD_LIS
--------------------
152526****



 
原文地址:https://www.cnblogs.com/hzcya1995/p/13316898.html