当前位置: 代码迷 >> PB >> 问个简单的有关问题动态sql语句的参数
  详细解决方案

问个简单的有关问题动态sql语句的参数

热度:179   发布时间:2016-04-29 09:11:59.0
问个简单的问题动态sql语句的参数
LsSQL = "update lxscq set zhshh = :maxzhshh where bh =:bh"
execute immediate :LsSQL using sqlca;

这样写有问题吗?怎么存不了数据呢?

------解决方案--------------------
有问题
要么这样:
update lxscq set zhshh = :maxzhshh where bh =:bh;
要么这样:
LsSQL = "update lxscq set zhshh = " + string(maxzhshh) + " where bh = " + string(bh)
execute immediate :LsSQL using sqlca;
------解决方案--------------------
LsSQL = "update lxscq set zhshh = '" + string(maxzhshh) + "' where bh = " + string(bh)
execute immediate :LsSQL using sqlca;
  相关解决方案