DBAsupport.com Forums - Powered by vBulletin
Results 1 to 3 of 3

Thread: Char or Byte Semantics doubt!

  1. #1
    Join Date
    Feb 2001
    Posts
    286

    Char or Byte Semantics doubt!

    Hi all!

    I read andgot some doubts on the usability of Char Semantics on Oracle Documentation/Manuals.Could anybody please throw some light on the usability of Semantics:Char or Byte:

    1.What is meant by 'Character semantics' in terms of the following example:

    An Example:

    Create Table example
    (byte_semantic VARCHAR2(50 BYTE),
    char_semantic CHAR(100 CHAR) );

    Does it use:

    a).Use of CHAR Data Type Storage.

    Is this correct.

    Thanks & Regards,

    Amit.
    Oracle DBA (OCP) v8i,v9i

  2. #2
    Join Date
    May 2002
    Posts
    2,645
    Character semantics provide a new way to define database fields and PL/SQL variables. In versions of Oracle Database prior to 9i and in existing versions of Forms, declaring a variable or field as CHAR(1) or VARCHAR(1) does not actually allocate space for one character, but it allocates space for one BYTE.

    This becomes a problem only in Unicode environments or in applications that need to be deployed to a mix of environments some of which are single byte and some multibyte or Unicode. In the earlier versions, it would be necessary to design for the worst case scenario (i.e. allocate 4 bytes to store each character).

    Character Semantics solves this problem altogether by introducing a new syntax for the declaration of the columns in the database and variables in PL/SQL.

    SYNTAX:
    Column_name VARCHAR2(5 CHAR) OR Column_name VARCHAR2(5 BYTE)/ Column_name VARCHAR2(5)

    The BYTE variant keeps the 8i behaviour of one character really being one byte.

    The CHAR version, specifies that the column or the variable should hold upto 5 characters in the current character set regardless of the number of bytes required. Thus the business rule will be observed without additional coding.

  3. #3
    Join Date
    Feb 2001
    Posts
    286

    Hi Stecal!

    Many thanks for putting in the effort to reply.

    So that means going by the definition,I could use it as CHAR data type
    meaning characters storage instead of bytes.

    Please do correct me if I am wrong in this matter.

    Thanks Once again.

    Regards,

    Amit.
    Oracle DBA (OCP) v8i,v9i

Posting Permissions

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


Click Here to Expand Forum to Full Width