Oracle Database: Program with PL/SQL — Question 42
Which two PL/SQL blocks give the output "this is a test message"?
Answer options
- A. BEGIN DBMS_OUTPUT.PUT_LINE (DBMS_ASSERT.ENQUOTE_NAME (this is a test message, TRUE)); END;
- B. BEGIN DBMS_OUTPUT.PUT_LINE (DBMS_ASSERT.ENQUOTE_NAME (‘this is a " "test" " message’, TRUE)); END;
- C. BEGIN DBMS_OUTPUT.PUT_LINE (DBMS_ASSERT.ENQUOTE_NAME (‘ "this is a "test" message" ’, TRUE)); END;
- D. BEGIN DBMS_OUTPUT.PUT_LINE (DBMS_ASSERT.ENQUOTE_NAME (‘ "this is a test message" ’, TRUE)); END;
- E. BEGIN DBMS_OUTPUT.PUT_LINE (DBMS_ASSERT.ENQUOTE_NAME (this is a test message , FALSE));
Correct answer: A, C
Explanation
The correct answers A and C correctly format the string 'this is a test message' within the DBMS_ASSERT.ENQUOTE_NAME function. Option B incorrectly includes additional quotes and spaces that alter the intended output, while option D also adds unnecessary quotes. Option E sets the second parameter to FALSE, which does not properly enclose the string for output.