1. 程式人生 > >OCP-1Z0-051-V9.02-95題

OCP-1Z0-051-V9.02-95題

Purpose

NVL2 lets you determine the value returned by a query based on whether a specified expression is null or not null.

If expr1 is not null, then NVL2 returns expr2. If expr1 is null, then NVL2 returns expr3.

如果expr1非空,則返回 expr2,如果expr1是空值,則返回expr3

The argument expr1 can have any data type. The arguments expr2

and expr3 can have any data types except LONG.

expr1 可以是任意資料型別, expr2 and expr3 可以是任意資料型別,但不能是LONG型別,且資料型別要一致,或者隱式轉換為一致,或者顯示轉換為一致。

If the data types of expr2 and expr3 are different, then Oracle Database implicitly converts one to the other.

如果expr2 and expr3 資料型別不同,則隱式轉為相同

 If they cannot be converted implicitly, then the database returns an error.

如果不能隱式轉換,則報錯。

If expr2 is character or numeric data, then the implicit conversion is implemented as follows:

  • If expr2 is character data, then Oracle Database converts expr3 to the data type of expr2 before returning a value unless expr3 is a null constant.

  • In that case, a data type conversion is not necessary, and the database returns VARCHAR2

    in the character set of expr2.

  • 如果expr2 是字元型別,則將expr3 轉換為expr2相同的資料型別。

  • If expr2 is numeric data, then Oracle Database determines which argument has the highest numeric precedence, implicitly converts the other argument to that data type, and returns that data type.

搭建環境:

1、建立表,插入資料。

[email protected]> create table products   2  (prod_id number(4) not null,   3  prod_name varchar2(25),   4  prod_expiry_date date); Table created. [email protected]> insert into products values(1,'tomato',sysdate); 1 row created. [email protected]> select * from products;    PROD_ID PROD_NAME                 PROD_EXPI ---------- ------------------------- ---------          1 tomato                    18-SEP-13 2、開始測試: [email protected]> SELECT prod_id, NVL2(prod_expiry_date, prod_expiry_date + 15,'') from products;    PROD_ID NVL2(PROD ---------- ---------          1 03-OCT-13                                              prod_expiry_date非空,則返回prod_expiry_date + 15 [email protected]> SELECT prod_id, NVL(prod_expiry_date, prod_expiry_date + 15) from products;    PROD_ID NVL(PROD_ ---------- ---------          1 18-SEP-13 prod_expiry_date非空,則返回prod_expiry_date

相關推薦

OCP-1Z0-051-V9 02-95

分享一下我老師大神的人工智慧教程!零基礎,通俗易懂!http://blog.csdn.net/jiangjunshow 也歡迎大家轉載本篇文章。分享知識,造福人民,實現我們中華民族偉大復興!        

OCP-1Z0-051-V9.02-95

Purpose NVL2 lets you determine the value returned by a query based on whether a specified expression is null or not null. If expr1 is not null, then NVL

OCP 1Z0 051 V9 02 73

分享一下我老師大神的人工智慧教程!零基礎,通俗易懂!http://blog.csdn.net/jiangjunshow 也歡迎大家轉載本篇文章。分享知識,造福人民,實現我們中華民族偉大復興!        

OCP 1Z0 051 V9 02 5

分享一下我老師大神的人工智慧教程!零基礎,通俗易懂!http://blog.csdn.net/jiangjunshow 也歡迎大家轉載本篇文章。分享知識,造福人民,實現我們中華民族偉大復興!        

OCP 1Z0 051 V9 02 104

分享一下我老師大神的人工智慧教程!零基礎,通俗易懂!http://blog.csdn.net/jiangjunshow 也歡迎大家轉載本篇文章。分享知識,造福人民,實現我們中華民族偉大復興!        

OCP 1Z0 051 V9 02 141

分享一下我老師大神的人工智慧教程!零基礎,通俗易懂!http://blog.csdn.net/jiangjunshow 也歡迎大家轉載本篇文章。分享知識,造福人民,實現我們中華民族偉大復興!        

OCP 1Z0 051 V9 02 105

分享一下我老師大神的人工智慧教程!零基礎,通俗易懂!http://blog.csdn.net/jiangjunshow 也歡迎大家轉載本篇文章。分享知識,造福人民,實現我們中華民族偉大復興!        

OCP 1Z0 051 V9 02 13

分享一下我老師大神的人工智慧教程!零基礎,通俗易懂!http://blog.csdn.net/jiangjunshow 也歡迎大家轉載本篇文章。分享知識,造福人民,實現我們中華民族偉大復興!        

OCP-1Z0-051-V9 02-9

分享一下我老師大神的人工智慧教程!零基礎,通俗易懂!http://blog.csdn.net/jiangjunshow 也歡迎大家轉載本篇文章。分享知識,造福人民,實現我們中華民族偉大復興!        

OCP-1Z0-051-V9 02-102

分享一下我老師大神的人工智慧教程!零基礎,通俗易懂!http://blog.csdn.net/jiangjunshow 也歡迎大家轉載本篇文章。分享知識,造福人民,實現我們中華民族偉大復興!        

OCP-1Z0-051-V9 02-2

幽默 ons which 原因 解析 table fonts 教程 The 2. View the Exhibit to examine the description for the SALES table. Which views can have all DM

OCP-1Z0-051-V9 02-100

100. View the Exhibit and examine the structure of the PROMOTIONS table. Which SQL statements are valid?  (Choose all that apply.) 

OCP-1Z0-051-V9 02-105

105. Examine the structure of the PROMOS table: name              Null &nbs

OCP-1Z0-051-V9 02-88

                88. You need to calculate the number of days from 1st January 2007 till date.Dates are stored in the default format of dd-mon-rr. Which SQL

OCP-1Z0-051-V9 02-141

141. View the Exhibit and examine the structure of CUSTOMERS and GRADES tables. You need to display names and grades of customers who have the highest

OCP-1Z0-051-V9.02-134

134. Where can subqueries be used? (Choose all that apply.) A. field  names in the  SELECT statement  標量子查詢 B. the  FROM clause in the  S

OCP-1Z0-051-V9.02-148

148. View the Exhibit and examine the structure of the PRODUCTS tables. You want to generate a report that displays the average list pri

OCP-1Z0-051-V9.02-51

51. Which statement is true regarding synonyms? A. Synonyms can be created only   for a table.  不只是表,schema object B. Synonyms are used t

OCP-1Z0-051-V9.02-37

37. You issued the following command to drop the PRODUCTS table: SQL> DROP TABLE products; What is the implication of this command? (C

OCP-1Z0-051-V9.02-93

93. View the Exhibit and examine the structure of the CUSTOMERS table. Using the CUSTOMERS table, y ou need to generate a report that sho