Search results
This sample calls an SQL procedure, BUY_COMPANY, created from tbselcreate.db2. BUY_COMPANY contains usage examples of a SELECT from a data change statement. tbselcreate.db2: How to create the tables and the procedure used in the tbsel program. tbseldrop.db2: How to drop the tables and the procedure used in the tbsel program. whiles.db2
- Examples: Triggers (PL/SQL)
The following example shows three after row-level triggers....
- SQL procedural language (SQL PL)
SQL can be used as a structured programming language to...
- Examples: Triggers (PL/SQL)
The following example shows three after row-level triggers. When a new employee row is inserted into the EMP table, one trigger (EMP_INS_TRIG) adds a new row to the JOBHIST table for that employee and adds a row to the EMPCHGLOG table with a description of the action. When an existing employee row is updated, the second trigger (EMP_CHG_TRIG ...
SQL can be used as a structured programming language to write the body for SQL functions, native SQL procedures, and advanced triggers. This is known as the SQL procedural language (SQL PL). SQL PL includes a set of SQL control statements.
The following table shows the sample directories and README files for the main supported programming languages and APIs. You can also access the sample files in the listed samples directories. For the directory paths, the UNIX-style slashes are used, as in samples/c, except where the directory is for Windows only, as in samples\VB\ADO.
The db2tutorial.com website provides a comprehensive Db2 tutorial that includes practical examples and many hands-on activities. Once you complete the entire tutorial, you will be able to: Have a local Db2 database server to work with. Interact with data in the Db2 database using SQL statements.
An understanding of the data in the sample tables and the relationship between these tables is imperative to understand-ing the SQL in this book. The DB2 sample tables primarily contain information about projects and the entities involved in working on these projects. Figure A.1 shows these entities and the relationships between them.
To get the set of the matching rows from one table where something is true or false in another table (e.g. no corresponding row), use a sub-query (see Sub-Query). EMP_NM