Font size
WorksheetsPL/SQL Programming
Total questions: 15
Worksheet time: 10mins
which valid identifier?
today
last_name
today's date
Number_of_days_in_February_this_year
Isleap$year
Which valid variable declaration and initialization?
number_of_copies PLS_INTEGER;
PRINTER_NAME constant VARCHAR2(10);
deliver_to VARCHAR2(10):=Johnson;
by_when DATE:= CURRENT_DATE+1;
The %TYPE attribute:
Is used to declare a variable according to a database column definition
Is used to declare a variable according to a collection of columns in a database table or view
Is used to declare a variable according to the definition of another declared variable
Is prefixed with the database table and column name or the name of the declared variable
You can use most SQL single-row functions such as number, character, conversion, and date single-row functions in PL/SQL expressions.
True
False
When using the SELECT statement in PL/SQL, the INTO clause is required and queries can return one or more row.
True
False
There are three types of loops: basic, FOR, and WHILE.
True
False
Identify situations in which you can use the %ROWTYPE attribute
When you are not sure about the structure of the underlying database table
When you want to retrieve an entire row from a table
When you want to declare a variable according to another previously declared variable or database column
You can trap any error by including a corresponding handler within the exception-handling section of the PL/SQL block
True
False
Subprograms:
Are named PL/SQL blocks and can be invoked by other applications
Are compiled only once
Are stored in the database
Do not have to return values if they are functions
Can take parameters
Formal parameters are literal values, variables, and
expressions used in the parameter list of the calling
subprogram
True
False
A PL/SQL stored function:
Does not contain a RETURN clause in the header
Can be invoked as part of an expression
Must contain a RETURN clause in the header
Must return a single value
Must contain at least one RETURN statement
The package specification is the interface to your applications. It declares the public types, variables, constants, exceptions, cursors, and subprograms available for use.
True
False
Overloading subprograms in PL/SQL:
Requires that the subprogram’s formal parameters differ in
number, order, or data type family
Enables you to build flexible ways for invoking
subprograms with different data
Provides a way to extend functionality without loss of
existing code; that is, adding new parameters to existing
subprograms
Enables you to create two or more subprograms with the
same name
The Oracle-supplied UTL_FILE package is used to access
text files in the operating system of the database server.
The database provides functionality through directory objects to allow access to specific operating system directories.
False
True
A triggering event can be one or more of the following:
A CREATE, ALTER, or DROP statement on any schema
object
A specific error message or any error message
A database startup or instance shutdown
An INSERT, UPDATE, or DELETE statement on a specific
table (or view, in some cases)
A user logon or logoff
