Caught exception is null itself !

For anyone ending up here, I’ve found an instance where this is possible (If only detectable in the debugger). VS2013 Update 4. Broken: try { // do something } catch (WebException ex) // <- both variables are named ‘ex’ { Logger.Log(“Error while tried to do something. Error: ” + ex.Message); } catch (Exception ex) // … Read more

NULL or BLANK fields (ORACLE)

COUNT(expresion) returns the count of of rows where expresion is not null. So SELECT COUNT (COL_NAME) FROM TABLE WHERE COL_NAME IS NULL will return 0, because you are only counting col_name where col_name is null, and a count of nothing but nulls is zero. COUNT(*) will return the number of rows of the query: SELECT … Read more

Composite PRIMARY KEY enforces NOT NULL constraints on involved columns

If you need to allow NULL values, use a UNIQUE constraint (or index) instead of a PRIMARY KEY (and add a surrogate PK column – I suggest a serial or IDENTITY column in Postgres 10 or later). Auto increment table column A UNIQUE constraint allows columns to be NULL: CREATE TABLE distributor ( distributor_id GENERATED … Read more

How to do NULLS LAST in SQLite?

could this work? SELECT ……. ORDER BY COALESCE(col1,col2,col3,etc) IS NULL I am kind of confused by your wording “all NULL columns last”. If you want all NULL values last in a particular column, use this: SELECT ……. ORDER BY col1 IS NULL

Which is more effective: if (null == variable) or if (variable == null)? [duplicate]

(Similar to this question: Difference between null==object and object==null) I would say that there is absolutely no difference in performance between those two expressions. Interestingly enough however, the compiled bytecode (as emitted by OpenJDKs javac) looks a bit different for the two cases. For boolean b = variable == null: 3: aload_1 // load variable … Read more