---
title: "SQL_VARIANT"
description: "The SQL_VARIANT SQL function gets a property of a value, similar to the SQL_VARIANT_PROPERTY function of SQL Server."
language: en
source_language: en
translation_state: complete
canonical: https://documentation.invantive.eu/en/docs/invantive-universalsql/grammar/sql-functions/sql-variant
original: https://documentation.invantive.eu/en/docs/invantive-universalsql/grammar/sql-functions/sql-variant
updated: 2026-08-09T00:00:00Z
license: https://documentation.invantive.eu/en/
---

## Syntax
```mermaid
%%{init: {
  'theme': 'base',
  'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
  'themeVariables': {
    'fontSize': '11px',
    'fontFamily': 'Arial'
  }
}}%%
flowchart LR
    Start((START)) --> SQL_VARIANT[SQL_VARIANT]:::quoted
    SQL_VARIANT --> End((END))
```

## Purpose
The `SQL_VARIANT` SQL function gets a property of a value, similar to the `SQL_VARIANT_PROPERTY` function of SQL Server. The following properties are available:

- `DotnetDataType`: the .NET data type of the value.
- `BaseType`: the database data type of the value.
- `Precision`: the precision of the value.
- `Scale`: the scale of the value.
- `TotalBytes`: the number of bytes of the value.
- `MaxLength`: the maximum length of the value in bytes.

Parameters:
- Value (`ANY`): the value to get the property of.
- Property (`varchar2`): the name of the property. Must be a constant.

Returns: the value of the property; the data type depends on the property.

## Examples
The following example retrieves the precision of an integer value:
```sql
select sql_variant(5, 'Precision')

-------------------
0
```
The following example retrieves the precision of a date/time value:
```sql
select sql_variant(sysdate, 'Precision')

-------------------
23
```
The following example retrieves the number of a bytes of `true`:
```sql
select sql_variant(true, 'TotalBytes')

-------------------
1
```