Search notes:

Oracle PL/SQL: RECORD

A record is a tuple with a predefined number of named fields each of which has a data type that is independant from that of other fields.
Thus, a record is fundamentally different from collection types that stores zero, one or more elements of the same data type.
When a record variable is initialized, the initial value of each field is null unless a different initial value was declared for it when the record type was defined.

Creating records

There are three ways to create a record type:
It is not possible to create a record type at schema level.

Default values

declare
   type rec is record (
      fld_one varchar2(10) default 'foo',
      fld_two varchar2(10) default 'bar
      …',
    );
    …

%rowtype

%rowtype can be used to create a record type that represents a row in a table.
declare
   tab_rec tab%rowtype;
   …
%rowtype can also be used to create a record that matches the fields in a cursor:
declare
   cursor cur_xyz is select … from tab;

   rec_cur cur_xyz%rowtype
   …

Assigning null to a record variable

Assigning null to a record variable sets all its fields to null.

Collections

It is possible for a record-field to contain a collection type.

Index

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/developm...', 1745469986, '52.15.179.198', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/development/databases/Oracle/PL-SQL/record/index(84): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78