View the Exhibit and examine the structure and data in the INVOICE table.
Which statements are true regarding data type conversion in expressions used in queries? (Choose all that
apply.)
A.
inv_amt =’0255982′ : requires explicit conversion
B.
inv_date > ’01-02-2008′ : uses implicit conversion
C.
CONCAT(inv_amt, inv_date) : requires explicit conversion
D.
inv_date = ’15-february-2008′ : uses implicit conversion
E.
inv_no BETWEEN ‘101’ AND ‘110’ : uses implicit conversion
Explanation:
In some cases, the Oracle server receives data of one data type where it expects data of a different data type.
When this happens, the Oracle server can automatically convert the data to the expected data type. This data
type conversion can be done implicitly by the Oracle server or explicitly by the user.
Explicit data type conversions are performed by using the conversion functions. Conversion functions convert a
value from one data type to another. Generally, the form of the function names follows the convention data type
TO data type. The first data type is the input data type and the second data type is the output.
Note: Although implicit data type conversion is available, it is recommended that you do the explicit data type
conversion to ensure the reliability of your SQL statements.
What is the difference between B and D ? Both of them could use implicit conversion and will suceed depend on the defaut date format.
I guess B + E.
Though B might give wrong dates (based on nls_date_format) it does do implicit conversion.
D on the other hand does not (complains about non-numeric values).
That’s right. But D works as well similiar to B, it’ll depend on nls_date_format. So I would say B, D and E are correct.
CONCAT (‘string 1’, ‘string 2)
CONCAT should follow by string.
A.
inv_amt =’0255982′ : Should USE IMPLICIT
B.
inv_date > ’01-02-2008′ : Use explicit because oracle doesn’t know 02 is Feb
C.
CONCAT(inv_amt,inv_date) : Implicit will do
D.
inv_date = ’15-february-2008′ : uses implicit conversion
— True
E.
inv_no BETWEEN ‘101’ AND ‘110’ : uses implicit conversion
— True
D & E