Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2016

    Question Unanswered: oracle to mysql migration and data sync

    We have an application with oracle DB and now we are converting to work in mysql too. So i have re-write the query which should work in oracle and mysql also.
    For Eg: oracle : select * from app where trunc(appdate)='01-Jan-2016' , MySQL : select * from app where date_format(appdate,'%d-%m-%y)='01-Jan-2016'.
    Now i want to re-write the query which should be common and work in both DBs. like this way have to identify and convert for to_date and other functions too. any suggestions?.

  2. #2
    Join Date
    Jan 2004
    Croatia, Europe
    Provided Answers: 4
    As both Oracle an MySQL know date literals, you could try use them instead of any functions. For example:
    select <column_list>
    from some_table
    where date_column = date '2016-07-31'

  3. #3
    Join Date
    Jun 2004
    Liverpool, NY USA
    Is your using mysql a requirement or is it because it is free. If it is the cost issue you could use instead. It is free and uses the same command syntax as oracle. If it is required then make a common function package that would have the actual commands in each database and modify your code to use the package. This would allow you to have a common code base and would only have to maintain the package for each database. And if you want to go to another database, all you would have to do is make a new version of the compatibility package.
    You do not need a parachute to skydive. You only need a parachute to skydive twice.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts