自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

對(duì)Oracle SQL到DB2 SQL移植的淺析

數(shù)據(jù)庫 Oracle
下面的文章主要介紹的是Oracle SQL到DB2 SQL移植解決的方案,如果你對(duì)Oracle SQL到DB2 SQL移植的實(shí)際操作感興趣的話,以下的文章可以供你參考。

以下的文章主要是對(duì)Oracle SQL到DB2 SQL移植解決方案淺析,Oracle SQL到DB2 SQL移植現(xiàn)已變得十分搶手,如果你想知道更多的關(guān)于其實(shí)際應(yīng)用方面的知識(shí),你就可以瀏覽下面的文章,相信會(huì)對(duì)你有所幫助。

1、Oracel中的decode

DB2解決方案:用case條件表達(dá)式完成。

case兩種語法模式:

(1)CASE

WHEN 條件 THEN 結(jié)果1

ELSE 結(jié)果2

END

(2)CASE 表達(dá)式1

WHEN 表達(dá)式2 THEN 結(jié)果1

ELSE 結(jié)果2

END

上面的WHEN可以重復(fù)多次,就像C中的SWITCH ..CASE的表達(dá).

例如:

 

  1. SELECT ORDNO,CUSNO,  
  2. CASE MONTH(SHIPDATE)  
  3. WHEN ´´01´´ THEN ´´Jan´´  
  4. WHEN ´´02´´ THEN ´´Feb´´  
  5. WHEN ´´03´´ THEN ´´Mar´´  
  6. WHEN ´´04´´ THEN ´´Apr´´  
  7. WHEN ´´05´´ THEN ´´May´´  
  8. WHEN ´´06´´ THEN ´´Jun´´  
  9. WHEN ´´07´´ THEN ´´Jul´´  
  10. WHEN ´´08´´ THEN ´´Aug´´  
  11. WHEN ´´09´´ THEN ´´Sep´´  
  12. WHEN ´´10´´ THEN ´´Oct´´  
  13. WHEN ´´11´´ THEN ´´Nov´´  
  14. WHEN ´´12´´ THEN ´´Dec´´  
  15. END  
  16. FROM FILE  

 

應(yīng)用實(shí)例:

Oracle SQL:

 

  1. select decode(t.organtypecode, 
    ´´D´´, t.parent, ´´S´´, t.parent, t.id)  
  2. from A_ORGAN t  
  3. where t.parent = 35 
  4. DB2 SQL:  
  5. select case x.organtypecode  
  6. when ´´D´´ then  
  7. x.parent  
  8. when ´´S´´ then  
  9. x.parent  
  10. else  
  11. x.id  
  12. end  
  13. from a_Organ x  
  14. where x.parent = 35;  

 

2、Oracle中的Start with...Connect By遞歸查詢

DB2解決方案:用with公共遞歸表達(dá)式來解決。

DB2解決方案:用case條件表達(dá)式完成。

Oracle SQL:

 

  1. select t.id  
  2. from a_organ t  
  3. start with t.id in (select decode(t.organtypecode,  
  4. ´´D´´,  
  5. t.parent,  
  6. ´´S´´,  
  7. t.parent,  
  8. t.id)  
  9. from A_ORGAN  
  10. where t.id = 35)  
  11. connect by t.parent = prior t.id  
  12. DB2 SQL:  
  13. WITH FKK(id) as  
  14. (select o.id from a_organ o  
  15. where o.id=35 
  16. UNION ALL  
  17. select case x.organtypecode  
  18. when ´´D´´ then x.parent  
  19. when ´´S´´ then x.parent  
  20. else x.id  
  21. end  
  22. from FKK fk, a_organ x  
  23. where fk.id=x.parent)  
  24. select distinct id from FKK;  

 

上述的相關(guān)內(nèi)容就是對(duì)Oracle SQL到DB2 SQL移植解決方案的描述,希望會(huì)給你帶來一些幫助在此方面。

【編輯推薦】

  1. Oracle緩沖塊管理機(jī)制的看法
  2. Oracle undo釋放表空間中的操作步驟
  3. Oracle數(shù)據(jù)庫里重復(fù)沒有用的數(shù)據(jù)如何刪除
  4. Oracle undo釋放表空間中的操作步驟
  5. Oracle 簡易客戶端配置詳解
責(zé)任編輯:佚名 來源: 博客園
相關(guān)推薦

2010-08-12 10:43:36

DB2 SQL移植

2010-09-06 15:13:05

DB2

2010-11-04 15:39:40

DB2 SQL語句

2010-09-30 16:00:40

DB2動(dòng)態(tài)SQL

2010-09-06 10:54:52

DB2 sql 存儲(chǔ)過

2011-08-17 20:48:25

索引建立語句非聚集索引唯一索引

2010-08-04 11:23:59

2011-07-11 16:10:38

SQL移植Oracle數(shù)據(jù)庫

2011-07-11 15:23:37

Sql DevelopOracle Migr

2011-07-11 16:47:57

數(shù)據(jù)庫移植SQL ServerOracle

2011-07-11 17:44:07

SQLOracle標(biāo)識(shí)符

2011-07-11 18:22:34

2010-08-12 15:31:07

DB2數(shù)據(jù)庫

2010-11-02 11:43:11

DB2動(dòng)態(tài)SQL

2011-08-17 21:23:41

約束NOT NULLUNIQUE

2011-08-17 21:49:55

建立視圖SQL ServerOracle

2011-05-17 09:40:18

SQL Server IBM DB2

2010-09-07 17:12:46

DB2故障處理

2010-11-02 10:46:14

DB2分頁查詢

2011-08-22 17:18:53

SQL ServerOracleDB2
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號(hào)