How to present Oracle's related functions in DB2 (IV.)

Source: Internet
Author: User
Tags continue db2 functions
Oracle
How to present Oracle's related functions in DB2 (IV.)
Author:ccbzzp
In reality, you may often encounter some of the functions of Oracle in DB2,
Here I simply conclude that there may be many ways in which a function can be found, not all of which are listed here,
Welcome to all of you to continue, in order to share with you, to explore together, common approach! (the following are mainly Oracle
8i,9i and DB2 7.X for example).
1. How to present the Oracle and DB2 notation shown in the page
Oracle can actually do this:
Sql>select rownum,* from Bsempms where RowNum >=5 and rownum <=100;
DB2 can actually do this:
SELECT * FROM (select Row_number () over () as a, db2admin.bsempms.* from
DB2ADMIN.BSEMPMS) as temp where a>=5 and a<=100;
2. Oracle and DB2 to create tables using other tables
Oracle can actually do this:
Sql>create Table A as SELECT * from B;
DB2 can actually do this:
Create Table a like B;
3. How to convert Oracle and DB2 to user passwords
Oracle can actually do this:
Sql>alter user user123 identified by password_new;
DB2 can actually do this:
Connect to dbname user db2admin using OLDPASSW new NEWPASSW confirm NEWPASSW;
4. How to increase the user's Oracle and DB2 write method
Oracle can actually do this:
Sql>create user user123 identified by password_new;
DB2 can actually do this:
Add User:
Start/Set/Control Panel/user add a username (example: db2admin)
Assigning permissions:
Grant Dbadm on the database to user username
5. Oracle and DB2 notation of the reciprocal function of two fruit sets
Oracle can actually do this:
Sql>select * from Bsempms_old minus SELECT * from Bsempms_new;
DB2 can actually do this:
SELECT * FROM Bsempms_old EXCEPT select * from Bsempms_new;
SELECT * FROM Bsempms_old EXCEPT all select * from Bsempms_new;
6. Oracle and DB2 Writing of functions that combine two fruit sets
Oracle can actually do this:
Sql>select * FROM Bsempms_old INTERSECT SELECT * from Bsempms_new;
Sql>select * from the Bsempms_old UNION SELECT * from Bsempms_new;
Sql>select * from Bsempms_old UNION all SELECT * from bsempms_new;
DB2 can actually do this:
SELECT * from Db2admin. Bsempms
UNION
SELECT * from Db2admin. Bsempms;
SELECT * from Db2admin. Bsempms
UNION All
SELECT * from Db2admin. Bsempms;
7. How to find the name of the primary key field of the database table Oracle and DB2 write method
Oracle can actually do this:
Sql>select * from user_constraints WHERE constraint_type= ' P ' and table_name= ' table_name ';
DB2 can actually do this:
Select Colnames from syscat.indexes where tabname= ' table_name ';

To continue ...









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.