Oracle 错误:ORA-00905:缺少关键字
对 oracle 中的数据库执行 SQL
SELECT *
INTO assignment_20081120
FROM assignment ;
行来备份名为分配的表会出现以下 ORACLE 错误: ORA-00905: 缺少关键字
Excuting the line of SQL:
SELECT *
INTO assignment_20081120
FROM assignment ;
against a database in oracle to back up a table called assignment gives me the following ORACLE error:
ORA-00905: Missing keyword
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
除非
ASSIGNMENT
表中只有一行,并且ASSIGNMENT_20081120
是ASSIGNMENT%ROWTYPE
类型的本地 PL/SQL 变量,否则这不是什么你要。假设您正在尝试创建一个新表并将现有数据复制到该新表
Unless there is a single row in the
ASSIGNMENT
table andASSIGNMENT_20081120
is a local PL/SQL variable of typeASSIGNMENT%ROWTYPE
, this is not what you want.Assuming you are trying to create a new table and copy the existing data to that new table
首先,我想:
但是手动生成表后还是不行,仍然显示“缺少关键字”的错误。
所以我这次放弃了,通过先手动创建表,然后使用“经典”< code>SELECT 语句:
如果有人能解释如何以正确的方式使用
SELECT...INTO
,我会很高兴!First, I thought:
But after manually generating a table, it still did not work, still showing the "missing keyword" error.
So I gave up this time and solved it by first manually creating the table, then using the "classic"
SELECT
statement:Which worked as expected. If anyone come up with an explanaition on how to use the
SELECT...INTO
in a correct way, I would be happy!您可以在 PLSQL 块内部使用 select into,如下所示。
此代码仅在分配中恰好有 1 行时才有效。 通常,您将使用此类代码来选择由键号标识的特定行。
You can use select into inside of a PLSQL block such as below.
This code will only work when there is exactly 1 row in assignment. Usually you will use this kind of code to select a specific row identified by a key number.
虽然这与OP的确切问题没有直接关系,但我刚刚发现在查询中使用Oracle保留字(在我的例子中是别名
IN
)可能会导致相同的错误。示例:
或者如果它在查询本身中作为字段名称
,也会引发该错误。 我希望这可以帮助别人。
Though this is not directly related to the OP's exact question but I just found out that using a Oracle reserved word in your query (in my case the alias
IN
) can cause the same error.Example:
Or if its in the query itself as a field name
That would also throw that error. I hope this helps someone.
如果您备份 Oracle 数据库中的表。 你试试下面的说法。
我正在使用 Oracle 数据库 12c。
If you backup a table in Oracle Database. You try the statement below.
I am using Oracle Database 12c.
迟到的回答,但我今天才出现在这个名单上!
做同样的事。
Late answer, but I just came on this list today!
Does the same.