AHijaouy
AHijaouy

Reputation: 124

SQL Insert Error: ORA-00984

So I've created an Oracle database schema and I'm trying to insert data but getting the following error

SQL Error: ORA-00984: column not allowed here
00984. 00000 -  "column not allowed here"

Here is my DDL for the table

CREATE TABLE "SAMPLE_TYPE" 
   (    
        "SAMPLE_TYPE_ID" NUMBER(10,0) NOT NULL, 
        "SAMPLE_CODE" VARCHAR2(20) NOT NULL,
        CONSTRAINT SAMPLE_TYPE_PK PRIMARY KEY ("SAMPLE_TYPE_ID")
   );
--------------------------------------------------------
--  DDL for Sequence SEQ_SAMPLE_TYPE
--------------------------------------------------------

   CREATE SEQUENCE "SEQ_SAMPLE_TYPE"  MINVALUE 1 MAXVALUE 999999999999999999999999999 INCREMENT BY 1 START WITH 61 CACHE 20 NOORDER  NOCYCLE ;

Finally here is the insert statement that is failing.

INSERT INTO "SAMPLE_TYPE" (SAMPLE_TYPE_ID, SAMPLE_CODE) VALUES (SEQ_SAMPLE_TYPE.nextval, "Small");

Any thoughts on how to correct this? Thanks!

Upvotes: 0

Views: 1131

Answers (1)

kevinskio
kevinskio

Reputation: 4551

Strings in Oracle sql are delimited by a single quote. You have used double quotes so Oracle thinks you are creating an alias. When you double quote a table name you also have to make sure that you use the exact same capitalization you used when you created the table. This is a simplified version

INSERT INTO SAMPLE_TYPE 
(SAMPLE_TYPE_ID, SAMPLE_CODE) 
VALUES 
(SEQ_SAMPLE_TYPE.nextval, 'Small');

Upvotes: 5

Related Questions