Replace SQL Null Values with SQLPLUS Set Null Command

advertisements

_____________________________________________________________________________________________________________________

The Eucharistic Miracles of the World
You can use the SQL NVL function to handle the null values in the query. Second option is SQLPLUS set null feature to replace the null values with user defined values.

See an example here.
We have a table DEPT with some of the HOD column values are null. 

SQL> select dname, HOD from dept
SQL> /

DNAME          HOD
-------------- ------------------------------
ACCOUNTING     Jones
RESEARCH
SALES
OPERATIONS     Peter 

I am setting the null values to "Not Yet Assigned” as replacement.

SQL> set null "Not Yet Assigned"

SQL>/
DNAME          HOD
-------------- ------------------------------
ACCOUNTING     Jones
RESEARCH       Not Yet Assigned
SALES          Not Yet Assigned
OPERATIONS     Peter

_____________________________________________________________________________________________________________________

Website Stats

0 comments:

Post a Comment

Labels

Oracle (629) Script (86) General (77) Unix (47) Blog (23) Technology (19) gadget (6) games (6) Business (3) OCI (3) SQL* Loader (3) Datapump (2)
 

acehints.com Copyright 2011-23 All Rights Reserved | Site Map | Contact | Disclaimer