09-02-24 Single Row Function, Null, NVL Function
09-02-24 Single Row Function, Null, NVL Function
NULL VALUES:-
If a row(record) absence of a data is known as null.
Null is a unknown or undefined value.
No operations are allowed to null values.
Null is not equal to zero (null^=0)
Each null value are not same.
When we apply condition on null then it should compare with ‘IS’ keyword.
SELECT * FROM EMP WHERE MGR = NULL; { it will not display the result but only display the
structure of table because = is not used In the NULL value }
SELECT * FROM EMP WHERE MGR IS NULL; { it will display the output because we are using IS in the
NULL value }
COMMIT;
SELECT * FROM STUDENT_DDL;
( "ROLLNO" NUMBER,
);
( "ROLLNO" NUMBER,
);
===========================================================================
FUNCTION:-
Function is a database object which is used to return(give) some values.
It is two type
Ex:-
DESC EMP;
COLUMN OR EXPRESSION :-
SELECT NVL(NULL,100) FROM DUAL; { This query replaces a NULL value with 100. Since the first
parameter is NULL, it returns the second parameter, which is 100.
SELECT NVL (0, 100) FROM DUAL; {This query replaces 0 (which is not NULL) with 100. Since the first
parameter is not NULL (it's 0), the function returns the first parameter.}