“column not allowed here” error in INSERT statement

前端 未结 8 2455
心在旅途
心在旅途 2020-12-05 17:39

I created this table called LOCATION by doing this:

CREATE TABLE LOCATION(
POSTCODE VARCHAR(10) PRIMARY KEY,
STREET_NAME VARCHAR(20),
CITY VARCHAR(20));
         


        
8条回答
  •  难免孤独
    2020-12-05 18:13

    What you missed is " " in postcode because it is a varchar.

    There are two ways of inserting.

    When you created a table Table created. and you add a row just after creating it, you can use the following method.

    INSERT INTO table_name
    VALUES (value1,value2,value3,...);
    

    1 row created.

    You've added so many tables, or it is saved and you are reopening it, you need to mention the table's column name too or else it will display the same error.

    ERROR at line 2:
    ORA-00984: column not allowed here
    
    
    INSERT INTO table_name (column1,column2,column3,...)
    VALUES (value1,value2,value3,...);
    

    1 row created.

提交回复
热议问题