1

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')
Ollie
  • 17,058
  • 7
  • 48
  • 59
somnathchakrabarti
  • 3,026
  • 10
  • 69
  • 92
  • What tool are you using to execute this script? My guess is that the tool expects a '/' after the `CREATE TABLE` statement. – Justin Cave Feb 21 '12 at 21:46
  • I am using the SQL command tool of Oracle 10g XE. For single inserts, it has been working fine as I said in my previous posted question but when there are multiple inserts, it is failing and giving the error. – somnathchakrabarti Feb 21 '12 at 21:50
  • Works for me in SQL Developer. – doelleri Feb 21 '12 at 21:51
  • Sorry, the table name I mistyped as winlossbydate1. Please ignore that mistake as I have created the table winlossbydate in my database. That is a typo! – somnathchakrabarti Feb 21 '12 at 21:52
  • @Justin, I am selecting the insert statements and running the script, so I guess the previous Create statement should not be of importance in this case. I mean I have been running only the insert part. Sorry, forgot to mention that. – somnathchakrabarti Feb 21 '12 at 21:58
  • Works OK for me. I'm using the "Run SQL Command Line" for my Oracle 10g Express Edition database, pasting your code (without the "1" in the table name as per your note). After the CREATE TABLE, I get a message "Table created" then after each INSERT statement I get "1 row created". Perhaps you could copy and paste your full output? – Paul Walker Feb 21 '12 at 22:09

1 Answers1

4

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.