【发布时间】:2017-07-09 13:51:16
【问题描述】:
我正在尝试使用 SQL Developer 绑定变量提示来加速查询执行,但我没有得到所需的输出:看起来我输入的值已转换为数字。
表格说明:
Nome Null Type
------------------ -------- ------------
NUM NOT NULL VARCHAR2(13)
IS_OK NUMBER(1)
初始情况:
select NUM, IS_OK from numbers_table where NUM = cast(:dn as varchar2(13));
NUM |IS_OK |
------------|------|
08331930078 |1 |
工作更新:
1.
update numbers_table set IS_OK = 0 where NUM = 08331930078;
update numbers_table set IS_OK = 0 where NUM = '08331930078';
输出:
'1 row updated'
无效更新:
1.
update numbers_table set IS_OK = 0 where NUM = :dn;
update numbers_table set IS_OK = 0 where NUM = cast(:dn as varchar2(13));
输出:
'0 rows updated'
不知道我还能做些什么来强制将值解析为字符串。
SQL Developer 版本 4.1.3.20
【问题讨论】:
-
什么都不需要,你的查询应该是:update numbers_table set IS_OK = 0 where NUM = :dn;
-
事实证明它不是那样工作的(这是我最初的假设)
标签: sql oracle oracle10g oracle-sqldeveloper