---
title: "struct_update function in Strata | Oplema"
description: "Change or add fields in an existing struct, leaving the other fields as they were. Write it as struct_update(s, b := 2) in a Strata Formula or Filter."
url: "https://oplema.com/docs/strata/functions/struct-update"
updated: "2026-11-04"
---

# struct\_update

Change or add fields in an existing struct. Each field takes its name from a named argument, as in struct\_update(s, b := 2).

## Try an expression

In [Formula](https://oplema.com/docs/strata/prep/formula), enter the expression and set Output type to **VARCHAR**.

### Expression

```
struct_update({'a': 1, 'b': 2}, b := 3, c := 4)
```

### Result

```
'{'a': 1, 'b': 3, 'c': 4}'
```

The expression returns `STRUCT(a INTEGER, b INTEGER, c INTEGER)`. Formula stores it as `VARCHAR` in this example. To use your own data, replace the example values with column names. Keep format strings and other options as written.

Try it live in Formula

Result
| id | result |
| --- | --- |
| 1 | {'a': 1, 'b': 3, 'c': 4} |

## Arguments and types

```
struct_update(...)
```

Supported signatures (1)

```
struct_update(...: ANY) → STRUCT
```

The result type can depend on the input types. See DuckDB for the full argument rules.

## Things to know

### With a missing first argument

```
struct_update(CASE WHEN false THEN {'a': 1, 'b': 2} ELSE NULL END, b := 3, c := 4)
```

'{'a': NULL, 'b': 3, 'c': 4}'

## Related functions

[struct\_insert

Add fields to an existing struct. Each new field takes its name from a named argument, as in struct\_insert(s, b := 2).

](https://oplema.com/docs/strata/functions/struct-insert)[struct\_pack

Create a struct from named arguments. Each field takes its name from its argument, as in struct\_pack(a := 1).

](https://oplema.com/docs/strata/functions/struct-pack)[row

Create an unnamed struct from its arguments.

](https://oplema.com/docs/strata/functions/row)[struct\_values

Return the field values of a struct as an unnamed struct.

](https://oplema.com/docs/strata/functions/struct-values)

[Browse structs](https://oplema.com/docs/strata/functions#structs) [DuckDB documentation](https://duckdb.org/docs/current/sql/functions/struct.html#struct_updatestruct-name-any)

Function metadata from DuckDB, used under the [MIT license](https://github.com/duckdb/duckdb/blob/v1.5.4/LICENSE).
