Oracle Sql NVL and NVL2 function - What is the Difference? [SQL tutorial]

Veröffentlicht am: 12 August 2023
auf dem Kanal: ERP Scope
286
2

NVL and NVL function are a powerful functions in Oracle Sql,
you can use it to convert null values to whatever the values you need.
it will help you make calculations on Oracle database with more accurate results.

NVL Syntax:
===========
NVL (expr1, expr2)
You can use the NVL function to convert any data type, but the return value is always the same as the data type of expr1.

NVL2 Syntax:
===========
NVL2 (expr1, expr2, expr3)
The NVL2 function examines the first expression. If the first expression is not null, then the NVL2 function returns the second expression. If the first expression is null, then the third expression is returned.

NVL function example:
SELECT last_name, salary, NVL(commission_pct, 0),
(salary*12) + (salary*12*NVL(commission_pct, 0)) AN_SAL
FROM employees;

NVL2 function example:
SELECT last_name, salary, commission_pct,
NVL2(commission_pct,
'SAL+COMM', 'SAL') income
FROM employees WHERE department_id IN (50, 80);

Chapters:
0:00 Intro
0:25 NVL function Syntax.
1:08 NVL function example.
3:33 NVL2 function Syntax.
4:07 NVL2 function example.
6:30 How to install the same database on your machine.

✅ To install the same database in examples, please check this video:
   • How to install Oracle Sample Database sche...  

✅ How to become oracle expert atrical:
https://erpscope.com/how-to-become-or...

✅ linkedin :   / posts  

✅Facebook:   / erpscope  

✅ Twitter:   / erp_scope  

✅Instagram:   / erp_scope  

✅ Youtube:    / @erpscope  


Auf dieser Seite können Sie das Online-Video Oracle Sql NVL and NVL2 function - What is the Difference? [SQL tutorial] mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer ERP Scope 12 August 2023 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 286 Mal angesehen und es wurde von 2 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!