> ## Documentation Index
> Fetch the complete documentation index at: https://docs.risingwave.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Casting

> Certain data types can be cast to and from other types implicitly or explicitly.

* **Implicitly cast to**: Values can be automatically converted to the target type.
* **Assigned to**: Values can be automatically converted when inserted to a column of the target type.
* **Explicitly cast to**: Values can be converted to the target type using explicit [Type casts](https://docs.risingwave.com/sql/query-syntax/value-exp.md#type-casts).

| From type | Implicitly cast to | Assigned to | Explicitly cast to |
| :- | :- | :- | :- |
| **boolean** | | varchar | integer |
| **smallint** | integer  bigint  numeric  real  double  rw\_int256 | varchar | |
| **integer** | bigint  numeric  real  double  rw\_int256 | smallint | boolean |
| **bigint** | numeric  real  double  rw\_int256 | smallint  integer  varchar | |
| **numeric** | real  double | smallint  integer  bigint  varchar | |
| **real** | double | smallint  integer  bigint  numeric  varchar | |
| **double** | | smallint  integer  bigint  numeric  real  varchar | |
| **varchar** | | | boolean  smallint  integer  bigint  numeric  real  double  date  timestamp  timestamp with time zone  time  interval  bytea  jsonb  rw\_int256 |
| **date** | timestamp  timestamp with time zone | varchar | |
| **timestamp** | timestamp with time zone | varchar  date  time | |
| **timestamp with time zone** | | varchar  date  timestamp  time | |
| **time** | interval | varchar | |
| **interval** | | varchar  time | |
| **bytea** | | varchar | |
| **jsonb** | boolean  smallint  integer  bigint  numeric  real  double | varchar | |
| **rw\_int256** | | varchar | |

> [!NOTE]
>
> Structs can be casted to structs explicitly or implicitly if the nested expressions and types can be casted.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.