I have researched how to alter table data types and I understand how to do it but I cannot get it to work. I am trying to update my table Person within APP using the following command:
ALTER TABLE APP.PERSON ALTER uName varchar;
What I have tried so far:
- using Modify but realised that, after I received errors, this should indeed be ALTER.
- changing uName to UNAME.
- changing it to a data type of varchar2.
- adding in the size of the data type ‘(20)’ and ‘NOT NULL’ at the end.
Where am I going wrong? I am using Netbeans 7.3 Beta 2 running on Mac OS X, this is all being done within the SQL Commands section of Netbeans, using Java-DB as my database if any of that matters.
It has already been answered here on SO. You basically need to create new column with desired datatype and delete the old one. However, if you take a look into Apache Derby doc, there is a
SET DATA TYPEcommand, so try something likeEDIT
If code above doesn’t work, then you just have to recreate the column as I suggested before.