Application Development Guide
Writing Static SQL Programs
Characteristics and Reasons for Using Static SQL
Advantages of Static SQL
Example: Static SQL Program
How the Static Program Works
C Example: STATIC.SQC
Java Example: Static.sqlj
COBOL Example: STATIC.SQB
Coding SQL Statements to Retrieve and Manipulate Data
Retrieving Data
Using Host Variables
Declaration Generator - db2dclgn
Using Indicator Variables
Data Types
Using an Indicator Variable in the STATIC program
Selecting Multiple Rows Using a Cursor
Declaring and Using the Cursor
Cursors and Unit of Work Considerations
Read Only Cursors
WITH HOLD Option
Example: Cursor Program
How the Cursor Program Works
C Example: CURSOR.SQC
Java Example: Cursor.sqlj
COBOL Example: CURSOR.SQB
Updating and Deleting Retrieved Data
Updating Retrieved Data
Deleting Retrieved Data
Types of Cursors
Example: OPENFTCH Program
How the OPENFTCH Program Works
C Example: OPENFTCH.SQC
Java Example: Openftch.sqlj
COBOL Example: OPENFTCH.SQB
Advanced Scrolling Techniques
Scrolling Through Data that has Already Been Retrieved
Keeping a Copy of the Data
Retrieving the Data a Second Time
Retrieving from the Beginning
Retrieving from the Middle
Order of Rows in the Second Result Table
Retrieving in Reverse Order
Establishing a Position at the End of a Table
Updating Previously Retrieved Data
Example: UPDAT Program
How the UPDAT Program Works
C Example: UPDAT.SQC
Java Example: Updat.sqlj
COBOL Example: UPDAT.SQB
REXX Example: UPDAT.CMD
Diagnostic Handling and the SQLCA Structure
Return Codes
SQLCODE and SQLSTATE
Token Truncation in SQLCA Structure
Handling Errors using the WHENEVER Statement
Exception, Signal, Interrupt Handler Considerations
Exit List Routine Considerations
Using GET ERROR MESSAGE in Example Programs
C Example: UTILAPI.C
Java Example: Catching SQLException
COBOL Example: CHECKERR.CBL
REXX Example: CHECKERR Procedure
[
Top of Page
|
Previous Page
|
Next Page
]