Examine the PL/SQL code for the GET_TABLE_MD function given below:
CREATE OR REPLACE FUNCTION get_table_md RETURN CLOB IS
h NUMBER;
th NUMBER;
doc CLOB;
BEGIN
h := DBMS_METADATA.OPEN(‘TABLE’);
DBMS_METADATA.SET_FILTER(h,’SCHEMA’,’HR’);
DBMS_METADATA.SET_FILTER(h,’NAME’,’TIMECARDS’);
th := DBMS_METADATA.ADD_TRANSFORM(h,’DDL’);
doc := DBMS_METADATA.FETCH_CLOB(h);
DBMS_METADATA.CLOSE(h);
RETURN doc;
END;
Which statement is true about the compilation and execution of the function?
A.
The function retrieves the metadata in Extensible Markup Language (XML) format for creating the TIMECARDS table in the HR schema.
B.
The compilation produces an error because DBMS_METADATA.SET_FILTER(h,’SCHEMA’,’HR’)is not placed in the correct order.
C.
The function retrieves the metadata as a data definition language (DDL) statement for creating the TIMECARDS table in the HR schema.
D.
The execution of the function produces an error because multiple objects are fetched and DBMS_METADATA.FETCH_CLOB is not called in a LOOP.
C
http://docs.oracle.com/cd/E11882_01/server.112/e22490/metadata_api.htm#SUTIL1625
Example 20-1 Using the DBMS_METADATA Programmatic Interface to Retrieve Data