DB2和Oracle的一些異同點

來源:互聯網
上載者:User

1.Table space for indexes 的不同
Oralce:
Create TABLE T1 .............IN DATA_TA
Create Index ........ ON T1  ...... IN INDX_TS
DB2:
Create TABLE T1 ........ IN DATA_TS INDEX IN INDX_TS
Create INDEX  .....ON T1
2.RowID
Oracle:
Oracle 有RowID ,它是由資料庫唯一產生的,在程式裡可以獲得
DB2:
DB2的相對應的這個值不能被程式獲得
3.一些轉換

Oracle:
Oracle 支援一些轉換,比如:
Create table t1(c1 int);
Select * from t1 where c1='1'
Select  'abc'||2  from t1
DB2:
DB2不支援一些轉換,比如:
Create table t1(c1 int);
Select * from t1 where c1=CAST('1' AS INT)
Select  'abc'||CHAR(2)  from t1
4.函數的值做為表中的預設值
Oracle:
Oracle 支援把函數的值做為表中的預設值,比如:
Create table t1(C1 Number DEFAULT FN() NOT NULL,
C2 DATE DEFAULT NOT NULL SYSDATE
)
DB2:
DB2不支援把函數的值做為表中的預設值,比如:
Create table t1(C1 INT NOT NULL,
C2 TIMESTAMP DEFAULT CURRENT TIMESTAMP
)
這個是不允許的
5.一些內建的函數



6.公用的同義字(Public Synonyms)
Oracle:
Oracle 支援公用的同義字            
DB2:
DB2不支援公用的同義字

7.Date/Time


8.外串連


現在,Oracle 9i也支援這種ANSI join 文法
9.字串和null的合并
Select 'abc'||c1 from T1
C1 is null
Result :
Oracle : abc
DB2: null
要想得到'abc',DB2中需要這樣處理
Select  'abc'||coalesce(c1,'') from T1

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.