Empress Software The SQL Precompiler
Empress v8.62
May 2006

© 1983, 2006 Empress Software Inc.

All rights reserved. Reproduction of this document in whole or part, by electronic or any other means, is prohibited without written consent from Empress Software Inc.

RESTRICTED RIGHTS LEGEND

Use, duplication, or disclosure by the Government is subject to restrictions as set forth in subparagraph (c) (1) (ii) of the Rights in Technical Data and Computer Software clause at 52.227-7013.

05/06


This manual describes how static and dynamic SQL statements can be used in C programs to access Empress databases.


Table of Contents

CHAPTER 1: Introduction

1.1 Overview
1.2 Reserved Keywords
1.3 Synonyms

CHAPTER 2: General Topics for the Precompiler

2.1 Introduction
2.2 Accessing Databases and Tables
2.3 Multiple Record Operations

2.3.1 The Cursor
2.3.2 Declaring a Cursor
2.3.3 Processing a Selected Row
2.3.4 Updating/Deleting a Selected Row
2.3.5 Closing a Cursor
2.3.6 Multiple Cursors

2.4 Transactions
2.5 Using Program Variables

2.5.1 Variable Declarations
2.5.2 Declaring C Variables
2.5.3 Shell Variables
2.5.4 Control Variables
2.5.5 Fetching and Control Variables
2.5.6 Inserting and Control Variables
2.5.7 WHERE Clause and Control Variables

2.6 SQL Communication Area (SQLCA)

2.6.1 Using the SQLCA
2.6.2 SQLCA Structure

2.7 Error Handling
2.8 Restrictions
2.9 Invoking the Precompiler

2.9.1 Using the -ptr Option

CHAPTER 3: SQL Precompiler Example Program

CHAPTER 4: Command Reference

CHAPTER 5: Dynamic SQL

5.1 Introduction

5.1.1 Dynamic versus Static SQL

5.2 Variables in Dynamic SQL
5.3 Reserved Keywords

CHAPTER 6: Dynamic SQL Commands

6.1 Introduction
6.2 EXECUTE IMMEDIATE

6.2.1 Executing Parameterless Statements
6.2.2 Example Program

6.3 PREPARE & EXECUTE

6.3.1 Preparing Statements
6.3.2 Executing Prepared Statements
6.3.3 Deallocated Prepared Statements
6.3.4 Data Types of Variables
6.3.5 Control Variables
6.3.6 Example Program

6.4 Dynamic Cursors

6.4.1 Query in Dynamic SQL
6.4.2 Preparing the Query
6.4.3 Declaring the Cursor
6.4.4 Opening the Cursor
6.4.5 Fetching Records
6.4.6 Closing a Cursor
6.4.7 Fetching With Pointer Variables
6.4.8 Fetching Null Values
6.4.9 Modifying The Current Record
6.4.10 Example Program

6.5 SQL Descriptors

6.5.1 Introduction
6.5.2 Using SQL Descriptors
6.5.3 Creating Descriptors
6.5.4 Execute Using Descriptor
6.5.5 Example Program 1
6.5.6 Open Cursor Using Descriptor
6.5.7 Fetch Using Descriptor
6.5.8 Example Program 2

6.6 Error Handling

CHAPTER 7: Dynamic SQL Command Reference

CHAPTER 8: Error Messages

8.1 Static SQL Compile-time Error Messages
8.2 Static SQL Run-time Error Messages
8.3 Dynamic SQL Error Messages

CHAPTER 9: Manual Pages