Miscellaneous function in oracle

main Image
Miscellaneous Function: - These functions do not work on any datatype and such functions are categorized in different category and are referred as miscellaneous function.

Here we are login as by default user of oracle named “SYSTEM”.

Login in oracle

Login in oracle

These are divided as below:

1. UID:- This function returns user id of user currently login. This is used with dual table to get output.

Syntax
UID


Use of UID function

Use of UID function

2. USER:- This function returns name of user currently login.

Syntax
USER


Use of USER function

Use of USER function

3. GREATEST:- This function returns largest value from value passed as arguments. You can use any number of arguments and any datatype in expression.

Syntax
GREATEST(value 1,value 2, value 3,…..value N)


In above syntax “value” referred to any value that can compared with other value.

Use of GREATEST function

Use of GREATEST function

4. LEAST:- This function returns smallest value from value passed as arguments. You can use any number of arguments and any datatype in expression.

Syntax
LEAST(value 1,value 2, value 3,…..value N)


In above syntax “value” referred to any value that can compared with other value.

Use of LEAST function

Use of LEAST function

5. DECODE:- This function compares first argument with all even number arguments (2, 4, 6,.....) and if any one argument is matched then argument after matched argument is display as output.

Also if no argument is matched then last argument in expression is return as output.

Syntax
DECODE(value,if1,then1,if2,then2,…..,else)


Above syntax is similar to if-then-else condition in programming language.

Use of DECODE function

Use of DECODE function

Use of DECODE function

Use of DECODE function

Use of DECODE function

Use of DECODE function

6. NVL:-This function returns first argument but when first argument is “null” then it will return second argument.

Syntax
NVL (value 1, value 2)


In above syntax “value 1” and “value 2” are any numerical, character, date datatype or null value.

Use of NVL function

Use of NVL function

Use of NVL function

Use of NVL function

7. VSIZE:- This function returns storage size of any value passed in argument.

Syntax
VSIZE(value)


In above syntax “value” is any numerical, character or date datatype.

Use of VSIZE function

Use of VSIZE function

Use of VSIZE function

Use of VSIZE function

Use of VSIZE function

Use of VSIZE function

I hope this article will help you