2

I have a table (let's call it MY_TABLE) with a column (let's call it COLUMN_A).

I use spring Data to execute CRUD operations on that table. Especially, I use save method from org.springframework.data.repository.CrudRepository interface to insert some logging data into that table.

My issue is that, I noticed this morning that while creating MY_TABLE (using an SQL script), I made a typo and wrote COLUM_NA instead of COLUMN_A as column name.

So I ALTERed the table to rename that column, then I renamed the column name in my Java entity class MyTableEntity and into the getter/setter methods as well.

Since then, when I execute my Java application I have this Oracle error:

ORA-00904: "MYTABLEENT0_"."COLUMN_A" : invalid identifier.

It’s like he’s not finding the new column name and still using the old wrong one. But I don’t know why, I’ve changed the column name everywhere.

Thank you for any help.

8
  • Please show us the Java code and ALTER statement. Commented Dec 25, 2015 at 11:49
  • RENAME column DEMO Commented Dec 25, 2015 at 12:01
  • @TimBiegeleisen ALTER TABLE MY_SCHEMA.MY_TABLE RENAME COLUMN COLUM_NA TO COLUMN_A; Commented Dec 25, 2015 at 12:35
  • @VR46 I already renamed the column as I said, why renaming it again ? Commented Dec 25, 2015 at 12:38
  • @Siho - I was showing you a demo. After renaming I can use the new column name. Did u check that Commented Dec 25, 2015 at 12:39

2 Answers 2

2

If you look carefully at the error message, you'll notice something about how the column_name is displayed.

ORA-00904: "MYTABLEENT0_"." COLUMN_A " : invalid identifier.
                           ^         ^

There are rogue spaces there. Probably your actual column is called COLUMN_A with no spaces. Oracle treats identifiers in double quotes as literals. Consequently " COLUMN_A " != "COLUMN_A".

You can problably fix this by editing your configuration file.

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you APC, but I manually changed the column name while writing my question (for confidentiality concerns) and while doing this I introduced spaces whithout realizing it. I edited my question. In the real error mesage there is no space I've just checked. But thank you for the clue
0

Ok guys, I'm so confused. I just realized that I executed my ALTER request on the wrong database (I have many databases with approximately the same tables).

So it’s logic that it still use the wrong name while inserting, since the column name still wrong in that (good) database. After ALTERing the table in the good database, my app (and especially my INSERT request) went well.

Sorry and thank you all for your answers and comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.