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])
部件 [0] 到 部件 [3] 可能包含 NULL(类型化(值。
但甲骨文不接受这样的where子句:
其中 "col1" = 空
错
其中 "COL1" 为空
右
如何将"IS NULL"stmt 放在我的脚本查询中而不是"col = NULL"?
在 Oracle 中,null 不等于 null您可以在查询中使用
... and decode( col1, :a, 1, 0 )=1
或
... and (col1=:a or (col1 is null and :a is null))