nerdexam
Oracle

1Z0-071 · Question #223

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 correct answer is C. Only the first query executes successfully and gives the correct result. The MONTHS_BETWEEN(date 1, date 2) function returns the number of months between two months_between('01-FEB-2008','01-JAN-2008') = 1 The DECODE Function Although its name sounds mysterious, this function is straightforward. The DECODE function implements if then-else…

Using Single-Row Functions to Customize Output

Question

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:

Which statement is true regarding the above commands?

Exhibit

1Z0-071 question #223 exhibit

Options

  • ABoth execute successfully and give correct results.
  • BOnly the first query executes successfully but gives a wrong result.
  • COnly the first query executes successfully and gives the correct result.
  • DOnly the second query executes successfully but gives a wrong result.
  • EOnly the second query executes successfully and gives the correct result.

How the community answered

(50 responses)
  • A
    16% (8)
  • B
    6% (3)
  • C
    72% (36)
  • D
    2% (1)
  • E
    4% (2)

Explanation

The MONTHS_BETWEEN(date 1, date 2) function returns the number of months between two months_between('01-FEB-2008','01-JAN-2008') = 1 The DECODE Function Although its name sounds mysterious, this function is straightforward. The DECODE function implements if then-else conditional logic by testing its first two terms for equality and returns the third if they are equal and optionally returns another term if they are not. DECODE Function Facilitates conditional inquiries by doing the work of a CASE expression or an IF-THENELSE DECODE(col|expression, search1, result1 [, search2, result2,...,] The DECODE function decodes an expression in a way similar to the IF-THEN-ELSE logic that is used in various languages. The DECODE function decodes expression after comparing it to each search value. If the expression is the same as search, result is returned. If the default value is omitted, a null value is returned where a search value does not match any of the result values.

Topics

#date arithmetic#ADD_MONTHS#date functions#penalty calculation

Community Discussion

No community discussion yet for this question.

Full 1Z0-071 Practice