LESSON 2 HOMEWORK
1
Database Programming with PL/SQL
2-1:
Using Variables in PL/SQL
Practice Activities
Vocabulary
Identify the vocabulary word for each definition below:
Variables
Used for storage of data and manipulation of stored values.
Parameters
Values passed to a program by a user or by another program to customize
the program.
Try It / Solve It
1.
Fill in the blanks.
A.
Variables can be assigned to the output of a subprogram
B.
Variables can be assigned values in the declarative section of a PL/SQL block.
C.
Variables can be passed as parameters
to subprograms.
2.Identify valid and invalid variable declaration and initialization:

LESSON 2 HOMEWORK
2
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of
their respective owners.
2
3.Examine the following anonymous block and choose the appropriate statement. DECLARE fnameVARCHAR2(25); lname VARCHAR2(25) DEFAULT 'fernandez'; BEGIN DBMS_OUTPUT.PUT_LINE(fname || ' ' || lname); END; A.The block will execute successfully and print ‘ fernandez’. 4.In Application Express: A.Create the following function: CREATE FUNCTION num_characters (p_string IN VARCHAR2)
B.Create and execute the following anonymous block:

LESSON 2 HOMEWORK
3
5.Write an anonymous block that uses a country name as input and prints the highest and lowest elevations for that country. Use the COUNTRIES table. Execute your block three times using United States of America, French Republic, and Japan.

LESSON 2 HOMEWORK
4
Copyright © 2016, Oracle and/or its affiliates. All rights reserved. Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of
their respective owners.
Database Programming with PL/SQL
2-2:
Recognizing PL/SQL Lexical Units
Practice Activities
Vocabulary
Identify the vocabulary word for each definition below:
A literal
An explicit numeric, character string, date, or Boolean value that is not
represented by an identifier.

