Results 1 to 5 of 5
  1. #1
    Join Date
    Feb 2003
    Location
    AU
    Posts
    19

    Question Unanswered: Number vs Integer vs PLS_integer?

    up til now i've just used NUMBER with precision to deal with decimals. any suggestions as to the alternate uses of NUMBER, INTEGER & PLS_INTEGER?

    your comments are greatly apprec.

    calico

  2. #2
    Join Date
    Sep 2002
    Location
    UK
    Posts
    5,171
    Provided Answers: 1

    Re: Number vs Integer vs PLS_integer?

    Originally posted by calico
    up til now i've just used NUMBER with precision to deal with decimals. any suggestions as to the alternate uses of NUMBER, INTEGER & PLS_INTEGER?

    your comments are greatly apprec.

    calico
    In table definitions, everything is a NUMBER anyway.

    In PL/SQL, you have more flexibility. I would use INTEGER or PLS_INTEGER when the value is indeed an integer for clarity. PLS_INTEGER is apparently more efficient, but I don't think it is significant unless you are doing some serious integer-crunching.

  3. #3
    Join Date
    Feb 2003
    Location
    AU
    Posts
    19
    so you suggest using INTEGER (or PLS_INTEGER) in variable definitions within pl/sql scripts? and NUMBER for any standard database definitions?

    calico

  4. #4
    Join Date
    Sep 2002
    Location
    UK
    Posts
    5,171
    Provided Answers: 1
    Originally posted by calico
    so you suggest using INTEGER (or PLS_INTEGER) in variable definitions within pl/sql scripts? and NUMBER for any standard database definitions?

    calico
    That's what I do. You could use INTEGER in table definitions, but it just gets translated to NUMBER(38) anyway - as you'll see when you DESC the table. Also, you can't constrain the size e.g. INTEGER(2) as you can with NUMBER. I think it's just there for compatibility with standards.

    In PL/SQL, you can constrain INTEGER sizes, and it can be useful information to a programmer to see that a value is an INTEGER(2), so I use INTEGER there where appropriate.

  5. #5
    Join Date
    Feb 2003
    Location
    AU
    Posts
    19
    cheers for your help tony!

Posting Permissions

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