MySQL OCT() Function
In MySQL, the OCT()
function return a string representation of the octal value of a given number.
OCT()
Syntax
Here is the syntax of MySQL OCT()
function:
OCT(number)
Parameters
number
- Required. A number
Return value
The OCT()
function return a string representation of the octal value of a given number.
- If the
number
argument is not numeric, thenumber
function tries to convert it to a number first and then returns the octal representation of the number. - The
OCT()
function will returnNULL
if thenumber
argument isNULL
.
OCT()
Examples
SELECT
OCT(2),
OCT(5),
OCT(18),
OCT(186),
OCT(1.5),
OCT(3.6),
OCT('A'),
OCT('3A'),
OCT(NULL)\G
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): NULL