Oracle is not equal to the number. oracle is equal to the number.
In Oracle, non-equal signs can be used in the following ways:
<> ,! =, ^ =
Test SQL
create table test( id int, name varchar2(10), age int)insert into test(id,name,age) values(1,'zhangsan',23);insert into test(id,name,age) values(2,'lisi','');insert into test(id,name,age) values(3,'wangwu',null);insert into test(id,name,age) values(4,'sunqi',27);insert into test(id,name,age) values(5,'',22);
Both the field NAME and AGE have null values.
Example 1: query data whose AGE is not 23
select * from test where age <> 23;
Example 2: query data whose NAME is not lisi
select * from test where name != 'lisi';
The above two examples strictly do not meet our requirements because null values are not queried.
Null can only be determined by is null or is not null. Other operators and null operations are both false.
The correct SQL statement is:
Select * from test where instr (concat (name, 'xx'), 'lisi') = 0; -- query records whose name field is not equal to 'lisi' or select * from test where nvl (name, 'xx') <> 'lisi ';
Select * from test where instr (concat (age, 00), 23) = 0; -- query records whose age field is not 23 or select * from test where nvl (age, 00) <> 23;
Author: itmyhome