What's the Difference between these two.
VARCHAR2(128)
VARCHAR2(128 CHAR)
Printable View
What's the Difference between these two.
VARCHAR2(128)
VARCHAR2(128 CHAR)
One works and one doesn't ?
busted2 varchar2(128 char);
*
ERROR at line 4:
ORA-06550: line 4, column 22:
PLS-00103: Encountered the symbol "CHAR" when expecting one of the following:
) , * & | = - + < / > at in mod not rem => ..
<> or != or ~= >= <= <> and or like
between is null is not || is dangling
The symbol "," was substituted for "CHAR" to continue.
Didn't you try it?
Quote:
Originally Posted by dbtoo
Documented hereCode:SQL> create table w (col1 varchar2(10 char));
Table created.
Hmm, Seems to be vergin dependant...
Connected to:
Oracle8i Enterprise Edition Release 8.1.7.4.1 - Production
JServer Release 8.1.7.4.1 - Production
SQL> create table w (col1 varchar2(10 char));
create table w (col1 varchar2(10 char))
*
ERROR at line 1:
ORA-00907: missing right parenthesis
SQL>
Connected to:
Oracle9i Enterprise Edition Release 9.2.0.6.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.6.0 - Production
SQL> create table w (col1 varchar2(10 char));
Table created.
I stand somewhat corrected... or maybe that should be squat? :o
Hi.
By default the database uses byte-semantics, such that VARCHAR2(10) means 10 bytes. This is fine in a DB using a single-byte characterset, but in a DB with a multi-byte characterset VARCHAR2(10) may not hold 10 characters. As such the character-semantics can be used to specify the column should hold 10 characters, ergardless of the byte-size it takes to store.
As a rule, people think of column sizes in characters, so when using multi-byte charactersets you should define all your string columns using character-symantics, or switch your default so you can do it implicitly.
See:
http://www.oracle-base.com/articles/...lization9i.php
Cheers
Tim...
Thanks for the info.