HiveBrain v1.2.0
Get Started
← Back to all entries
patternsqlMinor

Mapping SQL Server integer to Oracle Datatype

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
datatypesqlservermappingoracleinteger

Problem

Well I know, that an SQL Server integer is best represented by NUMBER(10).

But sometimes I have migrate some maintenance scripts to Oracle and I wonder if I must carefully
map integer to NUMBER(10) or if I can just use the ansi type integer in Oracle.

Is there any reason not to use integer?

EDIT:

I verified it against 10g.

create table BK_int_test(
i_col integer,
f_col float);

insert into BK_int_test values (1, 1);
insert into BK_int_test values (1.1, 1.1);

Select * from BK_int_test;


and got

I_COL      F_COL
---------- ----------
         1          1
         1        1,1

2 rows selected.


Thanks that saves a lot of work.

The short form int of integer is supported as well.

Solution

I don't see any reason to not use integer in Oracle. It will be mapped to the approriate Oracle datatype but keeps the DDL at least somewhat portable.

I also always use VARCHAR instead of VARCHAR2 as they are equivalent anyway. Oracle does not recommend this, as in the future this might change, but this has been true since version 6, so I doubt that it will actually change at all ;)

Context

StackExchange Database Administrators Q#3004, answer score: 5

Revisions (0)

No revisions yet.