Wednesday, June 22, 2011

Simple Integer

Simple Integer is introduced in Oracle 11g, its not a new data type but it’s a sub type of PLS_INTEGER. It accepts the values in the range of -2,147,483,648 to 2,147,483,647.

•Nulls are not allowed
declare
a simple_integer;
begin
dbms_output.put_line(a);
end;
/
Output:
ORA-06550: line 2, column 6:
PLS-00218: a variable declared NOT NULL must have an initialization assignment


•Allows Overflow.
e.g:
declare
a simple_integer:= 2147483647;
begin
a:=a+2;
dbms_output.put_line(a);
end;
/
Output:
-2147483647


There would be performance boost when simple_integer used in real native compilation.

1 comment:

kushal said...

Good. I think removal of overflow and NULL checking reduce in overhead compared to PLS_INTEGER