为什么此 CREATE TABLE 语句会导致“ORA-00922 缺少或无效选项”?
我已使用 SQL Developer(工具 -> 卸载数据库)从一个 Oracle 数据库导出了一个架构。它创建了与此类似的“创建表”语句:
CREATE TABLE "APP_USER"
( "ID" NUMBER(*,0),
"USERNAME" VARCHAR2(200),
"PASSWORD" NVARCHAR2(200),
"TYPE" VARCHAR2(20),
"FIRST_NAME" VARCHAR2(100),
"LAST_NAME" VARCHAR2(100)
) SEGMENT CREATION IMMEDIATE
PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
TABLESPACE "LIS_DATA" ;
但是当我尝试在另一个数据库(同样来自 SQL Developer)上执行代码时,它会触发“ORA-00922 丢失或无效选项”。
显然查询的存储部分有问题(以“SEGMENT”开头并以“DEFAULT”结尾)”,因为如果我删除它它就可以工作。但它到底是什么?
我只是一名恰好需要与 Oracle 合作的应用程序开发人员。我对 SQL 没问题,但是 Oracle 存储参数的东西对我来说是中文的。另外,我对 SQL Developer 生成无效代码感到困惑......
I have exported a schema from one Oracle database using SQL Developer (tools -> unload database). It has created "create table" statements similar to this one :
CREATE TABLE "APP_USER"
( "ID" NUMBER(*,0),
"USERNAME" VARCHAR2(200),
"PASSWORD" NVARCHAR2(200),
"TYPE" VARCHAR2(20),
"FIRST_NAME" VARCHAR2(100),
"LAST_NAME" VARCHAR2(100)
) SEGMENT CREATION IMMEDIATE
PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
TABLESPACE "LIS_DATA" ;
But when I try to execute the code on another database, also from SQL Developer, it fires an "ORA-00922 missing or invalid option".
Apparently there is something wrong with the storage section of the query (starting with "SEGMENT" and ending with "DEFAULT)" because if I remove it it works. But what is it exactly ?
I am just an application developer who happens to have to work with Oracle. I'm ok with SQL but this Oracle storage parameters stuff is Chinese to me. Plus I am puzzled that SQL Developer generates invalid code...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我不熟悉“立即创建段”。好像是11G的功能。也许您正在尝试在旧版本数据库上使用 11G 功能创建表。
I'm not familiar with "segment creation immediate". It seems to be a 11G feature. Maybe you are trying to create a table using 11G features on an older version database.
来自此处:
From HERE: