Q
Problem solve Get help with specific problems with your technologies, process and projects.

Working with SQL statements for DB2

Is there a way to create the following in the SQL statements for DB2?

1. Outer joins in a select statement
2. NVL conditions in triggers


1. iSeries doesn't support full outer joins (just right & left outer joins) but they can be simulated. Here's an example:

 
SELECT EMPNO, LASTNAME, PROJNO
     FROM CORPDATA.EMPLOYEE LEFT OUTER JOIN CORPDATA.PROJECT
           ON EMPNO = RESPEMP
     WHERE LASTNAME > 'S'
  UNION
  (SELECT EMPNO, LASTNAME, PROJNO
     FROM CORPDATA.PROJECT EXCEPTION JOIN CORPDATA.EMPLOYEE
           ON EMPNO = RESPEMP
     WHERE LASTNAME > 'S')

2. Not sure what you mean by NVL in Triggers. If you're referring to the Oracle NVL function, then the DB2 Coalesce function is what you'd want to use in your trigger logic.

==================================
MORE INFORMATION ON THIS TOPIC
==================================

Search400.com's targeted search engine: Get relevant information on DB2/400.

The Best Web Links: tips, tutorials and more.

Check out this Search400.com Featured Topic: Database issues resolved


Dig Deeper on Oracle on iSeries

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchDataCenter

Close