Results 1 to 4 of 4
  1. #1
    Join Date
    May 2003
    Posts
    9

    Question Unanswered: INTEGER changed to NUMBER(22,0) in 9i release 2

    Dears,
    I have made DB schema for Oracle, and I was using INTEGER datatype when creating primary key, plz c the following sample script:
    create table SYSTEM_PARAMETERS (
    ID INTEGER not null,
    NAME VARCHAR2(50) not null,
    DESCRIPTION VARCHAR2(256),
    VALUE VARCHAR2(4000) not null,
    HINT VARCHAR2(4000),
    VALUE_TYPE VARCHAR2(1) not null,
    EDITABLE VARCHAR2(1) not null,
    constraint PK_SYSTEM_PARAMETERS primary key (ID)
    );

    It runs ok, but when I look at the generated schema I found that the ID field is NUMBER(22,0) ?!?!?!?!?
    I really don't know y.
    I couldn't beleive myself, so I re-run the script again and the problem persists so I generated the DDL using QDesigner tool from the generated schema and here is the script

    CREATE TABLE system_parameters
    (id NUMBER(*,0) NOT NULL,
    name VARCHAR2(50) NOT NULL,
    description VARCHAR2(256),
    value VARCHAR2(4000) NOT NULL,
    hint VARCHAR2(4000),
    value_type VARCHAR2(1) NOT NULL,
    editable VARCHAR2(1) NOT NULL) )
    /

    ALTER TABLE system_parameters
    ADD CONSTRAINT pk_system_parameters PRIMARY KEY (system_parameter_id)
    /

    I just deleted the storage options from the above script.

    Can anyone tell me y, and really I want it to be still INTEGER and don't change, as I'll be generating CMP Entity EJBs in Java and its mapping depend on this data type.

    Thanks

  2. #2
    Join Date
    Nov 2002
    Posts
    833

    Arrow

    RTFM A96540-02
    2.12

    NUMBER Datatype
    The NUMBER datatype stores zero, positive, and negative fixed and floating-point
    numbers with magnitudes between 1.0 x 10-130 and 9.9...9 x 10125 (38 nines followed
    by 88 zeroes) with 38 digits of precision. If you specify an arithmetic expression
    whose value has a magnitude greater than or equal to 1.0 x 10126, then Oracle
    returns an error.
    Specify a fixed-point number using the following form:
    NUMBER(p,s)
    where:
    n p is the precision, or the total number of digits. Oracle guarantees the
    portability of numbers with precision ranging from 1 to 38.
    n sis the scale, or the number of digits to the right of the decimal point. The scale
    can range from -84 to 127.
    Specify an integer using the following form:
    NUMBER(p)
    This represents a fixed-point number with precision p and scale 0 and is equivalent
    to NUMBER(p,0).
    Specify a floating-point number using the following form:
    NUMBER

  3. #3
    Join Date
    May 2003
    Posts
    9

    Question I know the data-types well

    Thankx,
    But I think u didn't get my question exactly, as I have already know the data types of Oracle well -I have been working with Oracle for more than 5 years now since ver.7.3 , but it is first time to work on 9i DB-.

    My Question is:
    Why Oracle when it see create statment with INTEGER, it converted it to NUMBER(22,0) I know both are equivlant but I need Oracle to show the Data-type as it is INTEGER.

    As my problem is not in Oracle at all, as I'm Java developer and want to generate CMP EJB from the schema, and if it finds it INTEGER it will use java.lang.Integer class in Java, but if it finds that it is NUMBER(22,0) it will get it as java.math.BigDeciaml which I don't want to happen.

    ==> I want Oracle to stick with the INTEGER data-type and don't change it to NUMBER(22,0).

    If anyone can help I will be gratful.

  4. #4
    Join Date
    Nov 2002
    Posts
    833

    Re: I know the data-types well

    I think Oracle followed : "Let's document it and call it a feature."


    Originally posted by modulo2
    Thankx,
    But I think u didn't get my question exactly, as I have already know the data types of Oracle well -I have been working with Oracle for more than 5 years now since ver.7.3 , but it is first time to work on 9i DB-.

    My Question is:
    Why Oracle when it see create statment with INTEGER, it converted it to NUMBER(22,0) I know both are equivlant but I need Oracle to show the Data-type as it is INTEGER.

    As my problem is not in Oracle at all, as I'm Java developer and want to generate CMP EJB from the schema, and if it finds it INTEGER it will use java.lang.Integer class in Java, but if it finds that it is NUMBER(22,0) it will get it as java.math.BigDeciaml which I don't want to happen.

    ==> I want Oracle to stick with the INTEGER data-type and don't change it to NUMBER(22,0).

    If anyone can help I will be gratful.

Posting Permissions

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