Chapter 6 Conditional Control: CASE Statements

Team-Fly    

Oracle® PL/SQL® Interactive Workbook, Second Edition
By Benjamin Rosenzweig, Elena Silvestrova
Table of Contents
Appendix A.  Answers to Self-Review Questions


Lab 6.1 Self-Review Answers

A1:

Questions

Answers

Comments

1)

C

The statements in a CASE construct are not executed sequentially. Rather, one group of statements or another will be selected to execute depending on how test conditions are evaluated.

A2:

Questions

Answers

Comments

2)

B

 

A3:

Questions

Answers

Comments

3)

B

The selector is evaluated only once, and the value of each expression is compared to the value of the selector sequentially.

A4:

Questions

Answers

Comments

4)

A

The behavior of a searched CASE construct is similar to the behavior of an IF statement. In other words, if all conditions of the CASE construct evaluate to NULL and there is no ELSE clause present, the control will be passed to the first executable statement after END CASE.

A5:

Questions

Answers

Comments

5)

A

 

Lab 6.2 Self-Review Answers

A1:

Questions

Answers

Comments

1)

A

A keyword here is expression. You will recall that an expression returns a single value.

A2:

Questions

Answers

Comments

2)

C

 

A3:

Questions

Answers

Comments

3)

B

Similar to CASE statements, there are CASE and searched CASE expressions.

A4:

Questions

Answers

Comments

4)

A

The behavior of a CASE expression is similar to the behavior of a CASE statement. In other words, if all conditions of the CASE expression evaluate to NULL and there is no ELSE clause present, the expression returns NULL.

A5:

Questions

Answers

Comments

5)

A

As mentioned earlier, the keyword here is expression. Because an expression returns a single value, it must return a single datatype.

Lab 6.3 Self-Review Answers

A1:

Questions

Answers

Comments

1)

A

 

A2:

Questions

Answers

Comments

2)

B

The NULLIF function does the opposite of the NVL function. If the first expression is NULL, then NVL returns the second expression. If the first expression is not NULL, then NVL returns the first expression.

A3:

Questions

Answers

Comments

3)

B

When the literal NULL is used in the first expression of the NULLIF function, it causes a syntax error.

A4:

Questions

Answers

Comments

4)

A

 

A5:

Questions

Answers

Comments

5)

B

As long as one of the expressions in the COALESCE function does not contain NULL, the COALESCE function executes successfully. For example,

 COALESCE(NULL, 5) 

returns the value of 5. On the other hand,

 COALESCE(NULL, NULL) 

causes a syntax error.


    Team-Fly    
    Top
     



    Oracle PL. SQL Interactive Workbook
    Oracle PL/SQL Interactive Workbook (2nd Edition)
    ISBN: 0130473200
    EAN: 2147483647
    Year: 2002
    Pages: 146

    Similar book on Amazon

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net