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

Source: Internet
Author: User
Tags continue db2 join
Oracle
How to present Oracle's related functions in DB2 (i)
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 and DB2 7.X for example).

1. How to get a table of the first n notes written by Oracle and DB2
Oracle can actually do this:
Select * from User.bsempms where rownum<=n;
DB2 can actually do this:
Select * FROM Db2admin.bsempms fetch the ' n rows only;
In addition can also use Row_number () over () to the reality;
2. How to Obtain the Oracle and DB2 written by the date before
Oracle can actually do this:
Select sysdate from dual;
DB2 can actually do this:
Select current timestamp from sysibm.sysdummy1;
3. How to connect the fields of Oracle and DB2 write method
Oracle can actually do this:
Select emp_no| | Emp_nam from Bsempms;
Select concat (Emp_no,emp_nam) from Bsempms;
DB2 can actually do this:
Select emp_no| | Emp_nam from Db2admin.bsempms;
Select Emp_no concat emp_nam from Db2admin.bsempms;
4. How to look up the structure of the list of Oracle and DB2 write method
Oracle can actually do this:
Select sysdate from dual;
DB2 can actually do this:
Select current timestamp from sysibm.sysdummy1;
5. Oracle and DB2 notation for connecting inner joins
Oracle can actually do this:
Select a.* from Bsempms A,bsdptms b where a.dpt_no=b.dpt_no;
DB2 can actually do this:
Select * from Db2admin.bsempms inner JOIN DB2ADMIN.BSDPTMS
On Db2admin.bsempms.dpt_no=db2admin.bsdptms.dpt_no;
6. Externally connected Oracle and DB2 writing (right outer connection, left outer connection, complete outside connection, group outside connection)
Oracle can actually do this:
Select a.* from Bsempms A,bsdptms b where a.dpt_no=b.dpt_no (+);
Select a.* from Bsempms A,bsdptms b wherea.dpt_no (+) =b.dpt_no;
DB2 can actually do this:
Select * from Db2admin.bsempms right outer join DB2ADMIN.BSDPTMS
On Db2admin.bsempms.dpt_no=db2admin.bsdptms.dpt_no;
Select * from Db2admin.bsempms left outer join DB2ADMIN.BSDPTMS
On Db2admin.bsempms.dpt_no=db2admin.bsdptms.dpt_no;
Select * from Db2admin.bsempms full outer join DB2ADMIN.BSDPTMS
On Db2admin.bsempms.dpt_no=db2admin.bsdptms.dpt_no;
7. How to execute the Oracle and DB2 of the SQL file
Oracle can actually do this:
sql@ $PATH/filename.sql ">>@ $PATH/filename.sql;
DB2 can actually do this:
DB2-TVF $PATH/filename Each line in the file;
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.