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

Popular posts from this blog

how to insert data php javascript mysql with multiple array session 2 -

multithreading - Exception in Application constructor -

windows - CertCreateCertificateContext returns CRYPT_E_ASN1_BADTAG / 8009310b -