Comparing row variables and row field values

Row variables cannot be directly compared even if they are the same row data type, however individual row fields can be compared.

Individual fields within a row type can be compared to other values and the comparison rules for the data type of the field apply.

To compare two row variables, individual corresponding field values must be compared.

The following is an example of a comparison of two row values with compatible field definitions in SQL PL:
  IF ROW1.field1 = ROW2.field1 AND
     ROW1.field2 = ROW2.field2 AND
     ROW1.field3 = ROW2.field3
  THEN    
     SET EQUAL = 1;
  ELSE    
     SET EQUAL = 0;
In the example the IF statement is used to perform the procedural logic which sets a local variable EQUAL to 1 if the field values are equal, or 0 if the field values are not equal.