Updated on 2023-10-31 GMT+08:00

record

record Variables

Perform the following operations to create a record variable:

Define a record type and use this type to declare a variable.

Syntax

For the syntax of the record type, see Figure 1.

Figure 1 Syntax of the record type

The syntax is described as follows:

  • record_type: record name
  • field: record columns
  • datatype: record data type
  • expression: expression for setting a default value

In GaussDB(DWS):

  • When assigning values to record variables, you can:
    • Declare a record type and define member variables of this type when you declare a function or stored procedure.
    • Assign the value of a record variable to another record variable.
    • Use SELECT INTO or FETCH to assign values to a record type.
    • Assign the NULL value to a record variable.
  • The INSERT and UPDATE statements cannot use a record variable to insert or update data.
  • Just like a variable, a record column of the compound type does not have a default value in the declaration.

Examples