Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ALTER statement: Why VARCHAR2(50 BYTE) instead of VARCHAR2(50 CHAR)? [duplicate]

I executed the following (Oracle 11g) SQL statement to increase an existing column's length from VARCHAR2(20 CHAR) to VARCHAR2(50 CHAR):

ALTER TABLE USERX.MY_TABLE MODIFY (LASTNAME VARCHAR2(50));

It succeeded without incident, but when I look at the new Data Type column, I see: VARCHAR2(50 BYTE) instead of VARCHAR2(50 CHAR).

My questions are:

  1. Why BYTE and not CHAR? What have I done incorrectly?
  2. How do I fix the column's length to be VARCHAR2(100 CHAR)?
like image 611
Withheld Avatar asked Feb 28 '13 13:02

Withheld


1 Answers

Answering myself (thanks to the tip provided by this other answer):

I should have executed instead:

ALTER TABLE USERX.MY_TABLE MODIFY (LASTNAME VARCHAR2(50 CHAR));

(note the extra CHAR after 50)

like image 106
Withheld Avatar answered Oct 09 '22 12:10

Withheld