我有 2 个查询,它们动态获取数据。
Select cid from table1 where cNumber={{custNbr}}
这里 {{custNbr}} 来自一个 .txt 文件。
update table2 set status='A' where customer_id=NVL({{cid}},0000)
这里 {{customer_id}} 来自步骤 1 的输出。
问题:当第 1 步返回 NULL 时,它实际上返回一个空字符串''
。因此,第 2 步转化为 -
update table2 set status='A' where customer_id=NVL(,0000)
这会引发错误 java.sql.SQLSyntaxErrorException: ORA-00936: missing expression
如何重写查询以使其工作。