多个插入语句失败 ORA-00905: 缺少关键字错误
我正在使用下面的 SQL 脚本将一些记录插入到我使用 create 语句创建的新表中。但我收到以下错误
ORA-00905: 缺少关键字
下面是非常简单的脚本。我想我错过了一些东西。仅供参考,我在最后使用 ;
和不使用 ;
进行了测试,但它产生了相同的结果。
知道我在这里缺少什么吗?
create table winlossbydate1 (
statusdate Date,
Status Char(5));
Insert into WinLossByDate (StatusDate, Status)
Values (TO_DATE('2011-03-01','yyyy-mm-dd'), 'win');
Insert into WinLossByDate (StatusDate, Status)
Values (TO_DATE('2011-03-01','yyyy-mm-dd'), 'lose');
Insert into WinLossByDate (StatusDate, Status)
Values (TO_DATE('2011-03-01','yyyy-mm-dd'), 'lose');
Insert into WinLossByDate (StatusDate, Status)
Values (TO_DATE('2011-03-01','yyyy-mm-dd'), 'lose');
Insert into WinLossByDate (StatusDate, Status)
Values (TO_DATE('2011-03-01','yyyy-mm-dd'), 'win');
Insert into WinLossByDate (StatusDate, Status)
Values (TO_DATE('2011-03-02','yyyy-mm-dd'), 'lose');
Insert into WinLossByDate (StatusDate, Status)
Values (TO_DATE('2011-03-02','yyyy-mm-dd'), 'win');
Insert into WinLossByDate (StatusDate, Status)
Values (TO_DATE('2011-03-02','yyyy-mm-dd'), 'win');
Insert into WinLossByDate (StatusDate, Status)
Values (TO_DATE('2011-03-02','yyyy-mm-dd'), 'win')
I am using the below SQL script to insert few records into a new table that I created using create statement. But I am getting the following error
ORA-00905: missing keyword
Below is the script which is quite straightforward. I guess I am missing something. FYI, I have tested with both ;
at the end and without ;
but it yields the same result.
Any idea what I am missing here?
create table winlossbydate1 (
statusdate Date,
Status Char(5));
Insert into WinLossByDate (StatusDate, Status)
Values (TO_DATE('2011-03-01','yyyy-mm-dd'), 'win');
Insert into WinLossByDate (StatusDate, Status)
Values (TO_DATE('2011-03-01','yyyy-mm-dd'), 'lose');
Insert into WinLossByDate (StatusDate, Status)
Values (TO_DATE('2011-03-01','yyyy-mm-dd'), 'lose');
Insert into WinLossByDate (StatusDate, Status)
Values (TO_DATE('2011-03-01','yyyy-mm-dd'), 'lose');
Insert into WinLossByDate (StatusDate, Status)
Values (TO_DATE('2011-03-01','yyyy-mm-dd'), 'win');
Insert into WinLossByDate (StatusDate, Status)
Values (TO_DATE('2011-03-02','yyyy-mm-dd'), 'lose');
Insert into WinLossByDate (StatusDate, Status)
Values (TO_DATE('2011-03-02','yyyy-mm-dd'), 'win');
Insert into WinLossByDate (StatusDate, Status)
Values (TO_DATE('2011-03-02','yyyy-mm-dd'), 'win');
Insert into WinLossByDate (StatusDate, Status)
Values (TO_DATE('2011-03-02','yyyy-mm-dd'), 'win')
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果使用 Oracle 10g XE 的 SQL 命令工具,您指的是 XE 附带的基于浏览器的 HTML UI,那么这就是您的问题。
XE浏览器前端根本不支持运行多个SQL语句。
您可以考虑使用 SQL Developer 或任何其他“真正的”GUI 工具。
If with SQL command tool of Oracle 10g XE you mean the browser based HTML UI that comes with XE, then that's your problem.
The XE browser frontend simply does not support running multiple SQL statements.
You might consider using SQL Developer or any other "real" GUI tool instead.