Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6232663
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T10:09:19+00:00 2026-05-24T10:09:19+00:00

Previously we used DB2 as database, but now we are migrating to Oracle. Now,

  • 0

Previously we used DB2 as database, but now we are migrating to Oracle. Now, in our project we have extensively used sql’s that were Db2 specific.

Is there any way to convert those DB2 specific queries to oracle supported queries.

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T10:09:20+00:00Added an answer on May 24, 2026 at 10:09 am

    You have a lot of work ahead!

    Between DB2 and Oracle, some important differences are (just an arbitrary enumeration of what I can think of):

    Data types

    • Number data types: DB2 has many more standard types, such as SMALLINT, INTEGER, DOUBLE, etc. Those don’t exist in Oracle SQL (although some exist in PL/SQL). This is important for DDL and for casting and some other use cases, such as the correctness of predicates
    • Date data types: Oracle’s only difference between DATE and TIMESTAMP is the fact that TIMESTAMP has microseconds. But DATE may also contain time information. In DB2, DATE has no time information, I think.
    • Character data types: Read about the difference between VARCHAR and VARCHAR2 in Oracle
    • NULL. In Oracle, NULL is much more general than in DB2. Before DB2 v9.7, you had to cast NULL to any explicit type, e.g. cast(null as integer). That’s not necessary in Oracle.

    System objects

    • SYSIBM.DUAL simply becomes DUAL
    • Functions: They’re all a bit different. You’ll have to check case by case. For example, LOCATE becomes INSTR

    Syntax

    • TRUNCATE IMMEDIATE becomes TRUNCATE
    • EXCEPT becomes MINUS
    • DB2’s FETCH FIRST n ROWS ONLY: There is no such clause in Oracle. You’ll have to use ROWNUM or ROW_NUMBER() OVER() filtering (see this example)
    • DB2’s MERGE statement is more powerful than that of Oracle, in case you use this.
    • DB2 supports INSERT INTO .. (..) VALUES (..), (..), (..). With Oracle, you’d have to write INSERT INTO .. SELECT .. UNION ALL SELECT .. UNION ALL SELECT ..

    Advanced

    • If you use stored procedures, they work a bit differently, especially with advanced data types involved, but that’s out of scope here.

    Your most efficient shot at this might be to use SQL abstraction of some sort. If you’re using Java, I would recommend you wrap your SQL statements with jOOQ (Disclaimer: I work for the company behind jOOQ). jOOQ provides API-level abstraction for all of the above facts. A great deal of SQL can be executed both on DB2 and Oracle, without adaptation. We’re also working on a more independent translator product: https://www.jooq.org/translate

    On a higher level of abstraction, Hibernate (or other JPA implementations) can do the same for you

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've previously used sql-oracle just fine in Xemacs on XP and vista. However, now
i previously used <jsp:useBean> tags that have facility to decide the scope of bean
I've previously used a CookieContainer with HttpWebRequest and HttpWebResponse sessions, but now, I want
We previously used many submodules in our main repositories, but to increase the maintainability
Greetings I may have imagined this but does anyone know if Last.fm previously used
I have created a Gemfile in my rack application (that previously used .gems). When
I have previously used has_and_belongs_to_many associations in my older Rails apps but am moving
I have previously used XML based configuration for my Spring app. Now, I want
How get data from mysql database? I use ASP.NET and C#.Previously, I used LINQ
I have built a custom membership provider that I have used in a previous

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.