Results 1 to 6 of 6
  1. #1
    Join Date
    Jul 2003
    Location
    usa
    Posts
    7

    Unanswered: defining data type for a number 0f 20 digits

    hi all,

    i would appreciate if someone tell me how to define a field or column in a table as number field

    data "12345678901234567890" 20 bytes of number.

    bigint can be used for declaring number(10,0) from my understanding, i might be wrong.

    platform : db2 udb 7.1

    need your help,

    tia
    jon.

  2. #2
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    Jon,
    BIGINT will go up to 19 digits (largest 9,223,372,063,854,775,807)

    You will need to use DECIMAL(20,0) to store numbers that large.

    Andy

  3. #3
    Join Date
    Jul 2003
    Location
    usa
    Posts
    7
    Originally posted by ARWinner
    Jon,
    BIGINT will go up to 19 digits (largest 9,223,372,063,854,775,807)

    You will need to use DECIMAL(20,0) to store numbers that large.

    Andy
    Andy,

    when i had declared the column datatype as what you said,
    seq_nbr decimal (20,0) and tried to insert '12345678901234567890'

    i'm getting the following error msg:

    SQL0408N A value is not compatible with the data type of its assignment .....
    SQLSTATE = 42821

  4. #4
    Join Date
    Aug 2001
    Location
    UK
    Posts
    4,650
    MAy be you had a quote like '12345678901234567890'


    From my Command Centre Result Tab :

    --------------------------- Command entered ----------------------------
    create table tdec20(i decimal(20,0))
    ------------------------------------------------------------------------
    create table tdec20(i decimal(20,0))
    DB20000I The SQL command completed successfully.



    --------------------------- Command entered ----------------------------
    insert into tdec20 values(12345678901234567890)
    ------------------------------------------------------------------------
    insert into tdec20 values(12345678901234567890)
    DB20000I The SQL command completed successfully.


    Cheers
    Sathyaram

    Originally posted by dbjon
    Andy,

    when i had declared the column datatype as what you said,
    seq_nbr decimal (20,0) and tried to insert '12345678901234567890'

    i'm getting the following error msg:

    SQL0408N A value is not compatible with the data type of its assignment .....
    SQLSTATE = 42821
    Visit the new-look IDUG Website , register to gain access to the excellent content.

  5. #5
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    Jon,
    Try using a constant with a decimal point:
    12345678901234567890.

    Andy

    Originally posted by dbjon
    Andy,

    when i had declared the column datatype as what you said,
    seq_nbr decimal (20,0) and tried to insert '12345678901234567890'

    i'm getting the following error msg:

    SQL0408N A value is not compatible with the data type of its assignment .....
    SQLSTATE = 42821

  6. #6
    Join Date
    Jul 2003
    Location
    usa
    Posts
    7
    Originally posted by sathyaram_s
    MAy be you had a quote like '12345678901234567890'


    From my Command Centre Result Tab :

    --------------------------- Command entered ----------------------------
    create table tdec20(i decimal(20,0))
    ------------------------------------------------------------------------
    create table tdec20(i decimal(20,0))
    DB20000I The SQL command completed successfully.



    --------------------------- Command entered ----------------------------
    insert into tdec20 values(12345678901234567890)
    ------------------------------------------------------------------------
    insert into tdec20 values(12345678901234567890)
    DB20000I The SQL command completed successfully.


    Cheers
    Sathyaram
    thanks to Sathyaram and Andy,

    i had the quotes and that is what had created the problem.

    thank you guys.

Posting Permissions

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