Your SlideShare is downloading. ×
DB2 UDB
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Introducing the official SlideShare app

Stunning, full-screen experience for iPhone and Android

Text the download link to your phone

Standard text messaging rates apply

DB2 UDB

210
views

Published on


0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
210
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
5
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. DB2 UDB® Application Programming Version 8 Course No. 1195 Description In this hands-on course the student will execute over 60 SQL statements to read and update DB2 UDB® tables. The student will prepare and execute four Embedded SQL batch programs (two without Cursors; two with Cursors). In addition, the student will become familiar with factors, which affect DB2 UDB® performance. Audience This course is suggested for Application Developers, Analysts and Technical Support Personnel who will be working directly with DB2 UDB® for Z/OS. Prerequisites Experience using Windows (if the DB2 UDB® Command Center is to be utilized) or experience using TSO/ISPF on a mainframe server Experience programming in COBOL or PL/I. A high-level knowledge of relational databases is helpful also. Objectives • Read and Update DB2 UDB® tables, using all features of the SQL SELECT, INSERT, UPDATE, and DELETE • Code Scalar, Column functions • Code efficient search predicates in the WHERE clause • Sort results using ORDER BY clause • Code inner and outer joins • Utilize subqueries and unions • Create and fire a trigger • Understand user-defined functions • Embed SQL statements in COBOL or PL/I programs • Prepare and execute COBOL or PL/1 programs successfully • Utilize scrollable and non-scrollable cursors to process data • Utilize COMMIT and ROLLBACK to define units of work • Explore stored procedures • Discuss indexes and sorts for SQL • Explore the EXPLAIN utility • Explore DB2 UDB® locking • Examine Binary Large Objects Major Topics • SQL Overview ©2007-09 | Keane, Inc. • SQL SELECT Statements • SQL WHERE Clauses • SQL: Using Multiple Tables • SQL Summarizing – Updating info@keane.com Australia | Canada | China | France | India | New Zealand | Singapore | Switzerland | UAE | UK | USA www.keane.com/education/
  • 2. Major Topics • Data Partitioned Secondary Indexes, Continued DB2 UDB® Version 8 index changes • Using Materialized Query Tables • DB2 UDB® Version 8 SQL enhancements • Scalar FULLSELECT, Common Table Expressions • Triggers, UDF’s, UDT’s • DB2 UDB® Application Program Construction • Preparing DB2 UDB® Programs • Using Cursors • Locking and EXPLAIN Duration 5 days info@keane.com Australia | Canada | China | France | India | New Zealand | Singapore | Switzerland | UAE | UK | USA www.keane.com/education/
  • 3. Course Contents 1. DB2 UDB® Overview • Scalar Functions • What DB2 UDB Is ® • Replacing Null Values • How DB2 UDB Interfaces with Applications ® • VALUE/COALESCE • Components of DB2 UDB® Database • For Character Fields Only • DB2 UDB® “World” Example • SUBSTR • String Data Types • SUBSTRING • Binary Data Types • LENGTH • BLOBs • CHARACTER_LENGTH • CLOBs • STRIP • DCLOBS • String-Handling Functions • Numeric Data Types • LCASE, UCASE • Date/Time Data Types • LOCATE • Attribute Qualifiers • LTRIM, RTRIM and CONCAT • Check Constraints • REPLACE • DB2 UDB® “World” Example • For Numeric Fields Only • Relationships • ROUND, CEILING and FLOOR • A View • TRUNCATE • Views • SIGN • ‘Special’ Data Types • The Need for Type Conversion Functions • Table/View names • Date-Handling Functions • Synonyms and Aliases • DAYOFWEEK • A DB2 UDB Sybsystem ® • DAYOFYEAR • WEEK 2. SQL Overview • QUARTER • SQL • Changing the Date Display Format • SQL Syntax Rules • Finding Date Differences • DDL, DCL, DML • Incrementing Dates • Static SQL • Extracting Parts of Dates • Dynamic SQL • Returning Nulls for an Expression • Mainframe Dynamic SQL • CASE Expressions • Workstation Access – The Control Center • Times and Timestamps 3. SQL SELECT Statements • Scalar Function Summary • Terminology 4. SQL WHERE Clause • SELECT Clauses • WHERE Clause • SQL SELECT Clause • Compound Predicates with AND and OR • Selecting All Rows and Columns • Three Value Logic • Selecting Columns Names • Null Values • Eliminating Duplicates with DISTINCT • Ranges with BETWEEN • Arithmetic Expressions • Lists, with IN • Columns Aliases, Using “AS” • Using an Expression in the In Clause • Literals • String Matching, with LIKE • Concatenating Strings info@keane.com Australia | Canada | China | France | India | New Zealand | Singapore | Switzerland | UAE | UK | USA www.keane.com/education/
  • 4. • Using the Escape Clause • Using and Expression in the VALUES Clause • Scalar FULLSELECT • INSERT: From Another Table • IS NOT DISTINCT FROM • Inserting Into Views 5. SQL: Using Multiple Tables • UPDATE • Various Ways of Combining Tables • Using Multiple Values in the SET Statement • A Test Case • DELETE • Why Joins? • Referential Integrity • Joins 101 • Constraints • Inner Joins 8. DB2 UDB® Triggers, User Defined • Local Predicates Function & User defined Types • Joining Three of More Tables • What’s a Trigger? • Joining a Table to Itself (Self-Joins) • Why do we Need Triggers? • Outer Joins • Some Common Uses of Triggers • Full Outer Joins • Trigger - Examples • Using Subqueries to Find the Intersection of Sets • Trigger Definition • Using EXISTS • Trigger Name • Difference • Activation Time • Other Correlated Subqueries • Triggering Event • UNION • Base Table • UNION ALL • Granularity • Nested Table Expressions • Activation Time and Granularity • Solving Difference Using Nested Table Expressions • Trigger Definition: Mode • Common Table Expressions • Triggers: Transition Variables and Tables • Recursive SQL • Referencing Transition Variables • Star Joins • Trigger Definition: • Trigger Condition 6. SQL Summarizing • Triggered Action • Column Function Summary • Calling Procedures from Triggers • MAX and MIN • Calling User Defined Functions from • AVG and SUM Triggers Unconditionally • Counting Row with COUNT (*) • Calling User Defined Functions • Cardinality with COUNT(DISTINCT…) from Triggers Conditionally • Variance • Signaling Error Conditions from Triggers • Standard Deviation • Example - Using the Case Statement • Multiple Distinct Clauses V8 • Dropping a Trigger • How Nulls Behave • Order of Multiple Triggers • Grouping Rows with GROUP BY • Trigger Cascading • Filtering Groups with HAVING • Triggers and Referential Constraints • How Grouping is Processed • User Defined Functions - UDFs • GROUP BY Expression V8 • Creating UDFs 7. SQL Updating • UDFS SHIPPED WITH DB2 • Statements Which Update Tables • DAYNAME and MONTHNAME UDFs • INSERT: A Single Row • UDT info@keane.com Australia | Canada | China | France | India | New Zealand | Singapore | Switzerland | UAE | UK | USA www.keane.com/education/
  • 5. 9. DB2™ from a DBA ‘s Perspective • Consistency Token • Creating DB2™ Objects • Versions of Packages • Tablespace Types • Summary of Percompiler Options • DB2’s Unit of I/O – The Page 12. Using Cursors • DB2 Indexes • Why A Cursor is Needed? • DB2’s Index Structure • Multiple-Row Select Using A Cursor • Data Partitioned Secondary Indexes • COBOL 10. DB2 Application Programs ™ • PL/I • Objectives • C • DCLGEN • Sequential Update with a Cursor • Single-Row Select • More About Cursors • COBOL • Scrollable Cursors • PL/I • Declare Sensitivity Options • SELECT in a C Program • Fetch Sensitivity Options • Variables in Programs • Directional Fetching • DB2 Datatypes vs. Host Variable Definitions • Delete Holes • Numeric Variables • Update holes • Character Variables • Limiting The Result Table Size • Coding Rules and Conventions • Scrollable Cursor Performance Issues • SQLCA • Dynamic Scrollable Cursors • Handling Null Values • SELECT from INSERT using a Cursor • INSERT Example • Multi-row FETCH • COBOL • Commits and Savepoints • PL/I • Rollback and Release • Inserting Variable-Length Columns • Committing Updates • INSERT: Multi-row with Atomic SQL • Performance Considerations • INSERT: Multi-row • Backward Cursor Processing • GET DIAGNOSTICS • Resuming a Browse • Multi-row Results • Using Multiple Cursors • Check Multi-row Results • Summary • UPDATE Examples 13. Expanding Your DB2Horizons • DELETE Examples • Objectives • Inserting Null Columns • LOBs Reviewed • Rows Affected • Using LOBs • SELECT from INSERT • Using LOBs In A Program 11. Preparing DB2 Programs ™ • Using LOB Locators In A Program • Program Preparation • LOB Functions • Executing Batch DB2 Programs ™ • Other Large Object Facts • Plans, Packages & Collections • Stored Procedures • Bind and Rebind • In the Catalog • Deleting Unused Plans and Packages • Considerations • Bind Options • Benefits • Anomalies • Dynamic SQL in Programs info@keane.com Australia | Canada | China | France | India | New Zealand | Singapore | Switzerland | UAE | UK | USA www.keane.com/education/
  • 6. • Why Use a Materialized Query Table (MQT)? • Creating a New Materialized Query Table • Materialized Query Table Attributes • Materialized Query Table Clauses- Attributes • Batch SQL • DSNTIAUL Example 14. DB2™ Locking and Performance • Objectives • Locking • SQL Performance Factors • Access Paths and EXPLAIN • Catalog Tables Updated by RUNSTATS • Access Paths and EXPLAIN • EXPLAIN Appendix A DB2 UDB® “World” Database • Tables • DB2 UDB® “World” Database • Continent • Feature • Feature Tables • State Tables Appendix B Limits in DB2™ for OS/390 About Keane Keane partners with businesses and government agencies to optimize IT investments by delivering exceptional evolution, operation, and maintenance of mission-critical systems and business processes. A US company with a large offshore capability, Keane combines local knowledge and local senior leadership with scalable global delivery that results in low-risk, actionable, cost-effective services and solutions – and a partnership that feels like an extension of your organization. In business since 1965, Keane is an agile, full-service IT services firm headquartered in the United States with approximately 12,000 employees globally. For more information on Keane’s services, solutions, products, and locations, please visit www.keane.com. info@keane.com Australia | Canada | China | France | India | New Zealand | Singapore | Switzerland | UAE | UK | USA www.keane.com/education/