ORA-01735: 无效的 ALTER TABLE 选项 - Toad
ORA-01735: invalid ALTER TABLE option - Toad
当我在 Toad 中执行以下 SQL 时,它会抛出“ORA-01735:无效的 ALTER TABLE 选项 ”。
ALTER TABLE CALCULATE
ADD (CAL_METHOD VARCHAR2(50), REMARKS VARCHAR2(500));
但是当在 SQL Developer 中执行时 运行 成功,SQL / Toad 是否有任何问题。请多多指教
试试这个:
ALTER TABLE CALCULATE
ADD (CAL_METHOD VARCHAR2(50));
ALTER TABLE CALCULATE
ADD (
REMARKS VARCHAR2(500));
我想在 TOAD 中,您需要将其作为脚本执行(按 F5)而不是 运行 作为语句执行。
我使用的是 TOAD 11.0.6,Oracle 数据库版本是 11gR2
查看下面的脚本,我可以通过 F5 或单击随附屏幕截图中显示的绿色箭头来执行这些脚本
CREATE TABLE calculate (col NUMBER);
ALTER TABLE calculate
ADD (cal_method VARCHAR2(50), remarks VARCHAR2(500));
SELECT * FROM calculate;
您的 SQL 是正确的,但问题是 TOAD 限制每个按钮的语句和脚本。我假设错误的原因是您正在尝试使用 Execute Statement
或 F9
键来执行 运行 ALTER TABLE
命令。首先,让我们看看Statement和Script
有什么不同
Execute Statement will give you a list of all the results in a
sortable table. It will also only run the statement under the cursor
(or highlighted). You will be prompted for bind variables when you run
the statement (any placeholder: in front of it).
E.g.
select * from customers where customer_id = :id
will prompt for a value for id
Execute Script will execute all statements in the worksheet,
and give a text readout of the results. It will not prompt you for the
values of bind variables.
正如你所理解的,ALTER TABLE returns 只是一个文本输出。所以你必须使用 Execute as Script
或 F5
我最终先删除了该列,然后再添加回来
ALTER TABLE SITE_NUMBER DROP COLUMN CREATOR_ID;
ALTER TABLE SITE_NUMBER ADD (CREATOR_ID varchar2(12))
当我在 Toad 中执行以下 SQL 时,它会抛出“ORA-01735:无效的 ALTER TABLE 选项 ”。
ALTER TABLE CALCULATE
ADD (CAL_METHOD VARCHAR2(50), REMARKS VARCHAR2(500));
但是当在 SQL Developer 中执行时 运行 成功,SQL / Toad 是否有任何问题。请多多指教
试试这个:
ALTER TABLE CALCULATE
ADD (CAL_METHOD VARCHAR2(50));
ALTER TABLE CALCULATE
ADD (
REMARKS VARCHAR2(500));
我想在 TOAD 中,您需要将其作为脚本执行(按 F5)而不是 运行 作为语句执行。
我使用的是 TOAD 11.0.6,Oracle 数据库版本是 11gR2
查看下面的脚本,我可以通过 F5 或单击随附屏幕截图中显示的绿色箭头来执行这些脚本
CREATE TABLE calculate (col NUMBER);
ALTER TABLE calculate
ADD (cal_method VARCHAR2(50), remarks VARCHAR2(500));
SELECT * FROM calculate;
您的 SQL 是正确的,但问题是 TOAD 限制每个按钮的语句和脚本。我假设错误的原因是您正在尝试使用 Execute Statement
或 F9
键来执行 运行 ALTER TABLE
命令。首先,让我们看看Statement和Script
Execute Statement will give you a list of all the results in a sortable table. It will also only run the statement under the cursor (or highlighted). You will be prompted for bind variables when you run the statement (any placeholder: in front of it).
E.g.
select * from customers where customer_id = :id
will prompt for a value for id
Execute Script will execute all statements in the worksheet, and give a text readout of the results. It will not prompt you for the values of bind variables.
正如你所理解的,ALTER TABLE returns 只是一个文本输出。所以你必须使用 Execute as Script
或 F5
我最终先删除了该列,然后再添加回来
ALTER TABLE SITE_NUMBER DROP COLUMN CREATOR_ID;
ALTER TABLE SITE_NUMBER ADD (CREATOR_ID varchar2(12))