Similarities and differences between oracle and db2

Source: Internet
Author: User

Some similarities and differences between oracle and db2 1. Differences between Table space for indexes Oralce: Create TABLE T1 ............. IN DATA_TACreate Index ........ ON T1 ...... IN INDX_TS DB2: Create TABLE T1 ........ IN DATA_TS index in INDX_TSCreate INDEX ..... ON T1 www.2cto.com 2, RowID Oracle: Oracle has RowID, which is uniquely generated by the database. In the program, the corresponding value of DB2: DB2 cannot be obtained by the program. 3, some Oracle conversions: Oracle supports some conversions, such as: Create table t1 (c1 int); Select * from t1 where c1 = '1' Select 'abc' | 2 from t1 DB2: DB2 does not support some conversions, such AS: Create table t1 (c1 int); Select * from t1 where c1 = CAST ('1' as int) select 'abc' | CHAR (2) from t14, the function value is used as the default value in the table Oracle: Oracle supports using the function value as the default value In the table, for example: create table t1 (C1 Number default fn () not null, C2 date default not null sysdate) DB2: DB2 does NOT support using the function value as the DEFAULT value In the table, for example: create table t1 (C1 int not null, C2 timestamp default current timestamp) This is NOT allowed for 5, some built-in functions expect () CHAR (), INTEGER (), TO_CHAR () TO_DATE () CHAR (date, FN) TO_DATE () 6, Public Synonyms (Public Synonyms) Oracle: Oracle supports Public Synonyms DB2: DB2 does not support Public Synonyms 7, date/TimeOracleDB2SYSDATECURRENT DATECURRENT TIMESTAMPDT1 + 2Add_months (DT1, 5) DT1 + 2daysDT2 + 5monthsDT1 + values (k, Char (TS1-TS2) To_date (DT1, 'Mm/DD/YYYY ') char (DT1, USA) Char (TM1, ISO) 8, external connection OracleDB2Select. lastname, A_id, B. name From emp A, Customer Bwhere. id (+) = B. sales_rep_id; Select. lastname, A_id, B. name From emp A, right outer join Customer Bwhere. id = B. sales_rep_id; Select. lastname, A_id, B. name From emp A, Customer Bwhere. id = B. sales_rep_id (+); Select. lastname, A_id, B. name From emp A, left outer join Customer Bwhere. id = B. sales_rep_id; Select. lastname, A_id, B. name From emp A, Customer Bwhere. id (+) = B. sales_rep_id (+); Select. lastname, A_id, B. name From emp A, Full outer join Customer Bwhere. id = B. sales_rep_id; currently, Oracle 9i also supports this ANSI join syntax
9. Merge string and null Select 'abc' | c1 from T1C1 is nullResult: Oracle: abc DB2: null to get 'abc ', in DB2, Select 'abc' | coalesce (c1, '') from T1

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.