If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Oracle > Number vs Integer vs PLS_integer?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-24-03, 22:17
calico calico is offline
Registered User
 
Join Date: Feb 2003
Location: AU
Posts: 19
Question 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
Reply With Quote
  #2 (permalink)  
Old 03-25-03, 05:07
andrewst andrewst is offline
Moderator.
 
Join Date: Sep 2002
Location: UK
Posts: 5,171
Re: Number vs Integer vs PLS_integer?

Quote:
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.
__________________
Tony Andrews
http://tinyurl.com/tonyandrews
Reply With Quote
  #3 (permalink)  
Old 03-25-03, 17:30
calico calico is offline
Registered User
 
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
Reply With Quote
  #4 (permalink)  
Old 03-26-03, 08:45
andrewst andrewst is offline
Moderator.
 
Join Date: Sep 2002
Location: UK
Posts: 5,171
Quote:
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.
__________________
Tony Andrews
http://tinyurl.com/tonyandrews
Reply With Quote
  #5 (permalink)  
Old 03-26-03, 17:30
calico calico is offline
Registered User
 
Join Date: Feb 2003
Location: AU
Posts: 19
cheers for your help tony!
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On