SQL ORA-01735: 无效的 ALTER TABLE 选项 - Toad

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/44513410/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-01 05:15:05  来源:igfitidea点击:

ORA-01735: invalid ALTER TABLE option - Toad

sqloracletoad

提问by deadend

When i execute below SQL in Toad its throws "ORA-01735: invalid ALTER TABLE option".

当我在 Toad 中执行下面的 SQL 时,它会抛出“ ORA-01735:无效的 ALTER TABLE 选项”。

ALTER TABLE CALCULATE
  ADD (CAL_METHOD VARCHAR2(50), REMARKS VARCHAR2(500));

But when execute in SQL Developer its running successful, Is there any issue with SQL / Toad. Please advice me.

但是当在 SQL Developer 中执行它运行成功时,SQL / Toad 是否有任何问题。请给我建议。

采纳答案by pritesh agrawal

In TOAD I suppose, you need to execute it as a script (press F5) rather that running it as a statement.

我想在 TOAD 中,您需要将它作为脚本执行(按F5),而不是将它作为语句运行。

回答by Menuka Ishan

Your SQL is correct but the problem is TOAD restrict Statements and Scripts for each button. I assume the cause of the error is you are trying to run ALTER TABLEcommand using Execute Statementor F9key. First of all, let's see what is different between Statementand Script

您的 SQL 是正确的,但问题是每个按钮的 TOAD 限制语句和脚本。我假设错误的原因是您尝试ALTER TABLE使用Execute StatementF9键运行命令。首先我们来看看StatementScript有什么不同

Execute Statementwill 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 Scriptwill 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.

Execute Statement将在可排序的表格中为您提供所有结果的列表。它也只会运行光标下(或突出显示)的语句。运行语句时,系统会提示您输入绑定变量(任何占位符:在它前面)。

例如

select * from customers where customer_id = :id

将提示输入 id 的值

Execute Script将执行工作表中的所有语句,并给出结果的文本读数。它不会提示您输入绑定变量的值。

https://stackoverflow.com/a/479443/2940265

https://stackoverflow.com/a/479443/2940265

As you can understand ALTER TABLE returns only a text output. So you have to use Execute as Scriptor F5

如您所知,ALTER TABLE 仅返回文本输出。所以你必须使用Execute as ScriptF5

Execute As Script Toad

作为脚本蟾蜍执行

回答by J?cob

I am using TOAD 11.0.6 and Oracle database version is 11gR2

我使用的是 TOAD 11.0.6,Oracle 数据库版本是 11gR2

See the below scripts which I am able to execute by F5 or by clicking the green arrow as shown in the enclosed screenshot

请参阅下面的脚本,我可以通过 F5 或单击所附屏幕截图中所示的绿色箭头来执行这些脚本

CREATE TABLE calculate (col NUMBER);

ALTER TABLE calculate
  ADD (cal_method VARCHAR2(50), remarks VARCHAR2(500));

SELECT * FROM calculate;

enter image description here

在此处输入图片说明

回答by Ersin Gülbahar

try this:

尝试这个:

ALTER TABLE CALCULATE
  ADD (CAL_METHOD VARCHAR2(50));

ALTER TABLE CALCULATE
  ADD (
 REMARKS VARCHAR2(500));

回答by Feng Zhang

I end up drop the column first then add back

我最终先删除列然后添加回来

ALTER TABLE  SITE_NUMBER DROP COLUMN CREATOR_ID;  
ALTER TABLE  SITE_NUMBER ADD (CREATOR_ID varchar2(12))