Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save empjustine/7d4416ea71b1dfaae146cb3daa17c448 to your computer and use it in GitHub Desktop.
Save empjustine/7d4416ea71b1dfaae146cb3daa17c448 to your computer and use it in GitHub Desktop.

statements

select BANNER_FULL from V$VERSION;

select TO_CHAR(N, 'TM') as N, vsize(N), dump(N) from (
select 0 as N from DUAL union all
select 1 as N from DUAL union all
select -128 as N from DUAL union all
select 127 as N from DUAL union all
select -256 as N from DUAL union all
select 255 as N from DUAL union all

-- java.sql.JDBCType.SMALLINT
select -32768 as N from DUAL union all 
select 32767 as N from DUAL union all
-- java.sql.JDBCType.INTEGER
select -2147483648 as N from DUAL union all 
select 2147483647 as N from DUAL union all
-- java.sql.JDBCType.BIGINT
select -9223372036854775808 as N from DUAL union all 
select 9223372036854775807 as N from DUAL union all
-- IEEE 754 binary32
select -16777215 as N from DUAL union all
select 16777215 as N from DUAL union all
-- IEEE 754 binary64 
select -9007199254740991 as N from DUAL union all 
select 9007199254740991 as N from DUAL union all

-- NUMBER(38)
select -99999999999999999999999999999999999999 as N from DUAL union all 
select 99999999999999999999999999999999999999 as N from DUAL
) union all select TO_CHAR(N, 'TM'), vsize(N), dump(N) from (
-- IEEE 754 binary32
select TO_BINARY_FLOAT(-16777215) as N from DUAL union all
select TO_BINARY_FLOAT(-POWER(2,24)+1) as N from DUAL union all
select TO_BINARY_FLOAT(16777215) as N from DUAL union all
select TO_BINARY_FLOAT(POWER(2,24)-1) as N from DUAL
) union all select TO_CHAR(N, 'TM'), vsize(N), dump(N) from (
-- Number.MIN_SAFE_INTEGER IEEE 754 binary64
-- Number.MAX_SAFE_INTEGER IEEE 754 binary64
select TO_BINARY_DOUBLE(-9007199254740991) as N from DUAL union all
select TO_BINARY_DOUBLE(-POWER(2,53)+1) as N from DUAL union all
select TO_BINARY_DOUBLE(9007199254740991) as N from DUAL union all
select TO_BINARY_DOUBLE(POWER(2,53)-1) as N from DUAL
);

output

BANNER_FULL
Oracle Database 19c EE Extreme Perf Release 19.0.0.0.0 - Production
Version 19.17.0.0.0

N                                        VSIZE(N)  DUMP(N)
0                                        1         "Typ=2 Len=1: 128"
1                                        2         "Typ=2 Len=2: 193,2"
-128                                     4         "Typ=2 Len=4: 61,100,73,102"
127                                      3         "Typ=2 Len=3: 194,2,28"
-256                                     4         "Typ=2 Len=4: 61,99,45,102"
255                                      3         "Typ=2 Len=3: 194,3,56"
-32768                                   5         "Typ=2 Len=5: 60,98,74,33,102"
32767                                    4         "Typ=2 Len=4: 195,4,28,68"
-2147483648                              7         "Typ=2 Len=7: 58,80,54,53,65,53,102"
2147483647                               6         "Typ=2 Len=6: 197,22,48,49,37,48"
-9223372036854775808                     12        "Typ=2 Len=12: 53,92,79,68,29,98,33,47,24,43,93,102"
9223372036854775807                      11        "Typ=2 Len=11: 202,10,23,34,73,4,69,55,78,59,8"
-16777215                                6         "Typ=2 Len=6: 59,85,24,29,86,102"
16777215                                 5         "Typ=2 Len=5: 196,17,78,73,16"
-9007199254740991                        10        "Typ=2 Len=10: 55,11,94,82,9,47,27,92,10,102"
9007199254740991                         9         "Typ=2 Len=9: 200,91,8,20,93,55,75,10,92"
-99999999999999999999999999999999999999  21        "Typ=2 Len=21: 44,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,102"
99999999999999999999999999999999999999   20        "Typ=2 Len=20: 211,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100"
-16777215                                4         "Typ=100 Len=4: 52,128,0,0"
-16777215                                4         "Typ=100 Len=4: 52,128,0,0"
16777215                                 4         "Typ=100 Len=4: 203,127,255,255"
16777215                                 4         "Typ=100 Len=4: 203,127,255,255"
-9007199254740991                        8         "Typ=101 Len=8: 60,192,0,0,0,0,0,0"
-9007199254740991                        8         "Typ=101 Len=8: 60,192,0,0,0,0,0,0"
9007199254740991                         8         "Typ=101 Len=8: 195,63,255,255,255,255,255,255"
9007199254740991                         8         "Typ=101 Len=8: 195,63,255,255,255,255,255,255"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment