Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: storing a one byte number ( 0..255 )
Dmitry N. Budanov wrote:
> hi all.
>
> query:
>
> create table test ( a smallint, b raw(1) )
> insert into test values ( 1, hextoraw('1') )
> insert into test values ( 255, hextoraw('ff') )
> select rawtohex(a), dump(a, 16), a, rawtohex(b), dump(b, 16), b from test
>
> result:
>
> RAWTOHEX(A) DUMP(A,16) A RAWTOHEX(B) DUMP(B,16)
> B
> -------------- -------------------- ---- --------------
> ---------------- ----
> C102 Typ=2 Len=2: c1,2 1 01 Typ=23 Len=1:
> 1 01
> C20338 Typ=2 Len=3: c2,3,38 255 FF Typ=23 Len=1:
> ff ff
>
> am i _compact_ store number with a small value?
> 3 bytes for number in 0 ... 255 range is a very expensive :(
>
> WBR, Dmitry
In their design, SMALLINT is an alias for INT. http://download-west.oracle.com/docs/cd/B13789_01/server.101/b10759/sql_elements001.htm#sthref233
Aside from being an annoyance, is it a problem? (Disk seems relatively inexpensive these days.)
/Hans Received on Thu Apr 01 2004 - 11:57:17 CST