首页 > 解决方案 > sqldeveloper 将整数插入导出为字符串

问题描述

这似乎是版本 19.4 中的一个错误,在 20+ 中已修复我在 sqldeveloper 中导出了我的表的内容,并且插入 sql 语句都将数字作为字符串。例子:

Insert into testtable(id,stuff) values ('1','Hello')

ID 1 在导出中变为“1”,我无法读取它。每个表都是这种情况。有没有办法避免这两个 ' ?

DDL 是:

create table TESTTABLE(
   ID INTEGER               not null
);

在 sqldeveloepr 中执行它之后:

create table testtable{
"ID" Number(*,0) NOT NULL ENABLE
}

我注意到如果约束不活跃,我可以添加这样的一行。似乎 sqldeveloper 在内部将字符串转换为数字。

标签: oracle-sqldeveloper

解决方案


create table testtable(
"ID" Number(*,0) NOT NULL ENABLE
);

insert into testtable values (1);

commit;

select /*insert*/ * from testtable;

运行这个,我得到

Table TESTTABLE created.


1 row inserted.


Commit complete.

REM INSERTING into TESTTABLE
SET DEFINE OFF;
Insert into TESTTABLE (ID) values (1);

数值/字段上没有引号。我使用 20.2 版的 SQL Developer 做到了这一点。


推荐阅读