3 Replies - 21276 Views - Last Post: 23 February 2011 - 11:23 PM

#1 lilyd30047  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 23-February 11

SQL- "missing SELECT keyword" error

Posted 23 February 2011 - 11:06 PM

I'm having issues inserting rows into a table. The table is already on the server, but here's the code for that:
CREATE TABLE ORDER_SOURCE(
OS_ID NUMBER(10) PRIMARY KEY,
OS_DESC VARCHAR2(50));


I'm trying to insert rows into the table, but I keep getting this error: Error starting at line 1 in command:
INSERT INTO ORDER_SOURCE(1,'WINTER 2005')
Error at Command Line:1 Column:25
Error report:
SQL Error: ORA-00928: missing SELECT keyword
00928. 00000 - "missing SELECT keyword"
*Cause:
*Action:

Here's the code I'm using to insert into the table:
INSERT INTO ORDER_SOURCE(1,'WINTER 2005');
INSERT INTO ORDER_SOURCE(2,'SPRING 2006');
INSERT INTO ORDER_SOURCE(3,'SUMMER 2006');
INSERT INTO ORDER_SOURCE(4,'OUTDOOR 2006');
INSERT INTO ORDER_SOURCE(5,'CHILDRENS 2006');
INSERT INTO ORDER_SOURCE(6,'WEB SITE');


I've tried adding rows one at a time, instead of all at once, and I still get the error.

I would appreciate any help, thanks!

Is This A Good Question/Topic? 0
  • +

Replies To: SQL- "missing SELECT keyword" error

#2 marinus  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 135
  • View blog
  • Posts: 575
  • Joined: 14-April 10

Re: SQL- "missing SELECT keyword" error

Posted 23 February 2011 - 11:17 PM

Please refer to this link Orical INSERT INTO
Was This Post Helpful? 0
  • +
  • -

#3 Atli  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 3730
  • View blog
  • Posts: 6,017
  • Joined: 08-June 10

Re: SQL- "missing SELECT keyword" error

Posted 23 February 2011 - 11:22 PM

Aren't you missing the VALUES clause?

I'm not an expert on Oracle, but as I understand it, it should be either:
- INSERT INTO tbl VALUES(...) or
- INSERT INTO tbl SELECT ...

Which is probably why it is asking for a SELECT statement, because without a VALUE clause it is expecting a sub-query.
Was This Post Helpful? 1
  • +
  • -

#4 lilyd30047  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 23-February 11

Re: SQL- "missing SELECT keyword" error

Posted 23 February 2011 - 11:23 PM

You're right! I can't believe I forgot that. Thanks!

View PostAtli, on 23 February 2011 - 11:22 PM, said:

Aren't you missing the VALUES clause?

I'm not an expert on Oracle, but as I understand it, it should be either:
- INSERT INTO tbl VALUES(...) or
- INSERT INTO tbl SELECT ...

Which is probably why it is asking for a SELECT statement, because without a VALUE clause it is expecting a sub-query.

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1