Documente Academic
Documente Profesional
Documente Cultură
com
Vocabulary
Identify the vocabulary word for each definition below:
Try It / Solve It
1. Fill in the blanks.
Copyright © 2019, 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
fname VARCHAR2(25);
lname VARCHAR2(25) DEFAULT 'fernandez';
BEGIN
DBMS_OUTPUT.PUT_LINE(fname || ' ' || lname);
END;
E. The block will give an error because the FNAME variable is not declared.
4. In Application Express:
DECLARE
v_length_of_string INTEGER;
BEGIN
v_length_of_string := num_characters('Oracle Corporation');
DBMS_OUTPUT.PUT_LINE(v_length_of_string);
END;
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 Unit-
ed States of America, French Republic, and Japan.
DECLARE
v_country_name varchar2(50):= ‘United States of America’;
v_lowest_elevation number(6);
v_highest_elevation number(6);
BEGIN
SELECT lowest_elevation, highest_elevation
INTO v_lowest_elevation, v_highest_elevation
FROM wf_countries
WHERE country_name = v_country_name;
DBMS_OUTPUT.PUT_LINE('The lowest elevation for '||v_country_name ||' is: '||
v_lowest_elevation);
DBMS_OUTPUT.PUT_LINE('The highest elevation for '||v_country_name ||' is: '||
v_highest_elevation);
END;
academy.oracle.com
Copyright © 2019, 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
Valid Invalid
Identifier Why Invalid?
(X) (X)
Today
X
Last name
X Contain space
today’s_date
X Contain ‘
number_of_days_in_february_this_
year
X Contain space
Isleap$year
X
#number
X # on begining
NUMBER#
X
Number1to7
X
create Y
make N
table Y
seat N
alter Y
rename Y
row Y
number Y
3
web N
3. What kind of lexical unit (for example Reserved word, Delimiter, Literal, Comment) is each of the
following?
Value Lexical Unit
:= DELIMITER
'TEST' LITERAL
FALSE LITERAL
-- new process COMMENT
FROM RESERVED WORD
v_test LITERAL
4.09 LITERAL
academy.oracle.com
Try It / Solve It
1. In your own words, describe what a data type is and explain why it is important.
PL/SQL uses special data types to keep track of the different types of data it processes. These data
types define how the data is physically stored, what the constraints for the data are, and finally,
what the valid range of values for the data is.
Copyright © 2019, 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. Identify the three data type categories covered in this course.
Copyright © 2019, 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. Identify three data types covered in the Database Programming with SQL course.
Number, Date, Varchar2
4. What data type can be used in PL/SQL, but can’t be used to define a table column?
Boolean
5. Which data type indicates a large data object that is stored outside of the database?
BFILE
6. Identify the data type category (LOB, Scalar, or Composite) for each data type. Each category may
be used more than once.
CLOB LOB
VARCHAR2
Scalar
BLOB LOB
NUMBER Scalar
BFILE LOB
TIMESTAMP Scalar
NCLOB LOB
RECORD Composite
PLS_INTEGER Scalar
LONG Scalar
TABLE Composite
BOOLEAN Scalar
7. Enter the data type category and the data type for each value. The first one has been done for
you.
Index Last_name
1 'Newman'
2 'Raman' COMPOSITE TABLE
3 'Han'