Section 12: Using the PL/SQL Compiler
12.01. Using PL/SQL Initialization Parameters
1. When setting PLSQL_OPTIMIZE_LEVEL = 2, the compiled code will remove code and exceptions that can never be executed. True or False?
♦True (*)
♦False
2. Which data dictionary view allows you to see the setting for PLSQL_OPTIMIZE_LEVEL?
♦USER_PLSQL_OBJECTS
♦USER_PLSQL_OPTIMIZE
♦USER_PLSQL_OBJECT_SETTINGS (*)
♦USER_OBJECT_SETTINGS
♦USER_PLSQL_CODE_TYPE
3. PLSQL_CODE_TYPE determines the type of code for PL/SQL code and for SQL statements, which is what speeds up the execution speed. True or False?
♦True
♦False (*)
4. What are the valid values for PLSQL_OPTIMIZE_LEVEL in the data dictionary?
♦0,1,2,3 (*)
♦0,1,2,3,4
♦1,2,3
♦1,2,3,4
5. Which are NOT examples of benefits of using PLSQL_OPTIMIZE_LEVEL. (Choose two)
♦Control what PL/SQL does with useless code.
♦Combining compiled code from one subprogram into another subprogram.
♦Separating compiled code so that separate units may be repeated as needed. (*)
♦Backward compatible with previous versions of the Oracle database.
♦Modify source code to optimize frequently-used elements at the top. (*)
6. To set the PLSQL_CODE_TYPE to its fastest execution speed, which command do you use?
♦ALTER SYSTEM SET PLSQL_CODE_TYPE=NATIVE;
♦ALTER SYSTEM SET PLSQL_CODE_TYPE=2;
♦ALTER SESSION SET PLSQL_CODE_TYPE = NATIVE; (*)
♦ALTER SESSION SET PLSQL_CODE_TYPE = INTERPRETED;
♦ALTER SESSION SET PLSQL_CODE_TYPE = 2;
12.02. Displaying the Compiler Warning Messages
1. The informational warning level for PL/SQL compiled code identifies the code that may cause execution speed to be slow. True or False?
♦True
♦False (*)
2. Which pair of DBMS_WARNING commands would allow you to obtain the current settings and change and restore those settings in a PL/SQL subprogram? (Choose two)
♦DBMS_WARNING.SET_WARNING_SETTING_STRING (*)
♦DBMS_WARNING.ADD_WARNING_SETTING_CAT
♦DBMS_WARNING.GET_WARNING_SETTING_STRING (*)
♦DBMS_WARNING.GET_WARNING_STRING
3. Which PL/SQL warning message identifies code that can cause unexpected behavior or wrong results when executed?
♦INFORMATIONAL
♦PERFORMANCE
♦ALL
♦SEVERE (*)
♦ERROR
4. The two statements below are equivalent. True or False?
DBMS_WARNING.ADD_WARNING_SETTING_CAT
(‘INFORMATIONAL’,’ENABLE’,’SESSION’);
and
SET PLSQL_WARNINGS = ‘ENABLE:INFORMATIONAL’;
♦False
♦False
♦True
♦False (*)
12.03. Using Conditional Components
1. Identify the selection directives used in conditional compilation.
♦$IF $THEN $ELSE $END $CCFLAG
♦$$IF $$THEN $$ELSE $$ELSIF $$END
♦$IF $THEN $ELSE $ELSIF $ENDIF
♦$IF $THEN $ELSE $ELSIF $END (*)
♦$$IF $$THEN $$ELSE $$END $$DEBUG
2. Inquiry directives are used to selectively include or exclude PL/SQL code based on values of pre-defined variables that are set using the PLSQL_CCFLAGS parameter. True or False?
♦True
♦False (*)
3. You can choose which code to include in a PL/SQL program based on conditional compilation directives. True or False?
♦True (*)
♦False
4. The value of DBMS_DB_VERSION.VER_LE_11 is TRUE when the version of the Oracle database is version 11 or greater. True or False?
♦True
♦False (*)
5. Conditional compilation allows you to include extra code to help with debugging, which can be removed once errors are resolved. True or False?
♦True (*)
♦False
6. If the version and release of the Oracle database in use is 10.2, what statement will allow syntax available in version 10.2 or later?
♦$IF DBMS_DB_VERSION.VER_LE_10_2 $THEN — some messaage $ELSE — some action $END
♦$IF DBMS_DB_VERSION.VER_LE_10_2 $THEN — some messaage $ELSE — some action $END;
♦$IF DBMS_DB_VERSION.VER_LE_10_1 $THEN — some messaage $ELSE — some action $END (*)
♦$IF DBMS_DB_VERSION.VER_LE_10_1 $THEN — some messaage $ELSE — some action $END;
12.04. Hiding your Source Code
1. One benefit of obfuscation is to protect intellectual property written in PL/SQL. True or False?
♦True (*)
♦False
2. For PL/SQL code larger than 32,767 characters, you must use the wrap utility. True or False?
♦True (*)
♦False
3. To create obfuscated code using the wrapper utility, determine the order in which to execute the following steps.
A Connect to the database and execute the wrapped text file as a script to compile the wrapped code into the Data Dictionary.
B Log into the database server computer.
C Create a text file containing your complete unwrapped source code.
D Execute WRAP to create a second text file containing the wrapped code.
♦B,C,D,A (*)
♦C,D,A,B
♦C,A,B,D
♦B,D,C,A
♦False (*)
♦DBMS_DML.CREATE_WRAP
♦DBMS_DDL.CREATE_WRAP
♦DBMS_DDL.CREATE_WRAPPED (*)
♦DBMS_DDL.WRAPPED
♦DBMS_DDL.WRAP_CODE
6. When wrapping subprograms, the entire PL/SQL code must be included as an IN argument with data type VARCHAR2 up to 32,767 characters. True or False?
♦True (*)
♦False