> For the complete documentation index, see [llms.txt](https://mariadb.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mariadb.com/docs/server/reference/sql-functions/numeric-functions/oct.md).

# OCT

## Syntax

```bnf
OCT(N)
```

## Description

Returns a string representation of the octal value of N, where N is a longlong ([BIGINT](/docs/server/reference/data-types/numeric-data-types/bigint.md)) number. This is equivalent to [CONV(N,10,8)](/docs/server/reference/sql-functions/numeric-functions/conv.md). Returns `NULL` if N is `NULL`.

## Examples

```sql
SELECT OCT(34);
+---------+
| OCT(34) |
+---------+
| 42      |
+---------+

SELECT OCT(12);
+---------+
| OCT(12) |
+---------+
| 14      |
+---------+
```

## See Also

* [CONV()](/docs/server/reference/sql-functions/numeric-functions/conv.md)
* [BIN()](/docs/server/reference/sql-functions/string-functions/bin.md)
* [HEX()](/docs/server/reference/sql-functions/string-functions/hex.md)

<sub>*This page is licensed: GPLv2, originally from*</sub> [<sub>*fill\_help\_tables.sql*</sub>](https://github.com/MariaDB/server/blob/main/scripts/fill_help_tables.sql)

{% @marketo/form formId="4316" %}
