Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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) ); 
like image 237
user2121 Avatar asked Sep 30 '16 06:09

user2121


People also ask

How to change the size of a column in a table?

In generic terms, you use the ALTER TABLE command followed by the table name, then the MODIFY command followed by the column name and new type and size. Here is an example:  ALTER TABLE tablename MODIFY columnname VARCHAR(20) ; The maximum width of the column is determined by the number in parentheses.

How do I automatically resize all columns and rows to fit?

Automatically resize all columns and rows to fit the data 1 Select the Select All button at the top of the worksheet, to select all columns and rows. 2 Double-click a boundary. All columns or rows resize to fit the data. More ...

How do I modify a column in a table in SQL?

ALTER TABLE address MODIFY state VARCHAR (20) ; In generic terms, you use the ALTER TABLE command followed by the table name, then the MODIFY command followed by the column name and new type and size. Here is an example: ALTER TABLE tablename MODIFY columnname VARCHAR (20) ;

How do I change the width of multiple columns in word?

Select the “Line Between” option to have Word put a vertical line between columns. And now, on to actually adjusting the column width. If you want your columns to all stay the same width as one another, you can just adjust the number in the “Width” box for column #1. Changes you make there apply to all columns, no matter how many you have.


1 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)); 
like image 147
sstan Avatar answered Oct 16 '22 10:10

sstan