Blu
Blu

Reputation: 101

Change Character Allowance

I have a VARCHAR field that only allows 12 characters max. How do I change character allowance to 9 or 15 for example?

Google succeeds in telling me what the max number of characters in VARCHAR in any given version of Oracle database. I know, I get that. I just want to ALTER the column character allowance within that range.

Upvotes: 0

Views: 41

Answers (2)

MT0
MT0

Reputation: 167972

ALTER TABLE tbl_name MODIFY col_name column_definition;

So if you have:

CREATE TABLE table_name (
  value VARCHAR2(12)
);

Then you can do:

ALTER TABLE table_name MODIFY value VARCHAR2(15 BYTE);

and the column will have a capacity of 15 bytes.

Or:

ALTER TABLE table_name MODIFY value VARCHAR2(9 CHAR);

and the column will have a capacity of 9 characters.

Upvotes: 0

Evgeni Dimitrov
Evgeni Dimitrov

Reputation: 22506

alter table table_name MODIFY (column_to_change varchar(new size))

Upvotes: 1

Related Questions