在Oracle 12c中,我有一个名为" CONTAINERS"并且以下查询无法插入数据。
insert into CONTAINERS (ID,CONTAINER_NAME, HIERARCHY_SUB_TYPES_ID, HIERARCHY_TYPES_ID, SEGMENT_ID, SUB_SEGMENT_ID, USERS_ID_HIERARCHY_OWNER)
values (44,'ContainerName', 1, 1, 1, 1, 1);
错误:
命令行出错:1列:28错误报告 - SQL错误: ORA-02000:缺少)关键字 02000. 00000 - "缺少%s关键字"
但这成功了
insert into CONTAINERS values (3,'ContainerName', 1, 1, 1, 1, 1);
我不得不重命名表来自" CONTAINERS"到" CONTAINER"让一切正常工作。
有人可以解释我为什么会出现这种行为吗?
DDL:
CREATE TABLE "RELANDHIER"."CONTAINERS"
( "ID" NUMBER,
"CONTAINER_NAME" VARCHAR2(200 BYTE),
"USERS_ID_HIERARCHY_OWNER" NUMBER,
"SEGMENT_ID" NUMBER,
"SUB_SEGMENT_ID" NUMBER,
"HIERARCHY_TYPES_ID" NUMBER,
"HIERARCHY_SUB_TYPES_ID" NUMBER
)
答案 0 :(得分:3)
“CONTAINERS”似乎是一个“保留名称”。以下是我的测试用例:
drop table "DEMO"."CONTAINERS";
CREATE TABLE "DEMO"."CONTAINERS"
( "ID" NUMBER,
"CONTAINER_NAME" VARCHAR2(200 BYTE),
"USERS_ID_HIERARCHY_OWNER" NUMBER,
"SEGMENT_ID" NUMBER,
"SUB_SEGMENT_ID" NUMBER,
"HIERARCHY_TYPES_ID" NUMBER,
"HIERARCHY_SUB_TYPES_ID" NUMBER
);
insert into CONTAINERS (ID,CONTAINER_NAME, HIERARCHY_SUB_TYPES_ID, HIERARCHY_TYPES_ID, SEGMENT_ID, SUB_SEGMENT_ID, USERS_ID_HIERARCHY_OWNER)
values (44,'ContainerName', 1, 1, 1, 1, 1);
insert into "DEMO".CONTAINERS (ID,CONTAINER_NAME, HIERARCHY_SUB_TYPES_ID, HIERARCHY_TYPES_ID, SEGMENT_ID, SUB_SEGMENT_ID, USERS_ID_HIERARCHY_OWNER)
values (44,'ContainerName', 1, 1, 1, 1, 1);
INSERT仅在我为所有者架构添加前缀时才有效。
执行给出:
Table dropped.
Table created.
insert into CONTAINERS (ID,CONTAINER_NAME, HIERARCHY_SUB_TYPES_ID, HIERARCHY_TYPES_ID, SEGMENT_ID, SUB_SEGMENT_ID, USERS_ID_HIERARCHY_OWNER)
*
ERROR at line 1:
ORA-02000: missing ) keyword
1 row created.
点击此链接至Oracle 12c new features