SQL SERVER to Oracle Numeric Datatype Mapping

Getting into a consulting business has its own set of challenges that I cherish big time. Recently I was consulted by a product team that had some of the best guys in the market. I was surprised why they might need my services. But I had an open mind to go through what they were doing. They were migrating their current application that was running fine in Oracle to SQL Server. My first thought was – “Wow”. Currently enterprises and organizations do think of SQL Server as a viable, competent alternative when it comes to database choice.

Now this was obviously not the problem. They had some application logic and were actually doing the same code of ETL to push data from Oracle to SQL Server. It was all fine, but suddenly when there was considerable load they were seeing some performance problems. I was not sure why something behaves so differently when compared to Oracle.

I started the profiler and I was waiting to see what were some of the plans that were getting generated. I was surprised to see tons of implicit converts happening in the system when the profiler was working at the backend. On further investigation the Application team said they used a number of options working inside Oracle like Number (x) datatypes and were using a safe bet of Int / BigInt when working with SQL Server. Worst was, the application that was sending the generic code had no clue of this.

This set me into this journey of educating the migration team on how important it is to send the appropriate data when working inside SQL Server. These might not be simple and I don’t recollect writing about these. See below a pseudo mapping of datatypes that one needs to use when doing such migration exercise.

SQL SERVER to Oracle Numeric Datatype Mapping Oracle-Numeric-01-800x820

It is important to take the time to do profiling on the data in your source database to know what you are moving over. People often use data types that are too big and unnecessary for the application – this needs to be avoided. For example, if the application only uses ‘Int’ then use ‘Int’. Again, this is an opportunity to improve the architecture and implementation as part of a migration.

Note: that “Blobs” can be difficult to move over. SSIS is the best tool to use in this case.

As I wrap up, I would love to hear about how you used or mapped datatypes when migrating or working with Oracle and SQL Server? Do share your tips and tricks as we can learn together.

Reference: Pinal Dave (https://blog.sqlauthority.com)

Oracle, SQL Datatype, SQL Server
Previous Post
SQL SERVER – Maintenance Plan Folder Missing Under Management in SQL Server Management Studio
Next Post
SQL SERVER – Unable to Start SQL Agent – SQL Server Agent Terminated (Normally)

Related Posts

4 Comments. Leave new

  • I don’t know if things changed, but I remember way back in 2008 when I was looking for IDENTITY column in Oracle. I found out that I had to use Sequence instead…..

  • For Date Format oracle to SQLserver

  • Hi Pinal,

    The datatype mapping between Oracle & SQL Server for Oracle Number(1) should map to SQL Server’s Numeric(1) as datatype BIT will always be 0 /1 . Correct me if I am wrong.

    Oracle Number(1) –> SQL Numeric(1)


Leave a Reply