Professional Documents
Culture Documents
Answer: procedure and function Question: Which statement would you use to invoke a stored procedure in iSQL*Plus? Answer: EXECUTE Question:
Which SQL statement allows a privileged user to assign privileges to other users?
Answer:
GRANT
Question:
Which column of the USER_OBJECTS data dictionary view contains the date and time a particular object was initially stored in the database?
Answer:
CREATED
Question:
Which column of the USER_OBJECTS data dictionary view indicates whether the database object is a procedure, function, trigger, or package?
Answer:
OBJECT_TYPE
Question:
What is the syntax of the SHOW ERRORS SQL*Plus command?
Answer:
SHOW ERRORS [construct_type] [construct_name]
Question:
Which two values are allowed for the STATUS column of the USER_OBJECTS data dictionary view?
Answer:
VALID and INVALID
Question:
Which system privilege allows a user to create procedures, functions, and packages?
Answer:
CREATE PROCEDURE
Question:
Which SQL statement allows a privileged user to remove privileges from a user?
Answer:
REVOKE
Question:
If you are not the object's owner, which privilege must you be granted to run a PL/SQL construct, such as a function or procedure?
Answer:
EXECUTE
Question:
Which view contains a STATUS column that indicates whether a database object is valid?
Answer:
USER_OBJECTS
Question:
Which system privilege is required to manually recompile a stored procedure owned by another user?
Answer:
ALTER ANY PROCEDURE
Question:
What is returned when you use the SQL*Plus DESCRIBE command with a PL/SQL construct, such as a procedure or function?
Answer:
the construct's argument list
Question:
Which column of the USER_SOURCE data dictionary view contains the source code that defines the associated procedure, function, or package?
Answer:
TEXT
Question:
Where are BFILES stored?
Answer:
in a file stored outside of the database
Question:
What are the two distinct parts of an internal LOB?
Answer:
LOB value - data that constitutes the real object being stored LOB locator - a pointer to the location of the LOB value stored in the database
Question:
Which database object provides for the administration of access and usage of BFILEs?
Answer:
DIRECTORY
Question:
Which function would you use to initialize a BFILE column?
Answer:
BFILENAME
Question:
Which three types of LOBs are internal LOBs?
Answer:
CLOB, NCLOB, and BLOB
Question:
Which LOB data type represents a multibyte character large object?
Answer:
NCLOB
Question:
Which statement would you use to migrate a LONG column to a NCLOB column?
Answer:
ALTER TABLE
Question:
Which LOB data type represents a character large object?
Answer:
CLOB
Question:
Which DBMS_LOB procedure would you use to load a BFILE?
Answer:
DBMS_LOB.FILEOPEN
Question:
Can you migrate a LONG column to a CLOB or NCLOB column?
Answer:
Yes
Question:
Which supplied package manages LOBs?
Answer:
DBMS_LOB
Question:
Can you migrate a LONG RAW column to a CLOB column?
Answer:
No. You can migrate a LONG RAW column to a BLOB column, not a CLOB column.
Question:
Are dependencies between objects residing on different databases handled the same as those residing on the same database?
Answer:
No. When remote referenced objects are marked invalid, any local dependent objects are not marked invalid
Question:
What does the utldtree.sql script do?
Answer:
It creates the DEPTREE_FILL procedure and two additional views, DEPTREE and IDEPTREE, which can be used to determine indirect dependencies between database objects.
Question:
Which three guidelines can minimize recompilation failure?
Answer:
declaring identifiers using the %TYPE and %ROWTYPE attributes, using SELECT * notation in queries, and including a column list in INSERT statements
Question:
Does modifying a procedure's argument list affect the constructs that the procedure executes?
Answer:
No, but it does affect other constructs that reference the procedure
Question:
What is automatic implicit recompilation?
Answer:
the process by which invalid subprograms are implicitly recompiled the next time they are referenced
Question:
What happens when a change is made to a database object that is referenced by other database objects?
Answer:
All dependent objects are marked invalid.
Question:
When a local procedure depends on another local procedure, and the called procedure is changed, when is the dependent procedure recompiled?
Answer:
the next time it is executed
Question:
What are database objects that rely on database objects in a different database referred to as?
Answer:
remote dependent objects
Question:
What are database objects that rely on another database object in the same database referred to as?
Answer:
local dependent objects
Question:
When a local procedure depends on a remote procedure and the remote procedure is modified, when is the local procedure recompiled?
Answer:
the second time it is executed after the change
Question:
Which standard data dictionary view can you use to display dependencies between database
objects?
Answer:
USER_DEPENDENCIES
Question:
Which syntax can you use to manually recompile a package?
Answer:
ALTER PACKAGE package_name COMPILE;
Question:
Which two views are created by running the utldtree.sql script?
Answer:
DEPTREE and IDEPTREE
Question:
When does code included in the executable section of a package body execute?
Answer:
the first time the package is referenced within a session or when the package is recompiled
Question:
Within a package, where would you include code that needs to execute only the first time the package is referenced within a session?
Answer:
in the executable section of a package body
Question:
Is a package variable accessible after the package has finished executing?
Answer:
Yes, the state of a package variable persists throughout the current user session.
Question:
What is an overloaded package?
Answer:
a package that contains two different subprograms with the same name, but argument lists that differ in number, order, or data type family
Question:
Which compiler directive would you use to specify the purity level of a function?
Answer:
PRAGMA RESTRICT_REFERENCES
Question:
What are package subprograms that reference each other known as?
Answer:
mutually referential subprograms
Question:
Can stand-alone stored procedures be overloaded?
Answer:
No, only local subprograms or packaged subprograms can be overloaded
Question:
When using forward declaration, what must be specified in the package specification prior to declaring the calling subprogram?
Answer:
the subprogram name and formal parameter list
Question:
Must procedures within a package have a unique name?
Answer:
No. By overloading a package, you can create two procedures with the same name, but the procedures' argument lists must differ in number, order, or data type family
Question:
What are the three parts of a package body?
Answer:
header, declaration, and executable section
Question:
What are variables declared in a package specification or body known as?
Answer:
package variables
Question:
Does PL/SQL allow forward references?
Answer:
No, you must declare a construct before referencing it.
Question:
What is a forward declaration?
Answer:
when you declare only a subprogram specification, prior to declaring the body of the subprogram, so that other subprograms may reference it
Question:
In which three languages can a procedure being called in a CALL statement be written?
Answer:
PL/SQL, C, or Java
Question:
What does a CALL statement within a trigger body allow you to do?
Answer:
call a stored procedure
Question:
What are the three DDL_Event triggers?
Answer:
CREATE, ALTER, and DROP
Question:
What are the two options for the LOGON and LOGOFF triggers?
Answer:
ON SCHEMA - fires for the specific user ON DATABASE - fires for all users
Question:
Which data dictionary view contains the status of a trigger and the date the trigger was created?
Answer:
USER_OBJECTS
Question:
If a database trigger fails, is the DML operation that invoked the trigger rolled back?
Answer:
Yes
Question:
Which three programming languages can be used to create a database trigger?
Answer:
PL/SQL, C, or Java
Question:
If an error occurs when a trigger is being created, what happens?
Answer:
The trigger is still created.
Question:
What does the CREATE TRIGGER privilege allow a user to do?
Answer:
to create database triggers on a table in their schema and to drop and alter the database triggers they have created
Question:
Do DDL triggers fire for the creation of tablespaces?
Answer:
Yes. DDL triggers fire for clusters, functions, indexes, packages, procedures, roles, sequences, synonyms, tables, tablespaces, triggers, types, views, or users.
Question:
What is the result if a row level database trigger attempts to read the same table on which the triggering event is defined?
Answer:
An error occurs because the table is mutating
Question:
Should you place a colon at the end of a CALL statement?
Answer:
No
Question:
Which column of the USER_TRIGGERS view contains the source code of the database trigger?
Answer:
TRIGGER_BODY
Question:
What are the five Database_event triggers?
Answer:
AFTER SERVERERROR, AFTER LOGON, BEFORE LOGOFF, AFTER STARTUP, and BEFORE SHUTDOWN
Question:
Which data dictionary view could you query to display compilation errors that occurred when a trigger was compiled?
Answer:
USER_ERRORS
Question:
Which two data dictionary views could you use to display all triggers that you and other users have created and that you have access to?
Answer:
ALL_OBJECTS and ALL_TRIGGERS
Question:
Which command could you use in iSQL*Plus to see compilation errors that occurred when a trigger was compiled?
Answer:
SHOW ERRORS
Question:
After compiling a trigger, which SQL*Plus command can you use to display compilation errors?
Answer:
SHOW ERRORS
Question:
If you have the appropriate privileges, which two data dictionary views could you query to display all triggers defined on a table?
Answer:
DBA_OBJECTS and DBA_TRIGGERS
Question:
If you have the appropriate privileges, which two data dictionary views could you query to display all triggers defined on a table?
Answer:
DBA_OBJECTS and DBA_TRIGGERS
Question:
Which type of database trigger allows you to capture the values that exist before the trigger body executes and the values after the trigger body executes?
Answer:
row level, because a row level trigger fires once for each affected row
Question:
Which two triggers monitor how often you log on and log off the database?
Answer:
LOGON and LOGOFF
Question:
Can a function be invoked from within a SELECT clause of a SQL statement?
Answer:
Yes, as long as the function returns an Oracle server internal data type and does not modify database tables.
Question:
Can a function include more than one RETURN statement in its executable section?
Answer:
Yes, this is customary in an IF block to return different values based on some condition. However, only one of the RETURN statements executes.
Question:
Can you rollback a DROP FUNCTION statement?
Answer:
No. The DROP FUNCTION statement is a DDL command and is, therefore, auto-committing.
Question:
When passing a SQL*Plus variable to a function, why is the variable prefixed with a colon?
Answer:
This statement is actually an implicit PL/SQL anonymous block, and when referencing host variables within a PL/SQL construct, you must use the colon to distinguish them from local PL/SQL variables.
Question:
Which statement should you use to permanently remove a function from the database?
Answer:
DROP FUNCTION
Question:
Which statement is the equivalent to removing a function and recreating it?
Answer:
CREATE AND REPLACE FUNCTION
Question:
Must a function return a value?
Answer:
Yes, functions must return a single value
Question:
How is a function invoked?
Answer:
as part of an expression
Question:
Can functions be invoked using the EXECUTE statement?
Answer:
No, functions must be executed as part of an expression.
Question:
How many IN arguments are required for a stored function?
Answer:
None, a function can return a value that is not derived from an input argument.
Question:
What are the four sections of a PL/SQL function?
Answer:
header, declaration, executable, and exception
Question:
What is the purpose of the RETURN statement included in a function's header section?
Answer:
to specify the data type to be returned
Question:
Will a function compile successfully without a RETURN statement in the executable section?
Answer:
Yes. Although a function will compile successfully without a RETURN statement in the executable section, it will generate a run-time error if no value is returned to the calling environment when executed
Question:
Which statement would you issue to drop a stored function from the database?
Answer:
DROP FUNCTION
Question:
Can a user-defined function be referenced in a FROM clause of a SQL statement?
Answer:
No
Question:
When invoking functions, what is used to transfer values to and from the calling environment?
Answer:
formal parameters
Question:
Which three components are included in a stored function header?
Answer:
the function name, the argument list, and the RETURN statement that identifies the data type to be returned
Question:
Which type of named subprogram must you use to return a value within a SQL statement?
Answer:
a function
Question:
What is the syntax for defining a stored function?
Answer:
CREATE [OR REPLACE] FUNCTION function_name [(parameter1 [mode1] datatype1, parameter2 [mode2] datatype2, ... )] RETURN datatype IS | AS ... BEGIN ... [EXCEPTION] ... END function_name;
Question:
Can functions be invoked within a CHECK constraint?
Answer:
No
Question:
Which PL/SQL statement passes a function value back to the calling environment?
Answer:
RETURN
Question:
When defining a function, where is the argument list defined?
Answer:
in the header section after the procedure name, but before the RETURN statement
Question:
What is the purpose of the RETURN statement in the executable section of a function?
Answer:
to return the value of the parameter to the calling environment
Question:
If you recreate a function using the CREATE AND REPLACE FUNCTION statement, what happens to the privileges on the function?
Answer:
The function privileges remain the same.
Question:
For a function to compile successfully, what is the minimum number of RETURN statements?
Answer:
Two. One RETURN statement must be included in the header section to specify the data type to be returned, and another RETURN statement must be included in the executable section to return the value.
Question:
Which procedure in the Oracle-supplied DBMS_OUTPUT package places a line of text into the buffer and displays the buffer contents to the screen?
Answer:
PUT_LINE
Question:
Which procedure of the DBMS_OUTPUT package retrieves one or more lines from the buffer into a PL/SQL table?
Answer:
GET_LINES
Question:
Why would you use the RECEIVE_MESSAGE function of the DBMS_PIPE package?
Answer:
to retrieve a message from the named pipe and place it into the local message buffer to be unpacked by the UNPACK_MESSAGE procedure
Question:
Which action does the EXECUTE function of the DBMS_SQL package perform?
Answer:
It executes the SQL statement and returns the total number of rows processed.
Question:
Which procedure of the DBMS_OUTPUT package retrieves a single line from the buffer into a variable?
Answer:
GET_LINE
Question:
Which Oracle-supplied package can you use to display messages in a SQL*Plus session?
Answer:
DBMS_OUTPUT
Question:
Using DBMS_SQL, what happens during the fetch phase of executing a SQL statement?
Answer:
Rows are selected based on the query criteria.
Question:
Which procedure of the DBMS_SQL package allows you to assign values to bind variables at runtime?
Answer:
BIND_VARIABLE
Question:
Which procedure of the DBMS_SQL package allows you to assign values to bind variables at runtime?
Answer:
BIND_VARIABLE
Question:
Which procedure of the DBMS_DDL package can you use to generate statistics for a given table?
Answer:
ANALYZE_OBJECT
Question:
Which SQL*Plus command must you first issue to view output from DBMS_OUTPUT?
Answer:
SET SERVEROUTPUT ON
Question:
What happens during the parse phase of executing a SQL statement?
Answer:
The statement is checked for syntax errors and validity, all object references are resolved, and the user's privileges to those objects are checked.
Question:
In the DBMS_OUTPUT package, which two procedures can you use to place messages in a buffer for future use?
Answer:
PUT and PUT_LINE
Question:
Which function of the DBMS_PIPE package sends the contents of the message buffer to the pipe?
Answer:
SEND_MESSAGE
Question:
Which action does the NEW_LINE procedure of the DBMS_OUTPUT package perform?
Answer:
It places an end-of-line marker in the output buffer.
Question:
Which procedure of the DBMS_DDL Oracle-supplied package allows you to compile PL/SQL constructs?
Answer:
ALTER_COMPILE
Question:
Which two Oracle-supplied packages could you use if you needed to perform DDL within a PL/SQL procedure?
Answer:
DBMS_DDL or DBMS_SQL
Question:
Which Oracle-supplied package provides many subprograms for managing both local and distributed transactions?
Answer:
DBMS_TRANSACTION
Question:
Which function of the DBMS_SQL package opens a new cursor and returns a cursor identification number?
Answer:
OPEN_CURSOR
Question:
Which Oracle-supplied package allows two or more sessions connected to the same instance to communicate through a pipe?
Answer:
DBMS_PIPE
Question:
Which function of the DBMS_SQL package fetches a row or rows from an open cursor?
Answer:
FETCH_ROWS
Question:
Using DBMS_SQL, what happens during the bind phase of executing a SQL statement?
Answer:
Oracle obtains the needed values for any bind variables included in the SQL statement.
Question:
Which term refers to SQL statements that are NOT completed until run-time?
Answer:
dynamic SQL
Question:
What is the difference between the PUT and PUT_LINE procedures of the Oracle-supplied DBMS_OUTPUT package?
Answer:
The PUT_LINE procedure also appends a newline character
Question:
Which action does the CLOSE_CURSOR procedure of the DBMS_SQL package accomplish?
Answer:
It closes a specified cursor that was previously opened using DBMS_SQL.
Question:
What does the BIND_VARIABLE procedure of the DBMS_SQL package do?
Answer:
It binds a scalar value to a variable named in the parsed SQL statement of a given cursor
Question:
Which function of the DBMS_SQL package opens a cursor and is always required?
Answer:
OPEN_CURSOR
Question:
Which Oracle-supplied package can you use to create jobs or schedules?
Answer:
DBMS_JOB
Question:
Which four basic steps would you take to dynamically execute a SQL statement using the DBMS_SQL package?
Answer:
1. Call the OPEN_CURSOR function to allocate memory and obtain a pointer. 2. Call the PARSE procedure to validate the SQL statement. 3. Call the EXECUTE function to run the SQL statement. 4. Call the CLOSE_CURSOR procedure to close the cursor.
Question:
Which procedure of the DBMS_SQL package immediately parses a specified SQL statement?
Answer:
PARSE
Question:
Which statement would you use to prevent a single trigger from executing?
Answer:
ALTER TRIGGER
Question:
Which statement would you use to permanently remove a trigger from the database?
Answer:
DROP TRIGGER
Question:
Which keywords can you include in an ALTER TABLE statement to temporarily disable all triggers on a table?
Answer:
DISABLE ALL TRIGGERS
Question:
When creating a DML trigger, which five components must be identified?
Answer:
trigger name, timing, DML event, table, and trigger body
Question:
Which keyword should you use if the trigger body should execute prior to the triggering event?
Answer:
BEFORE
Question:
Which keyword must you include in an ALTER TRIGGER statement to temporarily prevent a trigger from executing?
Answer:
DISABLE
Question:
Which two keywords specify trigger timing in relation to the triggering event?
Answer:
BEFORE and AFTER
Question:
By default, are triggers statement level or row level?
Answer:
statement level
Question:
Which special type of row trigger can be coded for views to fire the trigger in place of executing the triggering statement?
Answer:
INSTEAD OF
Question:
What is the syntax for creating a statement trigger?
Answer:
CREATE [OR REPLACE] TRIGGER trigger_name timing event1 [OR event2 OR event3] ON table_name BEGIN ... END;
Question:
Which additional keywords must a row trigger include?
Answer:
FOR EACH ROW
Question:
What happens when you disable a database trigger?
Answer:
The trigger remains in the data dictionary, but will not execute until it is re-enabled
Question:
Which type of database trigger fires once for the triggering event?
Answer:
statement trigger
Question:
Which syntax can you use to disable a trigger?
Answer:
ALTER TRIGGER trigger_name DISABLE;
Question:
Which two actions occur when a database trigger terminates abnormally?
Answer:
A rollback occurs, and the triggering statement is rolled back.
Question:
When would you use the UPDATE OF keywords in a trigger definition?
Answer:
if you want the trigger to fire in response to updating a specific column or columns in the specified table
Question:
Which keyword should you include if the trigger body should execute following the triggering event?
Answer:
AFTER
Question:
Database triggers can be defined on which types of database objects?
Answer:
tables or views
Question:
Can you reference the OLD and NEW qualifiers in a statement level trigger?
Answer:
No, only in a row level trigger that affects each row processed
Question:
How are trigger predicates like INSERTING, UPDATING, and DELETING usually referenced?
Answer:
in an IF statement
Question:
In the trigger body, which determines how many times the trigger body will execute?
Answer:
trigger type
Question:
Within row triggers, for which purpose are the OLD and NEW qualifiers used?
Answer:
to reference old and new values of columns
Question:
Which data dictionary view would you use to display the source code for only database triggers that you have created?
Answer:
USER_TRIGGERS
Question:
What is the syntax to re-enable a database trigger?
Answer:
ALTER TRIGGER trigger_name ENABLE;
Question:
Other than dropping a trigger, how can you temporarily prevent the trigger from executing?
Answer:
by disabling the trigger
Question:
Which syntax would you use to prevent all triggers on a given table from executing?
Answer:
ALTER TABLE. . . DISABLE ALL TRIGGERS;
Question:
Which type of trigger fires for each row affected by the triggering event?
Answer:
row trigger
Question:
When a trigger is defined to execute for multiple DML statements, how can you determine the type of statement that invoked the trigger?
Answer:
by referencing the INSERTING, UPDATING, and DELETING trigger predicates
Question:
What is the syntax for creating a row level trigger?
Answer:
CREATE [OR REPLACE] TRIGGER trigger_name timing event1 [OR event2 OR event3] ON table_name [REFERENCING OLD AS old | NEW AS new] FOR EACH ROW [WHEN condition] BEGIN ... END;
Question:
Which statement should you use to compile a database trigger?
Answer:
ALTER TRIGGER
Question:
Which additional clause can be included in the header of a database trigger to determine for which affected rows the trigger should execute?
Answer:
WHEN
Question:
What is a pragma?
Answer:
a directive to the PL/SQL compiler
Question:
Can public package variables be referenced outside the package?
Answer:
Yes, by prefixing them with the package name
Question:
What is the syntax for creating a package specification?
Answer:
CREATE [OR REPLACE] PACKAGE package_name IS | AS ... END package_name;
Question:
Can procedures declared only in the package body be invoked from outside the package?
Answer:
No, they are considered to be private
Question:
Can packages be nested?
Answer:
No
Question:
Can private package variables be referenced outside the package?
Answer:
No, only by other constructs within the package
Question:
What is meant by the "purity level" of a package?
Answer:
the extent to which the package is free from adverse database side effects
Question:
Which types of programming constructs can be included in a package?
Answer:
cursors, variables, types, exceptions, procedures, and functions
Question:
Which elements are included in a package specification?
Answer:
the package name, public declarations, and declarations of public PL/SQL subprograms included in the package body
Question:
From where can public variables within a package be referenced?
Answer:
from inside and outside of the package
Question:
Of which type are variables declared within the declaration section of a package body?
Answer:
private
Question:
In a package, must all constructs be declared in the body?
Answer:
Yes, all constructs must be declared in the package body if a package body is required
Question:
Of which type are variables declared in the package specification?
Answer:
public
Question:
Which elements are included in a package body?
Answer:
the package name, private declarations, and public and private PL/SQL subprograms
Question:
Which four purity levels can be specified in a PRAGMA RESTRICT_REFERENCES statement?
Answer:
WNDS - Writes no database state RNDS - Reads no database state WNPS - Writes no package state RNPS - Reads no package state
Question:
What is the syntax for creating a package body?
Answer:
CREATE [OR REPLACE] PACKAGE BODY package_name IS | AS ... END package_name
Question:
Must all packages have a specification and a body?
Answer:
No, packages that do not contain procedures or functions do not require a body
Question:
What is a group of logically-related subprograms and constructs called?
Answer:
a package
Question:
Within a package, from where can private variables be referenced?
Answer:
from within any construct of the package
Question:
When executing a procedure using the EXECUTE command, how must you reference procedures that are defined within a package?
Answer:
using the package name as a prefix or package_name.procedure_name (arguments)
Question:
Which statement permanently removes a package specification and body from the database?
Answer:
DROP PACKAGE package_name
Question:
Which statement permanently removes a package body from the database without affecting the package's specification?
Answer:
DROP PACKAGE BODY package_name;
Question:
a package contains more than one subprogram and a variable is declared in the package body before any of the subprograms, where is the variable visible?
Answer:
in all of the package's subprograms, but not outside the package
Question:
In a package, where are private constructs declared?
Answer:
in the package body only
Question:
When is a package loaded into memory?
Answer:
when any construct within the package is invoked
Question:
Which compiler directive indicates that the package body should not compile correctly if it fails one of its references?
Answer:
PRAGMA RESTRICT_REFERENCES
Question:
When is the order of declaration of constructs in a package important?
Answer:
when the constructs reference each other, otherwise order is irrelevant
Question:
Why would you use a PRAGMA statement in a PL/SQL program unit?
Answer:
to pass information to the PL/SQL compiler
Question:
Is there a defined limit on the number of subprograms that can be defined in a package?
Answer:
No
Question:
Why would you define a package specification without a corresponding package body?
Answer:
to define public variables
Question:
What are the two components of a database package?
Answer:
a specification and a body
Question:
Which part of a package, the specification or the body, is required?
Answer:
the specification
Question:
Which SQL*Plus command should you use to invoke a procedure?
Answer:
EXECUTE
Question:
Which compiler directive would you include in the declaration section of a PL/SQL stored procedure to associate an error code with a user-defined exception?
Answer:
PRAGMA EXCEPTION_INIT (exception_name, number);
Question:
In a named procedure, do you use the DECLARE statement to declare local variables?
Answer:
No, you use the DECLARE statement only in anonymous blocks.
Question:
What are the parameters passed into a procedure at invocation called?
Answer:
actual parameters
Question:
When calling a procedure, which method of passing parameters associates actual parameters with formal parameters based on the order in which the parameters were declared?
Answer:
positional
Question:
Where is the declarative section of a procedure located?
Answer:
between the IS or AS keyword and the BEGIN keyword
Question:
When passing a parameter to a procedure, which parameter mode should you use if the value will only be read and NOT modified?
Answer:
IN
Question:
When would you use a local subprogram?
Answer:
when only the existing PL/SQL block needs to reference the code
Question:
Can you use both named and positional notation within the same subprogram call?
Answer:
Yes
Question:
When creating a procedure using a CREATE OR REPLACE PROCEDURE statement, where is the source code of the procedure stored?
Answer:
in the data dictionary
Question:
Which statement would you use to remove a procedure from the database?
Answer:
DROP PROCEDURE
Question:
When defining a parameter in a procedure's formal parameter list, how can you specify the data type of the parameter?
Answer:
by specifying a valid Oracle data type or by using %TYPE or %ROWTYPE
Question:
What is a named PL/SQL procedure stored on the Oracle server called?
Answer:
a server-side procedure
Question:
Which two actions occur when a server-side procedure terminates abnormally?
Answer:
A rollback occurs, and the raised exception is passed back to the calling environment.
Question:
When defining a procedure, what are the three parameter modes allowed for formal parameters?
Answer:
IN, OUT, and IN OUT
Question:
Which keywords can be included in a CREATE PROCEDURE statement to drop and re-create an already existing stored procedure?
Answer:
OR REPLACE
Question:
What is a subprogram defined in the declarative section of another PL/SQL block called?
Answer:
a local subprogram
Question:
If no mode is specified for a formal parameter in a procedure declaration, to which mode does the parameter default?
Answer:
IN
Question:
What should you do to handle an unexpected run-time error in a PL/SQL stored procedure?
Answer:
Declare an exception, associate an error code, and include an EXCEPTION block to handle the error
Question:
If a server-side procedure encounters an error for which there is no explicit error-handling logic, what happens to the raised exception?
Answer:
It is returned to the calling procedure or the calling environment
Question:
From which underlying data dictionary view does the SHOW ERRORS command retrieve information about procedure compilation errors?
Answer:
USER_ERRORS
Question:
When defining parameters in a procedure's formal parameter list, which keyword can you include to have the parameter automatically assigned a value if no value is explicitly passed to the procedure?
Answer:
DEFAULT
Question:
When calling a procedure, how do you specify the passed parameters using named notation?
Answer:
by passing each parameter including the parameter name and the value assignment with the =>operator between the parameter name and value
Question:
When declaring procedure parameters in a formal parameter list, which four pieces of information can be declared for each parameter?
Answer:
name, mode, data type, and default value
Question:
In a procedure declaration, where is the formal parameter list specified?
Answer:
after the procedure name and before the IS or AS keyword
Question:
Which type of named subprogram would you usually create to perform an action without returning a value?
Answer:
procedure
Question:
How do you declare a user-defined exception within a PL/SQL stored procedure?
Answer:
Declare a local variable of type EXCEPTION.
Question:
Which keywords surround the executable section of a stored procedure?
Answer:
BEGIN and END, or BEGIN and EXCEPTION if the procedure contains an exception section
Question:
Which two parameter modes allow you to return values to the calling environment?
Answer:
OUT and IN OUT
Question:
What is the syntax for creating a procedure?
Answer:
CREATE [OR REPLACE] PROCEDURE procedure_name [(parameter1 [mode1] data type, parameter2 [mode2] data type, ...)] IS | AS ... BEGIN ... ]EXCEPTION] ... END [procedure_name
Question:
Can you roll back a DROP PROCEDURE statement?
Answer:
No, the DROP PROCEDURE statement is a DDL command and is, therefore, auto-committing
Question:
In a procedure definition, where are local variables declared?
Answer:
after the IS or AS keyword, but before the BEGIN keyword
Question:
What are the parameters in the procedure declaration known as?
Answer:
formal parameters
Question:
When calling a procedure, how do you specify the passed parameters using positional notation?
Answer:
passing only the parameter values separated by commas
Question:
If you have defined a variable using the SQL*Plus VARIABLE command, how must you reference that variable if you pass it as a procedure parameter in an EXECUTE command?
Answer:
as a host bind variable
Question:
Which SQL*Plus command can you use to display compilation errors generated as a result of issuing a CREATE OR REPLACE PROCEDURE statement?
Answer:
SHOW ERRORS
Question:
Which two data dictionary views can you query to retrieve the source code of a procedure that you created?
Answer:
ALL_SOURCE and USER_SOURCE
Question:
In a PL/SQL stored procedure, where must any local subprograms be declared?
Answer:
between the IS or AS keyword and the BEGIN statement, after all local variable declarations
Question:
Which section of a stored procedure body is the only section that is required?
Answer:
executable section
Question:
Which SQL*Plus command should you use to create a variable that will hold a return value from a
called procedure?
Answer:
VARIABLE
Question:
Which data dictionary view can you query to display compilation errors that you encountered when creating a procedure or function?
Answer:
USER_ERRORS. These errors are also visible in ALL_ERRORS and DBA_ERRORS
Question:
Which parameter mode must be used for parameters that will be passed into a procedure, modified by the procedure, and passed back to the calling program?
Answer:
IN OUT
Question:
Where is a local subprogram visible?
Answer:
only from within the procedure in which it is defined
Question:
Which parameter mode would you use for a formal parameter that needed to be read-only?
Answer:
IN
Question:
Name the four sections of a PL/SQL stored procedure.
Answer:
header, declaration, executable, and exception
Question:
How can you constrain a formal parameter of a procedure to a data type and precision from an underlying scalar database column?
Answer:
Use the %TYPE attribute.
Question:
When running a procedure using the SQL*Plus EXECUTE command, how must the parameter list passed to the procedure be offset?
Answer:
using parentheses
Question:
Which piece of information can you optionally include with the END statement of a procedure?
Answer:
the name of the procedure
Question:
Can a procedure be called from within a SQL statement?
Answer:
No, procedures cannot be called from within a SQL statement, but rather are executed as a PL/SQL statement
Question:
Which statement would you use to re-create a procedure that already exists in the database?
Answer:
CREATE OR REPLACE PROCEDURE
Question:
How can a procedure return a value?
Answer:
by including an OUT parameter in the procedure's formal parameter list
Question:
Which additional clause(s) can be included within the exception block of a PL/SQL subprogram to execute different logic for different user-defined exceptions?
Answer:
WHEN exception_name THEN
Question:
Can a formal parameter defined with a mode of OUT be placed on the right-hand side of an assignment operator?
Answer:
No, it can only be placed on the left-hand side of an assignment operator because an OUT argument cannot be read.
Question:
Which method of passing parameters must be used when NOT all arguments are specified or when arguments are specified in a different order than the declaration?
Answer:
named
Question:
When would you use %ROWTYPE in an argument list?
Answer:
when passing a record argument to or from a procedure or function
Question:
When a formal parameter is declared with a DEFAULT clause, can the procedure be called without passing this parameter at invocation?
Answer:
Yes, the parameter is assigned the value specified in the DEFAULT clause
Question:
Must a procedure return a value?
Answer:
No. Procedures may return values using OUT arguments, but this is not required.
Question:
When specifying parameter values using the named method, which operator is used to assign a value to an argument at invocation?
Answer:
=>
Question:
Can formal parameters in a procedure declaration be constrained by explicitly specifying a length?
Answer:
No, only by data type. However, you can use %TYPE and %ROWTYPE
Question:
Which formal parameter list would you use to pass a numeric value, v1, into the procedure, but allow the value to be optional, assuming the value of 1 if no value is passed?
Answer:
(v1 IN NUMBER DEFAULT 1)
Question:
Where is the exception section of a PL/SQL stored procedure located?
Answer:
between the EXCEPTION and END keywords
Question:
When calling a procedure, which method of passing parameters allows you to specify parameters in a different order than the order in which they were originally declared?
Answer:
named