how to modify the size of a column

I created the table Test_Project2 in Oracle SQL Developer. After that I realized that the column proj_name is of a small size, so I decided to modify the column using the follwoing statement

ALTER TABLE TEST_PROJECT2 MODIFY proj_name VARCHAR2(300); 

but for some reason Oracle SQL Developer underscores the semi-colon with red and I do not what is mistake and how to correct it

Test_Project2:

CREATE TABLE Test_Project2 ( proj_id number(30), proj_name VARCHAR2 (30), proj_desc VARCHAR2(300) ); 
2

3 Answers

Regardless of what error Oracle SQL Developer may indicate in the syntax highlighting, actually running your alter statement exactly the way you originally had it works perfectly:

ALTER TABLE TEST_PROJECT2 MODIFY proj_name VARCHAR2(300); 

You only need to add parenthesis if you need to alter more than one column at once, such as:

ALTER TABLE TEST_PROJECT2 MODIFY (proj_name VARCHAR2(400), proj_desc VARCHAR2(400)); 
1

If you run it, it will work, but in order for SQL Developer to recognize and not warn about a possible error you can change it as:

ALTER TABLE TEST_PROJECT2 MODIFY (proj_name VARCHAR2(300)); 

This was done using Toad for Oracle 12.8.0.49

ALTER TABLE SCHEMA.TABLENAME MODIFY (COLUMNNAME NEWDATATYPE(LENGTH)) ; 

For example,

ALTER TABLE PAYROLL.EMPLOYEES MODIFY (JOBTITLE VARCHAR2(12)) ; 

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like