ORA-00984: column not allowed here while inserting data excluding the sequence trigger

First I created table using this query:-

CREATE TABLE mca (
    id number not null primary key,
    name varchar2(200) not null,
    password varchar2(200) not null,
    email varchar2(200) not null,
    country varchar2(200) not null
)

Then I created sequence using the query:-

CREATE SEQUENCE id_seq
 START WITH     1
 INCREMENT BY   1

Then I created Trigger so that id would auto increment during insertion:-

CREATE OR REPLACE TRIGGER MCA_TRIG
BEFORE INSERT ON MCA
FOR EACH ROW
  WHEN (new.ID IS NULL)
BEGIN
  :new.ID := ID_SEQ.NEXTVAL;
END;

Now when I'm trying to insert data, I'm getting error:-

insert into mca (name,password,email,country) values ("Ankit", "Ankit123", "ankit@gmail.com","India");

Error- Column not allowed here.

If I try this query:-

insert into mca values ("Ankit", "Ankit123", "ankit@gmail.com","India");

Error- Not enough Values.

I also tried to add id_sec.NEXTVAL in Values still getting column not allowed error.

NOTE- I am using Oracle 11g



Read more here: https://stackoverflow.com/questions/64894595/ora-00984-column-not-allowed-here-while-inserting-data-excluding-the-sequence-t

Content Attribution

This content was originally published by Stack Devloper at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: