Results 1 to 2 of 2
  1. #1
    Join Date
    May 2003
    Edmonton Alberta Canada

    Unanswered: zero-length string in Oracle

    I got this question from calling trim(source) on an empty string. Just wondering why Oracle thinks zero-length String is null? i.e., trim(' ') is null.


  2. #2
    Join Date
    Sep 2002
    Provided Answers: 1

    Re: zero-length string in Oracle

    It "just does", in total contravention of the SQL standard!

    Basically, Oracle stores a character string as a character count followed by the characters, e.g. for 'Hello' stores something like {5}Hello. So for an empty string it would store {0}, i.e. a 0 character count and no characters.

    To indicate that a column value is NULL, Oracle stores a length of 0 - i.e. the same as an empty string!

    Presumably changing its storage rules to comply with the SQL standard is too difficult - or perhaps one day Oracle will redefine VARCHAR (not VARCHAR2) to work that way.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts