Deck 3: Handling Data In PL/SQL Blocks

Full screen (f)
exit full mode
Question
It is possible to perform SQL commands on an associative array.
Use Space or
up arrow
down arrow
to flip the card.
Question
A(n) composite data type is one that can store and handle multiple values of different data types as one unit. _________________________
Question
PL/SQL blocks use assignment variables to assign values to variables. _________________________
Question
The REF attribute tells the system to look up the data type of a database column and use it for the declared variable. _________________________
Question
A variable declared with a record type can hold one row of data consisting of a number of column values.
Question
A collection is a data type that can store multiple values of different data types as one unit.
Question
A composite data type is a variable that can store and handle multiple values of the same data type as one unit.
Question
When placing data into a table of records variable, you must indicate the field that will hold the value but you need not indicate the row.
Question
A(n) table of records can handle more than one row of data. _________________________
Question
The syntax of the following code fragment is correct.
BEGIN
If lv_rows_num = 0
GOTO insert_row;
End If;
Question
One of the main differences between a nested table and a VARRAY is that a nested table has a set size upon creation.
Question
Declaring a table of records variable in a package specification allows it to persist for a user session.
Question
One major advantage of using collections as part of the physical database is being able to retrieve multiple values with a query of a single column.
Question
Anchored data types are similar to arrays used on other languages.
Question
A(n) index table is an ordered group of elements that allows the handling of multiple values of the same data type as a single unit. _________________________
Question
Declaring a composite variable is different from declaring a scalar variable in that you must create your own data types.
Question
The INTO clause follows the SELECT clause and indicates which variables are to hold the values that are retrieved from the database.
Question
A scalar variable can hold multiple values whereas a composite variable can hold only a single value.
Question
The GOTO statement interrupts the flow of execution of a program.
Question
A disadvantage of using the %TYPE attribute is that there is a slight performance hit in that the database server must look up the data type from the data dictionary.
Question
The ____ markers are used in PL/SQL to identify a label.

A) <>
B) ""
C) << >>
D) :=
Question
A(n) ____ is a variable that can store and handle multiple values of the same data type as one unit.

A) composite data type
B) collection
C) record
D) assignment statement
Question
Which of the following statements about collections is NOT True?

A) Collections are similar to arrays.
B) An index allows references to individual values or rows within a collection.
C) A collection may hold many rows of data and many fields.
D) The values in each row of the collection must be of the same type.
Question
A(n) ____ is a variable that can handle many rows of data but only one field.

A) assignment statement
B) associative array
C) collection
D) table attribute
Question
Which of the following code fragments correctly uses a record variable to hold the row of data queried for a shopper?

A) DECLARE
Rec_shopper bb_shopper%ROWTYPE;
BEGIN
SELECT*
INTO rec_shopper
FROM bb_shopper
WHERE idshopper = :g_shopper;
DBMS_OUTPUT.PUT_LINE(rec_shopper.lastname);
DBMS_OUTPUT.PUT_LINE(rec_shopper.address);
DBMS_OUTPUT.PUT_LINE(rec_shopper.email);
END;
B) DECLARE
Rec_shopper bb_shopper%ROW;
BEGIN
SELECT*
INTO rec_shopper
FROM bb_shopper
WHERE idshopper = :g_shopper;
DBMS_OUTPUT.PUT_LINE(rec_shopper.lastname);
DBMS_OUTPUT.PUT_LINE(rec_shopper.address);
DBMS_OUTPUT.PUT_LINE(rec_shopper.email);
END;
C) DECLARE
Rec_shopper bb_shopper%TYPE;
BEGIN
SELECT*
INTO rec_shopper
FROM bb_shopper
WHERE idshopper = :g_shopper;
DBMS_OUTPUT.PUT_LINE(rec_shopper.lastname);
DBMS_OUTPUT.PUT_LINE(rec_shopper.address);
DBMS_OUTPUT.PUT_LINE(rec_shopper.email);
END;
D) DECLARE
Rec_shopper bb_shopperROWTYPE;
BEGIN
SELECT*
INTO rec_shopper
FROM bb_shopper;
WHERE idshopper = :g_shopper;
END;
Question
The associative array attribute EXISTS returns the total number of values in the table. _________________________
Question
One major advantage of using ____ as part of the physical database is being able to retrieve multiple values with a query of a single column.

A) cursors
B) collections
C) index by tables
D) variables
Question
DECLARE TYPE type_basket IS RECORD(
Basket bb_basket.idBasket%TYPE,
Created bb_basket.dtcreated%TYPE,
Total bb_basket.cost%TYPE,
Qty bb_basket.quantity%TYPE,
Sub bb_basket.subtotal%TYPE);
Rec_basket type_basket;
BEGIN
--- executable code ---
END;
According to the code fragment above, which variable is declared using the type_basket data type?

A) basket
B) rec_basket
C) sub
D) qty
Question
tbl_basketitems(5).idproduct := :g_prod; According to the above statement, which of the following indicates the field into which a value will be placed?

A) idproduct
B) tbl_basketitems
C) :g_row
D) :g_prod
Question
The UPDATE statement is sometimes called a jumping control because it instructs the program to "jump to" some specific area of the code. _________________________
Question
Which of the following allows a table of records value to persist for a user session?

A) Declaring the table of records variable in a row specification.
B) Declaring the table of records variable in a cursor specification.
C) Declaring the table of records variable in a record specification.
D) Declaring the table of records variable in a package specification.
Question
Which of the following code fragments tells the system to look up the data type of a database column and use it for the declared variable?

A) DECLARE
Order NUMBER(2) := 4;
Total_amt NUMBER(2);
BEGIN
--- executable code ---
END;
B) DECLARE
Order.quantity%TYPE;
Total_amt NUMBER(2);
BEGIN
--- executable code ---
END;
C) DECLARE
Order.quantity#TYPE;
Total_amt NUMBER(2);
BEGIN
--- executable code ---
END;
D) DECLARE
Order CONSTANT NUMBER(2) := 4;
Total_amt NUMBER(2);
BEGIN
--- executable code ---
END;
Question
Which of the following attributes is available to enable movement through the associative array data?

A) COUNT
B) DELETE
C) PRIOR
D) EXISTS
Question
Which of the following code fragments correctly creates a record data type that will hold four variables?

A) DECLARE
TYPE type_basket IS RECORD (
Basket bb_basket.idBasket %TYPE,
Created bb_basket.dtcreated%TYPE,
Sub bb_basket.subtotal %TYPE);
Rec_basket type_basket;
BEGIN
--- executable code ---
END;
B) DECLARE
TYPE type_basket IS RECORD (
Basket bb_basket.idBasket%TYPE,
Created bb_basket.dtcreated%TYPE,
Qty bb_basket.quantity%TYPE,
Sub bb_basket.subtotal%TYPE;
Rec_basket type_basket;
BEGIN
--- executable code ---
END;
C) DECLARE
TYPE type_basket IS RECORD (
Bb_basket.dtcreated%TYPE
Qty bb_basket.quantity%TYPE,
Sub bb_basket.subtotal%TYPE);
Rec_basket type_basket;
BEGIN
--- executable code ---
END;
D) DECLARE
TYPE type_basket IS RECORD (
Basket bb_basket.idBasket%TYPE,
Created bb_basket.dtcreated%TYPE,
Qty bb_basket.quantity%TYPE,
Sub bb_basket.subtotal%TYPE );
Rec_basket type_basket;
BEGIN
--- executable code ---
END;
Question
Declaring an associative array data type is quite similar to declaring a(n) table of records data type. _________________________
Question
A(n) ____ can store and handle multiple values of different data types as one unit.

A) composite data type
B) collection
C) record
D) block
Question
Which of the following is sometimes called a jumping control because it instructs programs to "jump to" some specific area of the code?

A) GO TO statement
B) GOTO statement
C) GO_TO statement
D) JUMP statement
Question
Which of the following associative array attributes checks to see if a value has been entered for the stated index number?

A) COUNT
B) FIRST
C) EXISTS
D) PRIOR
Question
____ are functions that can be used in conjunction with table variables and allow greater ability to manipulate table values.

A) Associative array
B) Assignment statements
C) Collections
D) Table attributes
Question
A(n) ____ of data typically includes a number of different fields.

A) row
B) collection
C) assignment statement
D) variable
Question
A(n) ____________________ is similar to a record data type except that it can handle more than one record or row of data.
Question
What do most developers say about using a GOTO statement? Why?
Question
Discuss the meaning of the term collection.
Question
What is an associative array?
Question
The _________________ attribute simplifies the creation of a record variable by referencing a table structure.
Question
A(n) ____________________ statement could be used to create a record data type.
Question
The ____________________ clause follows the SELECT clause and indicates which variables are to hold the values that are retrieved from the database.
Question
A(n) _________________ data type is quite similar to the structure of a row in a database table.
Question
A(n) ____________________ is an ordered group of elements that allows the handling of multiple values of the same data type as a single unit.
Question
The ____________________ attribute tells the system to look up the data type of a database column and use this data type for the declared variable.
Question
Which of the following statements is incorrect?

A) The GOTO action interrupts the flow of execution, making it very difficult to understand and maintain the code.
B) Even though the GOTO statement exists, most developers believe this should be used very sparingly.
C) Most developers believe that the GOTO statement should be used as many times as possible.
D) Even though the GOTO statement exists, most developers believe this should be used only if no other method can be used to accomplish the task at hand.
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/51
auto play flashcards
Play
simple tutorial
Full screen (f)
exit full mode
Deck 3: Handling Data In PL/SQL Blocks
1
It is possible to perform SQL commands on an associative array.
False
2
A(n) composite data type is one that can store and handle multiple values of different data types as one unit. _________________________
True
3
PL/SQL blocks use assignment variables to assign values to variables. _________________________
False, statements
4
The REF attribute tells the system to look up the data type of a database column and use it for the declared variable. _________________________
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
5
A variable declared with a record type can hold one row of data consisting of a number of column values.
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
6
A collection is a data type that can store multiple values of different data types as one unit.
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
7
A composite data type is a variable that can store and handle multiple values of the same data type as one unit.
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
8
When placing data into a table of records variable, you must indicate the field that will hold the value but you need not indicate the row.
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
9
A(n) table of records can handle more than one row of data. _________________________
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
10
The syntax of the following code fragment is correct.
BEGIN
If lv_rows_num = 0
GOTO insert_row;
End If;
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
11
One of the main differences between a nested table and a VARRAY is that a nested table has a set size upon creation.
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
12
Declaring a table of records variable in a package specification allows it to persist for a user session.
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
13
One major advantage of using collections as part of the physical database is being able to retrieve multiple values with a query of a single column.
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
14
Anchored data types are similar to arrays used on other languages.
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
15
A(n) index table is an ordered group of elements that allows the handling of multiple values of the same data type as a single unit. _________________________
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
16
Declaring a composite variable is different from declaring a scalar variable in that you must create your own data types.
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
17
The INTO clause follows the SELECT clause and indicates which variables are to hold the values that are retrieved from the database.
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
18
A scalar variable can hold multiple values whereas a composite variable can hold only a single value.
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
19
The GOTO statement interrupts the flow of execution of a program.
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
20
A disadvantage of using the %TYPE attribute is that there is a slight performance hit in that the database server must look up the data type from the data dictionary.
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
21
The ____ markers are used in PL/SQL to identify a label.

A) <>
B) ""
C) << >>
D) :=
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
22
A(n) ____ is a variable that can store and handle multiple values of the same data type as one unit.

A) composite data type
B) collection
C) record
D) assignment statement
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
23
Which of the following statements about collections is NOT True?

A) Collections are similar to arrays.
B) An index allows references to individual values or rows within a collection.
C) A collection may hold many rows of data and many fields.
D) The values in each row of the collection must be of the same type.
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
24
A(n) ____ is a variable that can handle many rows of data but only one field.

A) assignment statement
B) associative array
C) collection
D) table attribute
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
25
Which of the following code fragments correctly uses a record variable to hold the row of data queried for a shopper?

A) DECLARE
Rec_shopper bb_shopper%ROWTYPE;
BEGIN
SELECT*
INTO rec_shopper
FROM bb_shopper
WHERE idshopper = :g_shopper;
DBMS_OUTPUT.PUT_LINE(rec_shopper.lastname);
DBMS_OUTPUT.PUT_LINE(rec_shopper.address);
DBMS_OUTPUT.PUT_LINE(rec_shopper.email);
END;
B) DECLARE
Rec_shopper bb_shopper%ROW;
BEGIN
SELECT*
INTO rec_shopper
FROM bb_shopper
WHERE idshopper = :g_shopper;
DBMS_OUTPUT.PUT_LINE(rec_shopper.lastname);
DBMS_OUTPUT.PUT_LINE(rec_shopper.address);
DBMS_OUTPUT.PUT_LINE(rec_shopper.email);
END;
C) DECLARE
Rec_shopper bb_shopper%TYPE;
BEGIN
SELECT*
INTO rec_shopper
FROM bb_shopper
WHERE idshopper = :g_shopper;
DBMS_OUTPUT.PUT_LINE(rec_shopper.lastname);
DBMS_OUTPUT.PUT_LINE(rec_shopper.address);
DBMS_OUTPUT.PUT_LINE(rec_shopper.email);
END;
D) DECLARE
Rec_shopper bb_shopperROWTYPE;
BEGIN
SELECT*
INTO rec_shopper
FROM bb_shopper;
WHERE idshopper = :g_shopper;
END;
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
26
The associative array attribute EXISTS returns the total number of values in the table. _________________________
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
27
One major advantage of using ____ as part of the physical database is being able to retrieve multiple values with a query of a single column.

A) cursors
B) collections
C) index by tables
D) variables
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
28
DECLARE TYPE type_basket IS RECORD(
Basket bb_basket.idBasket%TYPE,
Created bb_basket.dtcreated%TYPE,
Total bb_basket.cost%TYPE,
Qty bb_basket.quantity%TYPE,
Sub bb_basket.subtotal%TYPE);
Rec_basket type_basket;
BEGIN
--- executable code ---
END;
According to the code fragment above, which variable is declared using the type_basket data type?

A) basket
B) rec_basket
C) sub
D) qty
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
29
tbl_basketitems(5).idproduct := :g_prod; According to the above statement, which of the following indicates the field into which a value will be placed?

A) idproduct
B) tbl_basketitems
C) :g_row
D) :g_prod
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
30
The UPDATE statement is sometimes called a jumping control because it instructs the program to "jump to" some specific area of the code. _________________________
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
31
Which of the following allows a table of records value to persist for a user session?

A) Declaring the table of records variable in a row specification.
B) Declaring the table of records variable in a cursor specification.
C) Declaring the table of records variable in a record specification.
D) Declaring the table of records variable in a package specification.
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
32
Which of the following code fragments tells the system to look up the data type of a database column and use it for the declared variable?

A) DECLARE
Order NUMBER(2) := 4;
Total_amt NUMBER(2);
BEGIN
--- executable code ---
END;
B) DECLARE
Order.quantity%TYPE;
Total_amt NUMBER(2);
BEGIN
--- executable code ---
END;
C) DECLARE
Order.quantity#TYPE;
Total_amt NUMBER(2);
BEGIN
--- executable code ---
END;
D) DECLARE
Order CONSTANT NUMBER(2) := 4;
Total_amt NUMBER(2);
BEGIN
--- executable code ---
END;
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
33
Which of the following attributes is available to enable movement through the associative array data?

A) COUNT
B) DELETE
C) PRIOR
D) EXISTS
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
34
Which of the following code fragments correctly creates a record data type that will hold four variables?

A) DECLARE
TYPE type_basket IS RECORD (
Basket bb_basket.idBasket %TYPE,
Created bb_basket.dtcreated%TYPE,
Sub bb_basket.subtotal %TYPE);
Rec_basket type_basket;
BEGIN
--- executable code ---
END;
B) DECLARE
TYPE type_basket IS RECORD (
Basket bb_basket.idBasket%TYPE,
Created bb_basket.dtcreated%TYPE,
Qty bb_basket.quantity%TYPE,
Sub bb_basket.subtotal%TYPE;
Rec_basket type_basket;
BEGIN
--- executable code ---
END;
C) DECLARE
TYPE type_basket IS RECORD (
Bb_basket.dtcreated%TYPE
Qty bb_basket.quantity%TYPE,
Sub bb_basket.subtotal%TYPE);
Rec_basket type_basket;
BEGIN
--- executable code ---
END;
D) DECLARE
TYPE type_basket IS RECORD (
Basket bb_basket.idBasket%TYPE,
Created bb_basket.dtcreated%TYPE,
Qty bb_basket.quantity%TYPE,
Sub bb_basket.subtotal%TYPE );
Rec_basket type_basket;
BEGIN
--- executable code ---
END;
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
35
Declaring an associative array data type is quite similar to declaring a(n) table of records data type. _________________________
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
36
A(n) ____ can store and handle multiple values of different data types as one unit.

A) composite data type
B) collection
C) record
D) block
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
37
Which of the following is sometimes called a jumping control because it instructs programs to "jump to" some specific area of the code?

A) GO TO statement
B) GOTO statement
C) GO_TO statement
D) JUMP statement
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
38
Which of the following associative array attributes checks to see if a value has been entered for the stated index number?

A) COUNT
B) FIRST
C) EXISTS
D) PRIOR
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
39
____ are functions that can be used in conjunction with table variables and allow greater ability to manipulate table values.

A) Associative array
B) Assignment statements
C) Collections
D) Table attributes
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
40
A(n) ____ of data typically includes a number of different fields.

A) row
B) collection
C) assignment statement
D) variable
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
41
A(n) ____________________ is similar to a record data type except that it can handle more than one record or row of data.
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
42
What do most developers say about using a GOTO statement? Why?
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
43
Discuss the meaning of the term collection.
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
44
What is an associative array?
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
45
The _________________ attribute simplifies the creation of a record variable by referencing a table structure.
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
46
A(n) ____________________ statement could be used to create a record data type.
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
47
The ____________________ clause follows the SELECT clause and indicates which variables are to hold the values that are retrieved from the database.
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
48
A(n) _________________ data type is quite similar to the structure of a row in a database table.
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
49
A(n) ____________________ is an ordered group of elements that allows the handling of multiple values of the same data type as a single unit.
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
50
The ____________________ attribute tells the system to look up the data type of a database column and use this data type for the declared variable.
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
51
Which of the following statements is incorrect?

A) The GOTO action interrupts the flow of execution, making it very difficult to understand and maintain the code.
B) Even though the GOTO statement exists, most developers believe this should be used very sparingly.
C) Most developers believe that the GOTO statement should be used as many times as possible.
D) Even though the GOTO statement exists, most developers believe this should be used only if no other method can be used to accomplish the task at hand.
Unlock Deck
Unlock for access to all 51 flashcards in this deck.
Unlock Deck
k this deck
locked card icon
Unlock Deck
Unlock for access to all 51 flashcards in this deck.