Skip to Main Content
Oracle PL/SQL Programming: A Developer's Workbook
book

Oracle PL/SQL Programming: A Developer's Workbook

by Steven Feuerstein, Andrew Odewahn
May 2000
Intermediate to advanced content levelIntermediate to advanced
594 pages
11h 32m
English
O'Reilly Media, Inc.
Content preview from Oracle PL/SQL Programming: A Developer's Workbook

Chapter 5. Records

Beginner

Q:

5-1.

The statements are:

  1. False. A record is not a scalar datatype, meaning that it contains only one piece of information. The whole point of a record is to contain multiple pieces of information: it is a composite datatype whose structure is much like a row in a database table.

  2. True.

  3. False. A record is not designed specifically to hold sounds, but you could (in Oracle8 and above) easily define a record with a LOB (large object) field that contains a sound file.

  4. False. It doesn’t make any sense to define a record based on a tablespace. You can, on the other hand, define a record that resembles a row in a table or row fetched by a cursor.

  5. True.

Q:

5-2.

Only the format shown in (c), called dot notation, can reference a field in a record. In general, you refer to an individual field in a record as record_name.field_name. You must always use the fully qualified name of a field when referencing that field.

Q:

5-3.

To define a table-based record, use the %ROWTYPE declaration attribute:

DECLARE
   ceo_rec ceos%ROWTYPE;

Q:

5-4.

The statements are:

  1. False. A table-based record takes its definition from the structure of a table: each field has the same name and datatype as each and every column in its associated table (not just the nonnumeric fields). To define a table-based record, declare it with the %ROWTYPE attribute (you can only use %TYPE with scalar variable declarations). Suppose the emp table is defined as follows:

    CREATE TABLE emp ( empno NUMBER, ename VARCHAR2(30), hiredate ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Oracle Database 12c PL/SQL Programming

Oracle Database 12c PL/SQL Programming

Michael McLaughlin
Oracle PL/SQL for DBAs

Oracle PL/SQL for DBAs

Arup Nanda, Steven Feuerstein
Oracle PL/SQL For Dummies

Oracle PL/SQL For Dummies

Michael Rosenblum, Paul Dorsey

Publisher Resources

ISBN: 9781449324070Supplemental ContentErrata Page