Skip to content
Advertisement

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

First I created table using this query:-

Then I created sequence using the query:-

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

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

Error- Column not allowed here.

If I try this query:-

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

Advertisement

Answer

Error- Column not allowed here.

You also need to use ' single quotes for string literals (double quotes are used to signify case-sensitive identifiers, such as column names).

Error- Not enough Values.

You have 5 columns but only 4 values in the INSERT statement and you haven’t told the SQL parser which 4 columns you want to use. Give the column names.

So your statement should be:

(Don’t store the password as plain text. At the very least, store a one-way hash of it.)

And the triggers:

and:

Then:

Gives the value in the table:

ID | NAME  | EMAIL           | COUNTRY | PASSWORD_SALT                                           | PASSWORD_HASH                                                                                                                   
-: | :---- | :-------------- | :------ | :------------------------------------------------------ | :-------------------------------------------------------------------------------------------------------------------------------
 1 | Ankit | ankit@gmail.com | India   | &!WAMmJkSpQgUD(BS~ub+2*Yk]]bT_IA* xm|:.[oEz.)*u*HAEV*B | 82CF5AE586605968DA320A64E7DDC7154FD11BEF0E0680350CA9BF5D5BEEB65D8D05FF50B8DC061E698A94FDAED46A73BAD826303C90AB49352E869931DCF04E

db<>fiddle here

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement