Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 315371
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T08:17:08+00:00 2026-05-12T08:17:08+00:00

Apparently oracle doesn’t seem to distinguish between empty strings and nulls. E.g. Select name

  • 0

Apparently oracle doesn’t seem to distinguish between empty strings and nulls. E.g.

Select name from TABLE_A where id=100;
  ID   NAME
  100  null

Update TABLE_A set NAME='' where id=100;
SELECT -->
  ID   NAME
  100  null

SELECT length(NAME) FROM TABLE_A WHERE id=100;
  null

I can’t think of any good reason why Oracle would be built to behave this way (does it do this in sqlplus as well?-I’m accessing through a java interface, the article referenced used a php client).

Wouldn’t you at least want to distinguish 0 length from undefined length? Is this a known issue? Intentional behavior for some specific purpose? A long-running dispute in database theory? What gives?

(This was prompted by Matt Solnit’s answer to this question.)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T08:17:08+00:00Added an answer on May 12, 2026 at 8:17 am

    Oracle is very very very old.

    Back in 80's when it was developed (and before there were any standards) they thought is was a good idea, and given then way Oracle stores its values, it really was.

    Here’s how Oracle stores data (taken from the documentation):

    alt text

    No datatype is stored within the data, only the data length and the data itself.

    If the NULL occurs between two columns with values, it’s stored as a single byte meaning column has length 0 (actually, 0xFF). Trailing NULLs are not stored at all.

    So to store the value 'test', Oracle needs to store 5 bytes: 04 74 65 73 74.

    However, to store both an empty string and a NULL, Oracle just needs to set data length to 0.

    Very smart if your data are to be stored on 20 Mb hard drives that cost 5,000$ each.

    Later, when the standards appeared, it wasn’t such a good idea anymore, but by that time there already were lots and lots of code relying on NULL and '' being the same thing.

    Making VARCHAR to do such a distinction will break tons of code.

    To fix it, they renamed VARCHAR to VARCHAR2 (which is not a part of any standard), stated that VARCHAR2 will never distinguish between a NULL and an empty string and urged everybody to use this datatype instead.

    Now they are probably waiting for the last person who used a VARCHAR in Oracle database to die.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 223k
  • Answers 223k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer There's no need to catch the exception just so you… May 13, 2026 at 12:34 am
  • Editorial Team
    Editorial Team added an answer my $rgb = sprintf '#%02X%02X%02X', $r, $g, $b; See sprintf… May 13, 2026 at 12:34 am
  • Editorial Team
    Editorial Team added an answer There isn't any 100% solution to the problem. If you… May 13, 2026 at 12:34 am

Related Questions

Apparently oracle doesn't seem to distinguish between empty strings and nulls. E.g. Select name
I didn't realize this, but apparently Python's strftime function doesn't support dates before 1900:
I am developing a report in Sql Server Reporting Services 2005, connecting to an
There's a lot one can find about this googling a bit but I haven't
Ok, I have a question relating to an issue I've previously had. I know

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.