I had to rename a column in a table in an oracle database.
SQL
Unfortunately the oracle documentation was not working for me and I had to play around a bit and search the internet until I found the following syntax to be working.
alter table tableName rename column oldName to newName;
Some things to watch out for.
You have to use simple column names.
The oracle documentation listed asĀ first result in a google search provided the following example, which did not work for me.
RENAME COLUMN EMPLOYEE.MANAGER TO SUPERVISOR
I am puzzled as to why the above syntax did not work for me while the alter table statement worked fine, since I was able to create the table in the first place
It looks as if I just misinterpreted the oracle documentation and the rename statement always has to be combined with an alter table statement.
References
Oracle documentation
https://docs.oracle.com/javadb/10.6.2.1/ref/rrefsqljrenamecolumnstatement.html
Another resource using a syntax, which worked for me.