Search code examples
oracleoracle-sqldeveloperalter-table

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)
);

Solution

  • 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));