Conversion Functions Implicit datatype Implicit datatype conversion conversion Explicit datatype Explicit datatype conversion conversion Datatype Datatype conversion conversion In some cases, Oracle Server allows data of one datatype where it expects data of a different datatype. This is allowed when Oracle Server can automatically convert the data to the expected datatype. This datatype conversion can be done implicitly by Oracle Server or explicitly by the user.
21
Embed
Conversion Functions Implicit datatype conversion Explicit datatype conversion Datatypeconversion In some cases, Oracle Server allows data of one datatype.
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
In some cases, Oracle Server allows data of one datatype where it expects data of a different datatype. This is allowed when Oracle Server can automatically convert the data to the expected datatype. This datatype conversion can be done implicitly by Oracle Server or explicitly by the user.
ENAME HIREDATE---------- -----------------KING 17 November 1981BLAKE 1 May 1981CLARK 9 June 1981JONES 2 April 1981MARTIN 28 September 1981ALLEN 20 February 1981...14 rows selected.
NVL FunctionNVL Function
Converts null to an actual valueDatatypes that can be used are date,
In the SQL statement above, the value of JOB is decoded. If JOB is ANALYST, the salary increase is 10%; if JOB is CLERK, the salary increase is 15%; if JOB is MANAGER, the salary increase is 20%. For all other job roles, there is no increase in salary.
The same statement can be written as an IF-THEN-ELSE statement:IF job = 'ANALYST' THEN sal = sal*1.1
IF job = 'CLERK' THEN sal = sal*1.15
IF job = 'MANAGER' THEN sal = sal*1.20
ELSE sal = sal
Using the DECODE FunctionUsing the DECODE Function