Drop Table 命令在 Oracle SQL 开发人员中不起作用,它不会在使用时删除现有的 table?
Drop Table command is not working in Oracle SQL developer, it is not dropping the existing table upon using?
drop Table countries;
drop Table regionss;
create TABLE regionss(
region_id NUMBER(3),
region_Name VARCHAR2(25),
CONSTRAINT regions_pk PRIMARY KEY(region_id)
);
create TABLE countriess(
country_id CHAR(2),
country_Name VARCHAR2(40),
region_id NUMBER(3),
CONSTRAINT countries_pk PRIMARY KEY(country_id),
CONSTRAINT regions_countries_fk FOREIGN KEY (region_id) REFERENCES regionss (region_id)
);
我遇到了这些错误
Error starting at line : 4 in command -
create TABLE regionss(
region_id NUMBER(3),
region_Name VARCHAR2(25),
CONSTRAINT regions_pk PRIMARY KEY(region_id)
)
Error report -
ORA-00955: name is already used by an existing object
00955. 00000 - "name is already used by an existing object"
*Cause:
*Action:
Error starting at line : 10 in command -
create TABLE countriess(
country_id CHAR(2),
country_Name VARCHAR2(40),
region_id NUMBER(3),
CONSTRAINT countries_pk PRIMARY KEY(country_id)
)
Error report -
ORA-00955: name is already used by an existing object
00955. 00000 - "name is already used by an existing object"
*Cause:
*Action:
Drop Command 的功能不是删除现有的 table 给它的吗?除非我更改我的 table 的名称,否则它不会工作,但是在更改名称后,当我第二次尝试 运行 代码时,它再次给我上面提到的错误。
这是因为您正在删除 table countries
并创建 table countriess
。这会导致错误链:
- 你不能删除不存在的 table (
countries
)
regionss
存在,但它有外键(来自 coutriess
)阻止它被删除。
SQL> drop Table countries;
drop Table countries
*
ERROR at line 1:
ORA-00942: table or view does not exist
SQL> drop Table regionss;
drop Table regionss
*
ERROR at line 1:
ORA-02449: unique/primary keys in table referenced by foreign keys
drop Table countries;
drop Table regionss;
create TABLE regionss(
region_id NUMBER(3),
region_Name VARCHAR2(25),
CONSTRAINT regions_pk PRIMARY KEY(region_id)
);
create TABLE countriess(
country_id CHAR(2),
country_Name VARCHAR2(40),
region_id NUMBER(3),
CONSTRAINT countries_pk PRIMARY KEY(country_id),
CONSTRAINT regions_countries_fk FOREIGN KEY (region_id) REFERENCES regionss (region_id)
);
我遇到了这些错误
Error starting at line : 4 in command -
create TABLE regionss(
region_id NUMBER(3),
region_Name VARCHAR2(25),
CONSTRAINT regions_pk PRIMARY KEY(region_id)
)
Error report -
ORA-00955: name is already used by an existing object
00955. 00000 - "name is already used by an existing object"
*Cause:
*Action:
Error starting at line : 10 in command -
create TABLE countriess(
country_id CHAR(2),
country_Name VARCHAR2(40),
region_id NUMBER(3),
CONSTRAINT countries_pk PRIMARY KEY(country_id)
)
Error report -
ORA-00955: name is already used by an existing object
00955. 00000 - "name is already used by an existing object"
*Cause:
*Action:
Drop Command 的功能不是删除现有的 table 给它的吗?除非我更改我的 table 的名称,否则它不会工作,但是在更改名称后,当我第二次尝试 运行 代码时,它再次给我上面提到的错误。
这是因为您正在删除 table countries
并创建 table countriess
。这会导致错误链:
- 你不能删除不存在的 table (
countries
) regionss
存在,但它有外键(来自coutriess
)阻止它被删除。
SQL> drop Table countries;
drop Table countries
*
ERROR at line 1:
ORA-00942: table or view does not exist
SQL> drop Table regionss;
drop Table regionss
*
ERROR at line 1:
ORA-02449: unique/primary keys in table referenced by foreign keys