?
Solved

VARCHAR2 vs VARCHAR

Posted on 1998-02-05
1
Medium Priority
?
2,892 Views
Last Modified: 2008-02-26
I've been told VARCHAR is being phased out, and fields should be VARCHAR2. In passing this recommendation along in design standards, I need more information on the reasons for changing from VARCHAR to VARCHAR2.
0
Comment
Question by:micz
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 2

Accepted Solution

by:
frankr earned 200 total points
ID: 1082111
VARCHAR is an ANSI-SQL mandated datatype.  As such, it's subject to change by ANSI (whether Oracle likes it or not).

There was some question when this type was defined whether there were more changes in the offing.  Oracle did not want to be caught in the situation they'd just gone through, where they already had a datatype established that conflicted with a newer ANSI definition (Oracles pre-ANSI CHAR datatype was variable length, and the standard made it fixed length.  The ANSI VARCHAR type was the equivalent of the original Oracle CHAR.)

In order to be ANSI compatible, Oracle had to redefine CHAR, and all of the apps built on Oracle had to redefine CHAR to VARCHAR (or VARCHAR2). This was implemented during the Oracle6 to Oracle7 release.  VARCHAR2 was defined by Oracle and recommended as preferable to VARCHAR because it was extremely unlikely that ANSI would create a VARCHAR2 datatype, and Oracle could continue to support whatever definition they use, even if the ANSI definition of VARCHAR changed.

Currently the two datatypes are identical, and you're free to use either.  However, if you use VARCHAR and the ANSI standard changes, Oracle will be forced to change the VARCHAR type to conform, and you'll have to change any apps that depend on it.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Note: this article covers simple compression. Oracle introduced in version 11g release 2 a new feature called Advanced Compression which is not covered here. General principle of Oracle compression Oracle compression is a way of reducing the d…
Introduction A previously published article on Experts Exchange ("Joins in Oracle", http://www.experts-exchange.com/Database/Oracle/A_8249-Joins-in-Oracle.html) makes a statement about "Oracle proprietary" joins and mixes the join syntax with gen…
This video shows how to copy a database user from one database to another user DBMS_METADATA.  It also shows how to copy a user's permissions and discusses password hash differences between Oracle 10g and 11g.
This video shows setup options and the basic steps and syntax for duplicating (cloning) a database from one instance to another. Examples are given for duplicating to the same machine and to different machines
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question