CHAR Semantics (vs. BYTE)

2011-04-21
2012-12-13
  • Kevin Talley

    Kevin Talley - 2011-04-21

    I am new to TOra (love the smaller footprint vs. SQL Developer), but notice that my character columns (CHAR and VARCHAR2) are displaying their size as bytes (vs. reflecting size based on semantics).  IOW, we use CHAR semantics everywhere, and a VARCHAR2(4 CHAR) displays in TOra Object Browser as (16), basically a 4x factor.  I notice this alot in Oracle admin tools (there are two different columns in Oracle system tables/views - one gives byte size, and one gives semantic-based size - I guess most people use the byte size).  I just want to make sure there's not already a way in TOra to make this happen - else I guess I'll have to pull down the source and try to find the code where this size is retrieved (And fix it - i.e. use semantic-based size, which should always be accurate).

    Thanks!

     
  • Kevin Talley

    Kevin Talley - 2011-04-21

    Just to add a bit of clarity to my original post (to anyone that is interested), do any query on USER_TAB_COLS and find a VARCHAR column - you will see a DATA_LENGTH column (which is the size in bytes), and then also there's a CHAR_LENGTH column, which is the accurate size for any character-based columns (regardless of whether BYTE or CHAR semantics are used).  In my earlier example from first post, my column shows DATA_LENGTH = 16, but CHAR_LENGTH = 4.

    HTH…

     

Log in to post a comment.