How to use NVL function in Oracle/Sql in English, Hindi and Urdu.
NVL Function in Oracle |
Rules:
- It always excepts two arguments.
- If expression 1's value is null then it always returns expression 2.
- If expression 1's value is not null then it always returns expression 2.
To know more about NVL Function please visit below links
(OR)
This is complete exercise of video tutorials
SQL> select nvl() from dual;
select nvl() from dual
*
ERROR at line 1:
ORA-00909: invalid number of arguments
SQL> select nvl(12) from dual;
select nvl(12) from dual
*
ERROR at line 1:
ORA-00909: invalid number of arguments
SQL> select nvl(,12) from dual;
select nvl(,12) from dual
*
ERROR at line 1:
ORA-00936: missing expression
SQL> select nvl(12,) from dual;
select nvl(12,) from dual
*
ERROR at line 1:
ORA-00936: missing expression
SQL> select nvl(100,200) from dual;
NVL(100,200)
------------
100
SQL> select nvl(null,200) from dual;
NVL(NULL,200)
-------------
200
SQL> select nvl(100,null) from dual;
NVL(100,NULL)
-------------
100
SQL> select nvl(null,null) from dual;
N
-
SQL> select nvl(null,100,200) from dual;
select nvl(null,100,200) from dual
*
ERROR at line 1:
ORA-00909: invalid number of arguments
SQL> select nvl(100,'Hello') from dual;
select nvl(100,'Hello') from dual
*
ERROR at line 1:
ORA-01722: invalid number
SQL> select nvl(100,'200') from dual;
NVL(100,'200')
--------------
100
SQL> select nvl('Hello','Cello') from dual;
NVL('
-----
Hello
SQL> select nvl(null,'Cello') from dual;
NVL(N
-----
Cello
SQL> select nvl('Hello','200') from dual;
NVL('
-----
Hello
Thanks
No comments:
Post a Comment
Thanks for comment, visiting Blog and give us your valuable time.