plsql - Oracle PL/SQL where condition: not equal to 0 or null -
i selecting id cannot equal 0, nor can value (null). wrote:
where id not null (+) , id not in ('0') i got 2 errors
error(9,5): pl/sql: sql statement ignored
error(38,119): pl/sql: ora-00933: sql command not ended change to:
where id not null (+) , id not ('0') same errors occurred. should write where clause?
you can simplify condition just:
where id != 0 because comparisions null (using both = or != operators) evaluates null (which treated in sql "false" in conditions),
therefore null != 0 evaluates false , can skip part in condition
whre id != 0 , id not null braiam's answer where nvl(id,0)<>0, although correct, prevent database using index on id column, , have bad impact on performce.
Comments
Post a Comment