Null if no assignment is given and no default value
Oracle allows fields of any one data type to be empty except for the following two cases: 1, primary key field (primary key), 2, field defined with a NOT NULL restriction condition
Description: 1, equivalent to no value, is unknown (unassigned, and there is no default value). 2, null and 0, empty string, space are different. 3, add, subtract, multiply and divide the null value, and the result is still empty. 4, NULL processing uses the NVL function. 5. Use the keyword "is null" and "is not NULL" when comparing. 6, the null value cannot be indexed , so the query when some eligible data may not be found, COUNT (*), with NVL (column name, 0) processing and then check. 7, the sorting is larger than other data (the index by default is descending, small → large), so the null value is always ranked at the end. Use the method:sql> select 1 from dual where null=null; no records sql> select 1 from dual where null= '; No records found sql> select 1 from Dual where ' = '; no record sql> select 1 from dual where null is null; 1--------- 1sql> Select 1 from dual where NVL (null,0) =NVL (null,0); 1--------- 1 The null value is added, minus, multiply, divide, and so on, the result is still empty. Sql> select 1+null from dual; Sql> select 1-null from dual; Sql> select 1*null from dual; Sql> select 1/null from dual; query to a record. Note: This record is the null in the SQL statement
Set some column null values for UPDATE table1 set 1=null where column 1 is not NULL;
an existing commodity sales table sale, the table structure is: Month char (6)--month Sellnumber (10,2)-Monthly Sales Amount CREATE TABLE sale (month char (6), sell number); insert into sale values (' 200001 ', +), insert into sale values (' 200002 ', 1100), insert into sale values (' 200003 ', "), insert into sale values (' 200004 ', 1300), insert into sale values (' 200005 ', 1400), insert into sale values (' 200006 ', "), insert into sale values (' 200007 ', "), insert into sale values (' 200101 ', 1100), insert into sale values (' 200202 ',"), insert into sale values (' 200301 ', 1300), insert into sale values (' 200008 ', +), insert into sale (month) VALUES (' 200009 '); (Note: The sell value of this record is null) commit; Enter 12 records in total
Sql> select * FROM sale where sell like '% '; MONTH SELL---------------200001 1000200002 1100200003 1200200004 1300200005 1400200006 1500200007 1600200101 1100200202 1200200301 1300200008 Search to 11 records. Result Description: The query results indicate that this SQL statement query does not have a column value of NULL for fields that need to be treated differently when the field is null. Sql> select * FROM sale where sell like '% ' or sell is null; Sql> select * FROM sale where NVL (sell,0) like '% '; MONTH SELL---------------200001 1000200002 1100200003 1200200004 1300200005 1400200006 1500200007 1600200101 1100200202 1200200301 1300200008 1000200009 query to 12 records.
Null in Oracle