How To Test NULL Values?
Submitted by: AdministratorThere ate two special comparison operators you can use on NULL values:
► "variable IS NULL" - Returns TRUE if the variable value is NULL.
► "variable IS NOT NULL" - Return TRUE if the variable value is not NULL.
The following sample script shows you examples of comparing NULL values:
DECLARE
next_task CHAR(80);
BEGIN
next_task := NULL;
IF next_task IS NOT NULL THEN
DBMS_OUTPUT.PUT_LINE('I am busy.');
ELSE
DBMS_OUTPUT.PUT_LINE('I am free.');
END IF;
IF next_task IS NULL THEN
NULL;
ELSE
DBMS_OUTPUT.PUT_LINE('... working on ' || next_task);
END IF;
END;
Note that "variable = NULL" is not a valid operation. This script should print this:
I am free.
Submitted by: Administrator
► "variable IS NULL" - Returns TRUE if the variable value is NULL.
► "variable IS NOT NULL" - Return TRUE if the variable value is not NULL.
The following sample script shows you examples of comparing NULL values:
DECLARE
next_task CHAR(80);
BEGIN
next_task := NULL;
IF next_task IS NOT NULL THEN
DBMS_OUTPUT.PUT_LINE('I am busy.');
ELSE
DBMS_OUTPUT.PUT_LINE('I am free.');
END IF;
IF next_task IS NULL THEN
NULL;
ELSE
DBMS_OUTPUT.PUT_LINE('... working on ' || next_task);
END IF;
END;
Note that "variable = NULL" is not a valid operation. This script should print this:
I am free.
Submitted by: Administrator
Read Online Oracle Database Job Interview Questions And Answers
Top Oracle Database Questions
☺ | How Much Memory Your 10g XE Server Is Using? |
☺ | What Happens to Indexes If You Drop a Table? |
☺ | How To Create a Stored Procedure in Oracle? |
☺ | How To Use Values from Other Tables in UPDATE Statements using Oracle? |
☺ | How To Check Your Oracle Database 10g XE Installation? |
Top DB Oracle Categories
☺ | Oracle PL-SQL Interview Questions. |
☺ | Oracle DBA Interview Questions. |
☺ | Oracle D2K Interview Questions. |
☺ | OCI Interview Questions. |
☺ | Oracle RMAN Interview Questions. |