Solved

VARCHAR2 vs VARCHAR

Posted on 1998-02-05
1
2,863 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
1 Comment
 
LVL 2

Accepted Solution

by:
frankr earned 50 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

Working with Network Access Control Lists in Oracle 11g (part 1) Part 2: http://www.e-e.com/A_9074.html So, you upgraded to a shiny new 11g database and all of a sudden every program that used UTL_MAIL, UTL_SMTP, UTL_TCP, UTL_HTTP or any oth…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
Via a live example show how to connect to RMAN, make basic configuration settings changes and then take a backup of a demo database
Via a live example, show how to restore a database from backup after a simulated disk failure using RMAN.

708 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now