VALUE
Example
Section titled “Example”DECLARE @MyVar AS INT;SET @MyVar = 5;SELECT VALUE = @MyVar;Output
Section titled “Output”VALUE5Explanation
Section titled “Explanation”In the code provided, a variable @MyVar is declared as an integer (INT) data type in SQL Server. The SET statement is then used to assign the number 5 to @MyVar. Finally, the SELECT statement, used with the VALUE keyword, outputs the current value of @MyVar, which is 5. The VALUE keyword helps assign a column alias in the ‘SELECT’ statement output.
Example
Section titled “Example”SELECT VALUE(e)FROM (SELECT TO_NUMBER('10') AS e FROM dual);Output
Section titled “Output”10Explanation
Section titled “Explanation”The VALUE function accepts a single parameter, and simply returns that parameter. In this example, we use it to select a number converted from a string, ‘10’. The output from Oracle is plain text 10.