Application Development Guide

Writing Dynamic SQL Programs

  • Why Use Dynamic SQL?
  • Dynamic SQL Support Statements
  • Comparing Dynamic SQL with Static SQL
  • Using PREPARE, DESCRIBE, FETCH and the SQLDA
  • Declaring and Using Cursors
  • Example: Dynamic SQL Program
  • How the Dynamic Program Works
  • C Example: DYNAMIC.SQC
  • Java Example: Dynamic.java
  • COBOL Example: DYNAMIC.SQB
  • REXX Example: DYNAMIC.CMD
  • Declaring the SQLDA
  • Preparing the Statement Using the Minimum SQLDA Structure
  • Allocating an SQLDA with Sufficient SQLVAR Entries
  • Describing the SELECT Statement
  • Acquiring Storage to Hold a Row
  • Processing the Cursor
  • Allocating an SQLDA Structure
  • Passing Data Using an SQLDA Structure
  • Processing Interactive SQL Statements
  • Determining Statement Type
  • Varying-List SELECT Statement
  • Saving SQL Requests from End Users
  • Example: ADHOC Program
  • How the ADHOC Program Works
  • C Example: ADHOC.SQC
  • Variable Input to Dynamic SQL
  • Using Parameter Markers
  • Example: VARINP Program
  • How the VARINP Program Works
  • C Example: VARINP.SQC
  • Java Example: Varinp.java
  • COBOL Example: VARINP.SQB
  • The DB2 Call Level Interface (CLI)
  • Comparing Embedded SQL and DB2 CLI
  • Advantages of Using DB2 CLI
  • Deciding on Embedded SQL or DB2 CLI

  • [ Top of Page | Previous Page | Next Page ]