Skip to content
Related Articles
Get the best out of our app
GeeksforGeeks App
Open App
geeksforgeeks
Browser
Continue

Related Articles

Hex() and Oct() Function Function in MS Access

Improve Article
Save Article
Like Article
Improve Article
Save Article
Like Article

1. Hex() Function : Hex() Function in MS Access is used to returns a String representing the hexadecimal value of a number. Syntax :

Hex(number)

Parameter : This method accepts one parameter as mentioned above and described below :

  • number : It is any valid numeric expression or string expression.

Returns : If the number is null it returns null, if the number is Empty then it returns Zero (0). Otherwise it returns a String representing the hexadecimal value of a number. Note : If number is not already a whole number, it is rounded to the nearest whole number before being evaluated. Example-1 : Hexadecimal representation of 2.

SELECT Hex(2) AS HexNumber;

Output :

HexNumber
2

Example-2 : Hexadecimal representation of 13.

SELECT Hex(13) AS HexNumber;

Output :

HexNumber
D

Example-3 : Hexadecimal representation of 1134.80.

SELECT Hex(1134.80) AS HexNumber;        

Output :

HexNumber
46F

2. Oct() Function : Oct() Function in MS Access is used to returns a String representing the octal value of a number. Syntax :

Oct(number)

Parameter : This method accepts one parameter as mentioned above and described below :

  • number : It is any valid numeric expression or string expression.

Returns : If the number is null it returns null, if the number is Empty then it returns Zero (0).Otherwise it returns a String representing the octal value of a number. Note : If number is not already a whole number, it is rounded to the nearest whole number before being evaluated. Example-1 : Octal representation of 7.

SELECT Oct(7) AS OctNumber;                

Output :

OctNumber
7

Example-2 : Octal representation of 111.45.

SELECT Oct(111.45) AS OctNumber;                

Output :

OctNumber
157
My Personal Notes arrow_drop_up
Last Updated : 29 Dec, 2022
Like Article
Save Article
Similar Reads