Migration of Oracle SQL to DB2 SQL

Source: Internet
Author: User

The following articles describe how to quickly migrate Oracle SQL to DB2 SQL. The following describes how to port Oracle SQL to DB2 SQL, I hope you will have a better understanding of it after browsing.

SQL, Oracle, port SQL, Oracle, Port

Migration from Oracle SQL to DB2 SQL: 1. Solutions for "decode" DB2 in Oracle El: completed using the "case" conditional expression. "Case" two syntax modes: (1) case when condition THEN result 1 ELSE result 2 END

(2) CASE expression 1 WHEN expression 2 THEN result 1 ELSE result 2 END

The above WHEN can be repeated multiple times, just like the expression of SWITCH... CASE in C. For example:

 
 
  1. SELECT ORDNO,CUSNO, CASE MONTH(SHIPDATE) WHEN ''01'' THEN ''Jan'' WHEN ''02'' THEN ''Feb'' 

    WHEN ''03'' THEN ''Mar'' WHEN ''04'' THEN ''Apr'' WHEN ''05'' THEN ''May'' WHEN ''06'' THEN ''

    Jun'' WHEN ''07'' THEN ''Jul'' WHEN ''08'' THEN ''Aug'' WHEN ''09'' THEN ''Sep'' WHEN ''10'' 

    THEN ''Oct'' WHEN ''11'' THEN ''Nov'' WHEN ''12'' THEN ''Dec'' END FROM FILE 

Application instance:

 
 
  1. Oracle SQL: ------------------------- select decode(t.organtypecode, ''D'', t.parent, ''S'', t.parent, t.id) from A_ORGAN t where t.parent = 35   
  2. DB2 SQL: ------------------------- select case x.organtypecode when ''D'' then x.parent when ''S'' 

    then x.parent else x.id end from a_Organ x where x.parent = 35;   

The above content is an introduction to how to quickly learn how to port Oracle SQL to DB2 SQL. I hope you will gain some benefits.

The above content is to teach you how to quickly master the migration from Oracle SQL to DB2 SQL, and hope to bring you some help in this aspect.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.