Skip to content
  • Yasuo Honda's avatar
    e957b1a0
    Map :bigint as NUMBER(19) sql_type by using `:limit => 19` for Oracle · e957b1a0
    Yasuo Honda authored
    since NUMBER(8) is not enough to store the maximum number of bigint.
    Oracle NUMBER(p,0) as handled as integer
    because there is no dedicated integer sql data type exist in Oracle database.
    
    Also NUMBER(p,s) precision can take up to 38. p means the number of digits, not the byte length.
    bigint type needs 19 digits as follows.
    
    	$ irb
    	2.2.2 :001 > limit = 8
    	 => 8
    	2.2.2 :002 > maxvalue_of_bigint = 1 << ( limit * 8 - 1)
    	 => 9223372036854775808
    	2.2.2 :003 > puts maxvalue_of_bigint.to_s.length
    	19
    	 => nil
    	2.2.2 :004 >
    e957b1a0
    Map :bigint as NUMBER(19) sql_type by using `:limit => 19` for Oracle
    Yasuo Honda authored
    since NUMBER(8) is not enough to store the maximum number of bigint.
    Oracle NUMBER(p,0) as handled as integer
    because there is no dedicated integer sql data type exist in Oracle database.
    
    Also NUMBER(p,s) precision can take up to 38. p means the number of digits, not the byte length.
    bigint type needs 19 digits as follows.
    
    	$ irb
    	2.2.2 :001 > limit = 8
    	 => 8
    	2.2.2 :002 > maxvalue_of_bigint = 1 << ( limit * 8 - 1)
    	 => 9223372036854775808
    	2.2.2 :003 > puts maxvalue_of_bigint.to_s.length
    	19
    	 => nil
    	2.2.2 :004 >
Loading