Intermediate

Q:

9-16.

The statements are:

  1. False. This view lists “database objects” (as opposed to “object objects”) owned by the user, such as tables, procedures, and packages. USER_OBJECTS has been around for quite some time. Now with the Objects option, its name will be confusing.

  2. True. An object type is a database construct, created with a CREATE TYPE statement, and therefore appears in the USER_OBJECTS view.

  3. False. An object instance, which can be a persistent row in an object table or held temporarily in a PL/SQL variable, does not have an entry in USER_OBJECTS. This is consistent with Oracle’s treatment of other rows in (nonobject) tables and values held in (nonobject) PL/SQL variables.

Q:

9-17.

The statements are:

  1. False. The constructor function cannot be modified.

  2. True. The constructor can be called in SQL or PL/SQL.

  3. True. Like other Oracle functions, the constructor can use named notation or positional notation:

    DECLARE
       cd_to_avoid   CD_t;
    BEGIN
       cd_to_avoid := CD_t (
          id => -1000000,
          artist => 'Garth Brooks',
          title => 'Salutes The Chipmunks',
          label => 'Nonesuch' );

    Constructor CD_t is invoked using this named notation.

Q:

9-18.

An object type attribute cannot have a DEFAULT value (e.g., ‘Greatest Hits’). This means that a call to a constructor must supply a value—or the nonvalue NULL—for every attribute of the object type.

Q:

9-19.

The syntax for creating an object type specification is a comma-separated list of attributes and methods; you do not use semicolons in the list, as you’d find in ...

Get Oracle PL/SQL Programming: A Developer's Workbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.