View Exhibit1 and examine the structure of the employees table.
User SCOTT needs to generate a text report that contains the names of all employees and their salaries.
Examine the following commands issued by the DBA:
SQL_CREATE DICTORY my_dir AS ‘/temp/my_files* ;
SQL_GRANT WRITE ON DIRECTORY my_dir TO SCOTT;
View Exhibit2 and examine the procedure code. You issue the following command:
You issue the following command:
SQL_EXEC sal_5tatus (‘MY_DIR’, ‘EMPREPORT.TXT’)
What is the outcome?
A.
It executes successfully and creates the report.
B.
It gives an error because the text file should be opened in append mode.
C.
It gives an error because the “no data found” condition is not handled to come out of the loop.
D.
It gives an error because user SCOTT should be granted both read and write privileges to the directory alias.
E.
It executes but no data is written to the text file because the FFLUSH subprogram is not used to write all the data buffered in memory to a file.
A
La respuesta correcta es la opción A, solo que hay un pequeño detalle en la sentencia que lanza el DBA al momento de crear el directorio en el ejemplo debemos hacer lo siguiente:
SQL> CREATE DIRECTORY MY_DIR AS ‘/temp/my_files’;
SQL> GRANT WRITE ON DIRECTORY MY_DIR TO SCOTT;
Por lo demás el código ejecuta de manera satisfactoria.
A
a) is correct, but the report is NOT what the user is expecting: “A” mode instead of “W” mode could work out.