for circuit in allCircuit: # a cvs of 4 columns
part = circuit.split(",")
res = cur.execute("""SELECT col4 from ATable WHERE
( "col1" = :a
AND "col2" = :b
AND "col3" = :c
AND "col4" = :d)
ORDER BY col4""",a = part[0], b= part[1], c = part[2], d = part[3])
part [0]到part [3]可能包含NULL(类型)值。
但Oracle不接受where子句,如:
WHERE“col1”= NULL
WHERE“col1”IS NULL
如何在我的脚本查询中添加“IS NULL”stmt而不是“col = NULL”?
答案 0 :(得分:3)
在Oracle中 null不等于null 您可以在查询中使用
... and decode( col1, :a, 1, 0 )=1
或
... and (col1=:a or (col1 is null and :a is null))