MariaDB OCT() Function
The MariaDB OCT() function returns the string representation of the octal value of the given number.
MariaDB OCT() Syntax
Here is the syntax of the MariaDB OCT() function:
OCT(num)
Parameters
num-
Required. Requires a number represented in octal.
Return value
The MariaDB OCT() function returns a string representing the octal value of the given number.
If the num parameter is of non-numeric type, the OCT() function will try to convert it to a number before returning the octal representation of the number.
If the num parameter is NULL, the OCT() function will return NULL.
MariaDB OCT() Examples
This statement shows the basic usage of the MariaDB OCT() function:
SELECT
OCT(2),
OCT(5),
OCT(18),
OCT(186),
OCT(1.5),
OCT(3.6),
OCT('A'),
OCT('3A'),
OCT(NULL)\G
Output:
*************************** 1\. row ***************************
OCT(2): 2
OCT(5): 5
OCT(18): 22
OCT(186): 272
OCT(1.5): 1
OCT(3.6): 3
OCT('A'): 0
OCT('3A'): 3
OCT(NULL): NULLConclusion
The MariaDB OCT() function returns the string representation of the octal value of the given number.