# ROW

The `ROW()` function constructs a `RECORD` object that may be used in an expression or assigned into a `RECORD` type variable.

## Example

The following function creates a record value using `ROW()`:

```sql
DELIMITER //
CREATE FUNCTION f() RETURNS INT AS
DECLARE
  r RECORD(a int, b int);
BEGIN
  r = ROW(1, 2);
  RETURN r.a + r.b;
END //
DELIMITER ;

```

Here’s an example use of this function:

```sql
SELECT f();

```

```output

+------+
| f()  |
+------+
|    3 |
+------+

```

**Type Inference** The data types of the fields of the new `RECORD` object created are inferred from the context of the function or stored procedure. For example, if you assign the value of a new record created with `ROW()` into a record variable, the types of the fields of the new record will be the same as the types of the fields of the record variable to which the new record value is assigned. In the example above, the types of the two fields of the record created by ROW are inferred to be `int` based on the assignment to the variable `r`.

**Related Topics**

* [RECORD](https://docs.singlestore.com/cloud/reference/sql-reference/procedural-sql-reference/record.md): The `RECORD` data type is an encapsulated group of named fields.
* [CREATE\_ARRAY](https://docs.singlestore.com/cloud/reference/sql-reference/procedural-sql-reference/create-array.md): `CREATE_ARRAY()` is used to create an array object.

***

Modified at: May 22, 2023

Source: [/cloud/reference/sql-reference/procedural-sql-reference/row/](https://docs.singlestore.com/cloud/reference/sql-reference/procedural-sql-reference/row/)

(An index of the documentation is available at /llms.txt)
