Database Programming with PL/SQL
2-3: Recognizing Data Types
Practice Activities
Vocabulary
Store large blocks of single-byte or fixed width multi-byte NCHAR data in the database. - NCLOB
Hold values, called locators, that specify the location of large objects (such as graphic images) that are stored out of line. - LOB
Hold a single value with no internal components. - Scalar
Store large unstructured or structured binary objects. - BLOB
Contain internal elements that are either scalar (record) or composite (record and table) - Composite
Store large binary files outside of the database. - BFILE
Hold values, called pointers, that point to a storage location. - Reference
A schema object with a name, attributes, and methods. - Object
Store large blocks of character data in the database. - CLOB
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. It is useful to know how much memory to allocate for each variable and how to read the binary values from the memory.
2. Identify the three data type categories covered in this course.
LOB
Scalar
Composite
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.
Data Type Data Type Category
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.
Value Data Type Category Data Type
‘Switzerland’ Scalar VARCHAR2
Text of a resume Scalar Varchar2
100.20 Scalar Number
A picture LOB BLOB
1053 Scalar Number
11-Jun-2016 Scalar Date
‘Computer science is the science of the 21st century.’ Scalar Varchar2
Index Last_name 1 'Newman' 2 'Raman' 3 'Han' Composite Table
A movie LOB BFILE
A sound byte LOB BFILE / BLOB
FALSE Scalar BLOB
0 Comments