You are on page 1of 10

Class

Lecture/Discussion

Notes on the discussion handout


March 30, 2017
Ques<on 1
Header: Name to the program unit and iden<es it as
either a procedure, a func<on, or a package; it can also
iden<fy any parameters.
Declara<ve: This is used to dene variables, constants,
cursors, and excep<ons. This sec<on can be used with
a keyword IS or AS
Executable: This is the main processing area; starts
with the keyword BEGIN and end with the keyword
END
Excep<on(handler): This sec<on is op<onal; it deals
with error handling and starts with the keyword
EXCEPTION.
Ques<on 2
A variable is a structure used to store data during
a PL/SQL block, subprograms, and package
execu<on. Declara<on of a variable allocates
storage space on memory for a value; they also
specify the type of the variable and the name so
that the space can be referenced.
We can also assign a value at declara<on such as
a constant value, NOT NULL or default.
Syntax for variable declara<on is:
Variable_name datatype(size)[:= ini<al value]
Ques<on 3
A constant is a variable whose value never
changes.
It is declared in the declara<ve sec<on; this is
before the executable sec<on.
Syntax for the declara<on is:
Constant_name CONSTANT dataype[(size)] :=
in<al_value
Ques<on 4
There are three parameter modes: IN, OUT, and
IN OUT.
The default parameter mode is IN; this means
that a value is being passed into a subprogram.
The out mode indicates that the subprogram is
passing a value generated within it out to the
calling environment.
The IN OUT means that a value is passed itno a
subprogram; and this may be changed so that the
value is passed out to the calling environment.
Ques<on 5
A func<on must execute a RETURN statement
Func<ons are named or called dierently than
procedures
They are usually called within another
command
Procedures are called as statements.
Ques<on 6
A package has two sec<ons, it has the body
and the specica<on.
1st: Package specica<on
2nd: Package body
The package specica<on is the only part
required; it can exist without a body
A body will not be valid without the
specica<on
Ques<on 7
The INTO clause is required in a SELECT
statement of a PL/SQL subprogram.
Ques<on 8
A RECORD is a composite data structure
It has components that can be manipulated
individually
This is used to treat dissimilar data as a logical
unit.
Ques<on 11
The ow logic of a PL/SQL block can be
changed by using a number of control
structures.
Branching logic is implemented using either IF
statement, or the CASE statement.
These statements are some<mes referred to
as expressions.

You might also like