Golang Tutorials - Learn Go Programming with Easy Step-by-Step Guides

Explore comprehensive Golang tutorials for beginners and advanced programmers. Learn Go programming with easy-to-follow, step-by-step guides, examples, and practical tips to master Go language quickly.

Oct Function In Sql in SQL

Oct Function In Sql in SQL

OCT Function in SQL

The OCT() function converts a decimal (base-10) number to its octal (base-8) representation as a string.


? Syntax:

OCT(number)
  • number: A decimal integer to convert.


? Example:

SELECT OCT(10) AS octal_value;

Result:

octal_value
12

Explanation: Decimal 10 = Octal 12.


Notes:

  • Available in MySQL.

  • Returns the octal representation as a string.

  • If input is negative, it returns the two’s complement octal value.


If you want to convert octal back to decimal, MySQL uses CONV() function or CAST() with specific conversions.


Need examples for other base conversions?

Disclaimer for AI-Generated Content:
The content provided in these tutorials is generated using artificial intelligence and is intended for educational purposes only.
html
docker
php
kubernetes
golang
mysql
postgresql
mariaDB
sql