sql走过的坑记录:业务需求,界面选着 ‘’是‘’ 则:字段的值=1来查, 选着否:则字段的值=0 或则 = null

走过肯的sql 

select * from table t where decode(?,'1',zd='1','0',nvl(zd,'0')=0)

在decode 函数中不能使用 zd = '1' 这样 的形式,不支持比较符号,= > < 等,只能 输出字段值使用。

修改后:

select * from table t where  ? = decode(zd,'1','1','0',nvl(zd,'0')) 

猜你喜欢

转载自blog.csdn.net/qq_29499107/article/details/83388358