In orther language(C#, Sql Server) i see: 1 + null, or '1' + null is null, But in Oracle result is: 1 || null = 1 but '1' + null = null. example:
select 1 || null from dual ;
select '1' + null from dual;
Result: 1, null
Who can tell me why?
In orther language(C#, Sql Server) i see: 1 + null, or '1' + null is null, But in Oracle result is: 1 || null = 1 but '1' + null = null. example:
select 1 || null from dual ;
select '1' + null from dual;
Result: 1, null
Who can tell me why?
Oracle treats NULL
and the empty string as the same thing.
So 1 || NULL
is the same as 1 || ""
(which is '1'
-- this is string concatenation in SQL, not a logical OR).
For +
both arguments are converted to numbers, and any arithmetic operation involving NULL
yields NULL
.