You are on page 1of 94

ODBC Database Interface

Developer’s Guide

60000212—Eighth Edition
ODBC Database Interface Developer’s Guide

Document No. 60000212


Eighth Edition
ã Copyright 2002 InterVoice-Brite, Inc.

All rights reserved.

Trademarks of InterVoice-Brite, Inc. and/or its affiliates:

Names and marks for products provided by the Company’s suppliers are used herein for identification
purposes and may be trademarks of their respective companies.

Windows NT and Windows 2000 are registered trademarks of Microsoft.

The Apache Software License, Version 1.1


Copyright ã 2000–2001 The Apache Software Foundation. All rights reserved.

Java Runtime Environment Versions 1.2 and 1.3 are products of Sun Microsystems, Inc. All rights
reserved. Please refer to the license agreement on your system.

No part of this manual may be reproduced without the written permission of InterVoice-Brite, Inc.

The information in this manual describes the ODBC Database interface for the application developer using
InVision versions 2 and 4. For information about the preparation, configuration, and operation of the ODBC
Database interface, see the ODBC Database Interface Administrator’s Guide (60000213). This manual was
previously released in October 2001. This is the eighth edition of this manual, February 2002.

Any comments or suggestions concerning this publication should be directed to:

Technical Documentation Department


InterVoice-Brite, Inc.
17811 Waterview Parkway
Dallas, Texas 75252
Telephone: (972) 454-8200
Fax: (972) 454-8905
E-mail: document.feedback@intervoice-brite.com

For more information about InterVoice-Brite, Inc., call (972) 454-8000, or visit the InterVoice-Brite Web site
at www.intervoice-brite.com.
Documentation Comment Form
Our goal is to provide accurate and efficient information to our customers. Please
complete this form to help us improve the quality and usability of this product
documentation.

• List the document you used by name, number, and edition.


____________________________________________________________________

____________________________________________________________________

• Did the document provide the information needed? ❒ Yes ❒ No


Explain______________________________________________________________

____________________________________________________________________

____________________________________________________________________

• Were you able to locate the information in a timely manner? ❒ Yes ❒ No


Explain______________________________________________________________

____________________________________________________________________

____________________________________________________________________
• How accurate did you find the information in the document to be?
❒ Very Accurate ❒ Accurate ❒ Somewhat Accurate ❒ Not Accurate
• When you need to find information, where is the first place you usually look?
❒ Table of Contents ❒ Index ❒ Headings ❒ Scan the text
• Was the index thorough? ❒ Yes ❒ No How could it be improved?

____________________________________________________________________

____________________________________________________________________
• If you completed the steps in this manual, how easy were they to follow?
❒ Very Easy ❒ Easy ❒ Somewhat Easy ❒ Not Easy
• Overall, how helpful did you find the document to be?
❒ Very Helpful ❒ Helpful ❒ Somewhat Helpful ❒ Not Helpful
• Are there any technical errors in the document you would like to report?
____________________________________________________________________

____________________________________________________________________
• List any additional topics you would like to see covered in the documentation.
____________________________________________________________________

____________________________________________________________________
Fax to: (972) 454-8905
E-mail to: document.feedback@intervoice-brite.com
Table of Contents

List of Figures iii

List of Tables v

About This Manual vii


Purpose and Audience ........................................................................ vii
Chapters ............................................................................................. viii
InterVoice-Brite Documentation.......................................................... ix
Related Manuals ................................................................................... x
InVision Version 4 .......................................................................... x
InVision Version 2 ......................................................................... xi
DataDirect Technologies............................................................... xii
Conventions ....................................................................................... xiii
Information Symbols ................................................................... xiii
Technical Support .............................................................................. xiv

Overview 1-1
Summary of Changes......................................................................... 1-2
ODBC Database Interface Concept Diagrams................................... 1-3
ODBC Database Interface Overview................................................. 1-4
Supported Databases.......................................................................... 1-6
ODBC Database Interface Features................................................... 1-7

Preliminary Edition Table of Contents i


Defining the Database Forms 2-1
Variable Overview ............................................................................. 2-2
Sample Database Table ................................................................ 2-2
Using the DataBaseRetrieve Form .............................................. 2-3
Using the DataBaseProcess Form................................................ 2-4
Using the DataBaseEdit Form ..................................................... 2-5
Using the DataBaseRead Form.................................................... 2-6
Sample Call Flows ............................................................................. 2-7
Using DataBaseRead and DataBaseEdit Forms .......................... 2-7
Defining a Menu ....................................................................2-8
Altering Data........................................................................2-10
Retrieving Data ....................................................................2-12
DataBaseRetrieve and DataBaseProcess forms ......................... 2-15
Defining a Menu ..................................................................2-16
Altering Data........................................................................2-18
Retrieving Data ....................................................................2-20

Database Query Reference 3-1


Using Queries .................................................................................... 3-2
Supported Command Functions......................................................... 3-3
Formatting Queries ............................................................................ 3-4
Sample Queries .................................................................................. 3-7
Defining Column Names ............................................................. 3-8
Defining the SELECT Command ................................................ 3-9
Defining the WHERE Command .............................................. 3-10
AND/OR Command Operator Guidelines ........................... 3-12
IN Command Operator Guidelines ...................................... 3-13
LIKE Command Operator Guidelines ................................. 3-14
WHERE Command Option Examples................................. 3-15
Defining the DISTINCT Command .......................................... 3-18
Defining the INSERT Command............................................... 3-19
Defining the UPDATE Command ............................................. 3-22
Defining the DELETE Command.............................................. 3-24
Using Escape Sequences.................................................................. 3-26
Automatic Failover .................................................................... 3-27
Load Balance ............................................................................. 3-27
Defining Stored Procedures ............................................................. 3-28

Glossary Glossary-1

Index Index-1

ii ODBC Database Interface Developer’s Guide Preliminary Edition


List of Figures

Figure 1-1. InterSoft Interface Architecture .................................. 1-3


Figure 1-2. Database Concept Diagram......................................... 1-5
Figure 2-1. Sample DataBaseRetrieve Form ................................. 2-3
Figure 2-2. Sample DataBaseProcess Form .................................. 2-4
Figure 2-3. Sample DataBaseEdit Form ........................................ 2-5
Figure 2-4. Sample DataBaseRead Form ...................................... 2-6
Figure 2-5. DataBaseRead and DataBase Edit Sample Call Flow 2-7
Figure 2-6. DataBaseRetrieve and DataBaseProcess Sample
Call Flow............................................................. 2-15
Figure 3-1. SQL Statement on a DataBaseRead Form .................. 3-8

Preliminary Edition List of Figures iii


List of Tables

Table 2-1. PRICES Sample Database Table ................................. 2-2


Table 3-1. Query Formatting Guidelines....................................... 3-5
Table 3-2. SQL Commands and Application Forms ..................... 3-7
Table 3-3. ACC_INFO Sample Database Table ........................... 3-9
Table 3-4. SELECT Commands .................................................... 3-9
Table 3-5. WHERE Command Operators ................................... 3-10
Table 3-6. AND/OR Command Operator Guidelines ................. 3-12
Table 3-7. IN Command Operator Guidelines ............................ 3-13
Table 3-8. LIKE Command Operator Guidelines ....................... 3-14
Table 3-9. Retrieving Data from Specific Records ..................... 3-15
Table 3-10. Retrieving Unique Records ........................................ 3-18
Table 3-11. INSERT Command .................................................... 3-20
Table 3-12. UPDATE Command .................................................. 3-22
Table 3-13. DELETE Command ................................................... 3-24
Table 3-14. BASIC_INFO Sample Database Table ...................... 3-28
Table 3-15. PERSONAL_INFO Sample Database Table ............. 3-29

Preliminary Edition List of Tables v


About This Manual

Purpose and Audience

The ODBC Database Interface Developer’s Guide explains how to use


the ODBC Database interface forms and their queries in an InVision
version 2 or version 4 application.

The ODBC Database interface enables the InterSoft system’s InVision


application to communicate with a database using ODBC-compliant
database drivers. ODBC enables access to multiple database
management systems using Structured Query Language (SQL). Thus, a
single application can access many different databases.

The audience for this manual includes application developers who use
the ODBC Database interface in InVision applications.

Preliminary Edition About This Manual vii


Chapters
This manual contains the chapters briefly described below. For a list of
related manuals, see page x.

Chapter 1—Overview

Provides the overview for this manual. It contains a purpose statement


for the entire manual. It also contains a concept diagram and a list of
benefits.

Chapter 2—Defining the Database Forms

Explains how the InVision forms use variables to update and play data
to callers.

Chapter 3—Database Query Reference

Provides guidelines for formatting queries as well as descriptions and


examples of specific queries. It serves as a reference for entering queries
in the DataBaseEdit, DataBaseRead, and DataBaseRetrieve forms.

viii ODBC Database Interface Developer’s Guide Preliminary Edition


InterVoice-Brite Documentation
InterVoice-Brite provides its standard product documentation on
CD-ROM. The manuals on the CD-ROM are in Adobe Acrobat format
(.pdf files) and can be viewed, navigated, and printed. The CD-ROM
includes:
• Adobe Acrobat Reader with the Search tool plug-in, which enables
viewing and full-text searches of the documents. You can view the
document files using the copy of Acrobat Reader installed on the
CD-ROM, or you can install Acrobat Reader on your local hard
drive.

• A readme.txt file that lists system requirements and explains how to


install Acrobat Reader.
• A welcome file that provides navigation to the document files.
For more information about
using Adobe Acrobat The following core product CD-ROMs are currently available:
Reader, see the welcome
file on the CD-ROM, or go Core Software Documentation CD-ROM – Doc Number 62000047
to the Adobe Web site at
http://www.adobe.com.
Provides a complete, easy-to-use reference of the core software
product technical documents, including core features, CTI interface,
database interface, host interface, software installation, InterSoft,
InVision, network connectivity, history reporting, system
management, and telephony product manuals.

Core Installation Documentation CD-ROM – Doc Number 62000083


Provides a complete, easy-to-use reference of the core installation
product technical documents, including site preparation,
installation, maintenance, system software, system hardware, and
system configuration manuals.

The following technical documentation catalog is shipped along with


the CD-ROM:

Core Product Documentation Guide – Doc Number 60000021


Describes the documents available with each product line and
explains how to access them on a technical documentation
CD-ROM.

InterVoice-Brite also provides an online source of its documentation


through the company Web site. RealCare support customers,
customers under warranty, resellers, and distributors can visit
http://www.intervoice-brite.com/support to register for access to the
documentation. Hard copy manuals or additional CD-ROMs can be
purchased from any InterVoice-Brite sales representative.

Preliminary Edition About This Manual ix


Related Manuals
The following manuals contain useful information about your product.
The manuals are listed in functional order.

ODBC Database Administrator’s Guide (InterSoft version 3) –


Doc Number 60000213
Describes the ODBC Database interface, which allows the system to
access an ODBC database to retrieve, alter, and add database
records. Supported ODBC-compliant databases include Pervasive
(formerly Btrieve), Clipper, DB2, dBASE, FoxBASE, FoxPro,
Informix, Oracle, SQL Server, and Sybase Systems. This manual
provides information about preparing, installing, and configuring
the interface. the manual also provides information about locking
and isolation levels and SQL data types.

InVision Version 4

Getting Started with InVision (InVision version 4) – Doc Number


60000998
Gives programmers step-by-step instructions for creating an
InVision application that demonstrates the following features:
(1) Palette, Palette toolbars, standard toolbar, and drag-and-drop
functionality; (2) creation of call flow diagrams using the InVision
Editor features; (3) easy navigation to applications and pages
through the Navigator; (4) quick resizing of call flow diagrams and
cut, copy, and paste functionality; (5) convenient reuse of
application code through subroutines; and (6) completion of forms
in the call flow diagrams.

InVision User’s Guide (InVision version 4) – Doc Number 60000987


Explains how to create an application that runs on an InterSoft
system. It includes information about navagiation, demo and code
mode, subroutine creation, testing, and other major InVision
components and features.

Differences Between InVision Version 2 and Version 4 (InVision


version 4) – Doc Number 60000992
Describes the major differences between InVision version 2 and
version 4, including changes to windows, navigation, and
functionality.

x ODBC Database Interface Developer’s Guide Preliminary Edition


InVision Reference Guide (InVision version 4) – Doc Number 60000988
Provides reference information for programming applications in
InVision. Includes descriptions of all demo and code forms, and
provides definitions and examples of commonly used expressions
and variables.

InVision Quick Reference Card (InVision version 4) –


Doc Number 60000989
Displays on a reference card a graphic of the InVision Editor with
demo and code subwindows, the Navigator tree view of
applications, and the Palette with form icons. The card lists all
Editor, Navigator, and form menu options as well as general hot
keys.

Importing InterForm Applications into InVision (InVision version 4) –


Doc Number 60000993
Explains how the InterForm application development tool differs
from InVision. It also explains how to import an InterForm
application into InVision.

InVision Version 2

Getting Started with InVision (InVision version 2) –


Doc Number 60000301
Gives programmers step-by-step instructions for creating an
InVision application that demonstrates the following InVision
features: (1) Forms Notebook, Forms Toolbar, Button Bar, and
drag-and-drop functionality; (2) creation of call flow diagrams
using the Development window features; (3) easy navigation to
modules and module pages through the Page Navigation window;
(4) quick resizing of call flow diagrams and cut, copy, and paste
functionality; (5) convenient reuse of application code through
subroutines; and (6) completion of forms in the call flow diagrams.

InVision User’s Guide (InVision version 2) – Doc Number 60000300


Provides complete user and reference documentation for the
InVision program. It describes the InVision graphical user interface
and explains how to create an application call flow.

InVision Reference Guide (InVision version 2) – Doc Number 60000708


Provides reference information for programming applications in
InVision. Includes descriptions of all Demo and Code forms, and
provides definitions and examples of commonly used expressions
and variables.

Preliminary Edition About This Manual xi


InVision Quick Reference Card (InVision version 2) –
Doc Number 60000718
Contains on a reference card a graphic of the InVision Development
window and its labeled components. The card also provides a quick
reference for the Forms Notebook, a list of general hot keys, as well
as menu options for the Development, Form, and Test windows.

DataDirect Technologies

DataDirect Connect ODBC Reference (OEM, Windows NT, UNIX) –


Doc Number 60000409
Provides information about installing and configuring ODBC
drivers. This manual provides essential information to help the
customer complete the configuration of specific ODBC drivers.

xii ODBC Database Interface Developer’s Guide Preliminary Edition


Conventions
This manual uses the following keyboard, command prompt, and menu
conventions:

Example Instructs you to...


<Enter> Press the Enter key.

<Ctrl><Esc> Hold the Control key while pressing the Escape key.
[d:\appl]dir <Enter> Enter a command at a Windows command prompt.
Note These commands are not case-sensitive.

Edit > Paste > Save Select Edit from the menu bar, choose Paste, and then
select Save from its menu.

Information Symbols

InterVoice-Brite manuals use the following symbols to help you quickly


identify the type of information contained in a note box:

Symbol Name Description


Warning Warns you about actions that can create electrical
hazards.

Caution Cautions you about actions that can cause data


loss.

General Provides additional general information about the


topic being discussed.

Tip Provides a useful tip about the topic being


discussed. The tip is located in the margin of the
page for easy reference.

Manual Refers you to a related manual for further


Reference information on the product.

Preliminary Edition About This Manual xiii


Technical Support
InterVoice-Brite wants its customers to be satisfied with its products. To
obtain customer support, contact RealCare at (800) 955-4688 or
(972) 454-8130.

xiv ODBC Database Interface Developer’s Guide Preliminary Edition


1

In this chapter... Overview


▼ Summary of Changes, 1-2

▼ ODBC Database Interface


The ODBC Database Interface Developer’s Guide explains how to
Concept Diagrams, 1-3 use the ODBC Database interface forms and their queries in an
▼ ODBC Database Interface
InVision version 2 or version 4 application.
Overview, 1-4
The ODBC Database interface enables the InterSoft system’s
▼ Supported Databases, 1-6
InVision application to communicate with a database using
▼ ODBC Database Interface ODBC-compliant database drivers. ODBC enables access to
Features, 1-7
multiple database management systems using Structured Query
Language (SQL). Thus, a single application can access many
different databases.

The audience for this manual includes application developers who


use the ODBC Database interface in InVision applications.

This chapter provides the overview for this manual. It contains a


purpose statement for the entire manual. It also contains a concept
diagram and a list of benefits.

1-1
Summary of Changes
The major revisions to this manual are summarized below:

Changes
All references to MERANT were changed to DataDirect
Technologies.

“Defining the Database Forms,” Chapter 2 was updated with


InVision version 4 forms.

Deletions
The SequeLink interface architecture diagram was deleted from
Chapter 1.

1-2 ODBC Database Interface Developer’s Guide Preliminary Edition


ODBC Database Interface Concept Diagrams

ODBC Database Interface Concept Diagrams


Figure 1-1 illustrates the relationship among the InterSoft system, the
network, and the database server.

InVision Application

Database Server
IQTalkd.exe
(IQTalk Application)
Communications (IPC)
Interprocess

LoadDB.exe
Network

DB.DLL
(DBODBC.DLL)

InterSoft System
ODBC32.DLL (ODBC
Driver Manager)

ODBC Database
Driver

Database Specific
Client Software

The Layers of the InterSoft


System

Figure 1-1. InterSoft Interface Architecture

Note Some ODBC drivers do not require database client


software.

Preliminary Edition Overview 1-3


ODBC Database Interface Overview
The ODBC Database interface can have multiple database server
connections to the same database, to different databases residing on the
database server, or to databases residing on different servers. Multiple
connections to the same database provide the ability to process
concurrent database procedures. The number of connections needed for
a particular installation depends on call volume, query structure, and
server response time.

Licensing Requirements for Multiple Connections


In general, each connection to a database server
requires a client license. For specific licensing
requirements for your site, refer to your database server
licensing agreement.

A database consists of database tables. A database table lists fields, or


data items, for all records in the database file. The same field can be
listed in multiple database tables. A database table is made up of rows
and columns. Each row in a database table represents a record, or
collection of related data. Each column in a table represents a field, or
piece of data. Each column has a unique name that is used as part of the
search criteria in queries.

1-4 ODBC Database Interface Developer’s Guide Preliminary Edition


ODBC Database Interface Overview

Figure 1-2 shows three database tables from the same database. The
PERSONAL_INFO table contains entries for personal information, the
ACCOUNT_INFO table lists account information, and the ORDER_LIST
table contains information on recent orders. In this example, the NAME
The maximum length of
field is listed in both the PERSONAL_INFO and ACCOUNT_INFO tables.
a column name in a The ACCT_ID field is listed in both the ACCOUNT_INFO and
database table is 27 ORDER_LIST tables.
characters. If the column
name exceeds this limit,
see “Defining Column Table Name: PERSONAL_INFO
Names” on page 3-8. NAME ADDR PHONE Column or
Field
B Jones 5545 Main 555-1234
C Smith 129 First 555-4321

Table Name: ACCOUNT_INFO


NAME ACCT_ID BALANCE
B Jones 123456 0.00 Record or
Row
C Smith 987654 132.98

Table Name: ORDER_LIST


ACCT_ID ITEM QUANT
Field
123456 600121 2 Value
987654 600193 50

Figure 1-2. Database Concept Diagram

When they alter or retrieve information, queries reference column


names as their first step to locating records or specific information to be
accessed. Additional parameters narrow the search to specific field
values. When a match occurs, the queries retrieve or alter the selected
row of data.

Preliminary Edition Overview 1-5


Supported Databases
The following is a list of the databases supported by the ODBC
Database interface:
• DB2 UDB
For more information • Connect Premium for DB2 (DRDA)
about these databases,
refer to the DataDirect • Informix
Connect ODBC
Reference manual.
• Microsoft SQL Server
For information about the • Oracle
generic [DataBaseDef]
entries or about installing
• Pervasive.SQL (formerly Btrieve)
ODBC Driver software, • Sybase ASE
refer to the ODBC
Database Interface
Administrator’s Guide. InterVoice-Brite embeds DataDirect drivers in its systems. These
drivers are known as InterVoice-Brite Branded ODBC drivers and can
be used only by the InterVoice-Brite software. They require a platform
type of 97 in the dbconf.dat file.

The Connect Premium for DB2 interface driver uses the DRDA
protocol to provide ODBC access to DB2 on 8/390 systems running
OS/390 or MVS. This driver requires platform type 97.

Recommendation
Use platform type 97 with InterVoice-Brite Branded
ODBC drivers.
Otherwise, InterVoice-Brite recommends using a generic
[DataBaseDef] entry, platform type 99, instead of a
platform-specific [DataBaseDef] entry.

1-6 ODBC Database Interface Developer’s Guide Preliminary Edition


ODBC Database Interface Features

ODBC Database Interface Features


Features of the ODBC Database interface are listed below:

Features of the ODBC Database Interface...

✰ Supports ANSI SQL queries in expressions.


✰ Supports InVision forms to manipulate table entries.
✰ Supports multiple databases.
✰ Can retrieve information of up to 64 KB for InterSoft versions 2.0 and
2.1.

✰ Supports result sets above 64 KB for InterSoft version 2.2 or higher.


✰ Supports replicated servers for automatic failover and load balancing.
✰ Supports stored procedures in addition to standard SQL queries. It
does not support output parameters.

Preliminary Edition Overview 1-7


2

In this chapter... Defining the Database


▼ Variable Overview, 2-2 Forms
▼ Sample Call Flows, 2-7
This chapter explains how the InVision forms use variables to
update and play data to callers.

Four forms are used in applications to alter data and retrieve it from
the ODBC databases. The DataBaseEdit form is used to alter the
data in the ODBC databases; the DataBaseRead and
DataBaseRetrieve forms are used to retrieve the data from the
ODBC databases; the DataBaseProcess form is used to process the
data that the DataBaseRetrieve form obtains from the database.

2-1
Variable Overview
Variables can be used to build SQL query strings. Then they are entered
into DataBaseRead, DataBaseRetrieve, and DataBaseEdit forms.

Variables are also used in the DataBaseRead and DataBaseProcess


For information about
completing these forms
forms to store and process data retrieved or read from the database.
and adding them to an These forms can reference variables defined on other InVision forms
InVision call flow diagram, such as the AskForNumber form.
refer to the InVision
User’s Guide and the
InVision Reference
Data can be assigned to variables defined on the DataBaseEdit and
Guide. DataBaseRead forms as well as on the DataBaseProcess and
DataBaseRetrieve forms. Other InVision forms, such as the Play form,
can reference variables defined on these forms.

Sample Database Table


Table 2-1 shows a sample table, PRICES, from the ODBC_DB local
database. A variable defined on the AskForNumber form can be
referenced by the DataBaseEdit or the DataBaseProcess form. For
example, a DataBaseEdit or DataBaseProcess form can reference a
Variables referenced by
the DataBaseEdit or
variable to update the CURRENT_QUOTE column for ABC Corp., as
DataBaseProcess form shown in the following table:
must be defined on an
InVision Worksheet form. Table 2-1. PRICES Sample Database Table
For information on the
Worksheet form, refer to Table Name: PRICES
the InVision User’s Guide.
STOCK_NAME CURRENT_QUOTE YESTERDAY_QUOTE

ABC Corp. 12.43 10.11

XYZ, Inc. 24.30 20.52

The CURRENT_QUOTE column is updated with the new stock price


each time the caller dials in and inputs the new price using touchtone or
voice commands.

2-2 ODBC Database Interface Developer’s Guide Preliminary Edition


Variable Overview

Using the DataBaseRetrieve Form


The DataBaseRetrieve form retrieves information from a database. It is
used with the DataBaseProcess form.

A sample DataBaseRetrieve form is shown below:


The DataBaseProcess
form may be used
instead of the
DataBaseEdit form.
Depending on the
version of InVision you
are using, the
appearance of your
forms may vary slightly.

Figure 2-1. Sample DataBaseRetrieve Form

The information required in the Database name field on the form is


shown as the database alias in dbconf.dat.

For more information


about the forms
discussed in this chapter, Using the DataBase Retrieve Form
refer to the InVision
Reference Guide. A DataBaseRetrieve form used with a DataBaseProcess
form provides almost the same functionality as a
DataBaseRead form.
However, data collected in the DataBaseRead form must
be used immediately in the form. Data collected in the
DataBaseRetrieve form can be used later in the InVision
application.

Preliminary Edition Defining the Database Forms 2-3


Using the DataBaseProcess Form
The DataBaseProcess form processes the information obtained by the
DataBaseRetrieve form.

A sample DataBaseProcess form is shown below:


The DataBaseProcess
form may be used
instead of the
DataBaseEdit form.
Depending on the
version of InVision you
are using, the
appearance of your
forms may vary slightly.

Figure 2-2. Sample DataBaseProcess Form

The information shown in the Database data source field on this form is
populated from the Database result field on the DataBaseRetrieve form
(see page 2-3).

Using the DataBaseProcess Form


A DataBaseProcess form used with a DataBaseRetrieve
form provides almost the same functionality as a
DataBaseRead form.
However, data collected in the DataBaseRead form must
be used immediately in the form. Data collected in the
DataBaseRetrieve form can be used later in the InVision
application.

2-4 ODBC Database Interface Developer’s Guide Preliminary Edition


Variable Overview

Using the DataBaseEdit Form


The DataBaseEdit form allows you to insert, update, or delete one data
row or multiple data rows in the specified database.

A sample DataBaseEdit form is shown below:


The DataBaseProcess
form can be used instead
of the DataBaseEdit
form.
Depending on the
version of InVision you
are using, the
appearance of your
forms may vary slightly.

Figure 2-3. Sample DataBaseEdit Form

The information required in the Database name field on the form is


shown as the database alias in dbconf.dat. For example, the database
alias for Microsoft Visual FoxPro is foxpro_db.

Preliminary Edition Defining the Database Forms 2-5


Using the DataBaseRead Form
The DataBaseRead form allows you to select one data row or multiple
data rows from the database. The rows are selected based upon the
search condition specified in the SQL query field.

If you have entered an Note In versions of InVision lower than 2.2, this form can
expression on the receive a maximum of 64 KB of information. Above version 2.2,
DataBaseRead form,
disable the Literal Query there is no limit to the amount of information the form can
checkbox to distinguish receive.
the expression from a
literal database query.
A sample DataBaseRead form is shown below:

Figure 2-4. Sample DataBaseRead Form

The information required in the Database name field on the form is


shown as the database alias in dbconf.dat. For example, the database
alias for Microsoft Visual FoxPro is foxpro_db.

2-6 ODBC Database Interface Developer’s Guide Preliminary Edition


Sample Call Flows

Sample Call Flows


Call flows are a graphical representation of an InVision application that
show how a call progresses through the system. The call flow illustrates
all caller options.

Using DataBaseRead and DataBaseEdit Forms

Figure 2-5 illustrates how the DataBaseRead and DataBaseEdit forms


can be used with other InVision forms to gather data from callers and
then play data back to them.

In this sample, a caller uses the InterSoft system to update a stock price.
After updating the stock price, the caller dials the InterSoft system again
and plays the stock price to verify the change took place. The steps to
define all the forms needed in this sample call flow begin on page 2-8.
The sample call flow in
Figure 2-5 is presented in
InVision version 4.
If you are using InVision
version 2, the screen will
look different.

Figure 2-5. DataBaseRead and DataBase Edit Sample Call Flow

For a sample call flow that incorporates the DataBaseProcess and


DataBaseRetrieve forms in an application, refer to page 2-15.

Preliminary Edition Defining the Database Forms 2-7


Defining a Menu The Menu form provides options to the caller. For example, a Menu
form is used when a caller dials into the InterSoft system to update a
value in the system database.

In this example, the application greets the caller and then prompts the
caller to choose an option from the menu.

To add a Menu form to an application, follow these steps:

1 Add a new Menu form icon to the beginning of the call flow in the
application.

2 Double-click the icon to open the Menu form.

A sample Menu form is shown below:

2-8 ODBC Database Interface Developer’s Guide Preliminary Edition


Sample Call Flows

3 Define the Menu form to greet the caller and then prompt the caller
to choose an option from the menu.

a In the Prompt field, enter the message number or text that


prompts the caller to choose an option.

b In the Enable mask field, assign each menu option to a number


or character on the touchtone keypad, or enter an expression to
calculate the enable mask.

c In the ID field, assign an identification letter (A-Z) to each menu


option.

d In the Play field, enter the number of the message that


corresponds to each menu option.

e In the Message Text (Optional) field, enter the message text that
corresponds to each menu option.

f In the Label (optional) field, enter the label to be displayed


beside the menu option on the call flow diagram.

4 Save and exit the form.

Preliminary Edition Defining the Database Forms 2-9


Altering Data When a caller dials into the InterSoft system to update a value in the
system database, an AskForNumber form requests information from the
caller. In this example, the application prompts the caller to enter a new
value for a stock price in the database.

To modify data in an application, follow these steps:

1 Add a new AskForNumber form icon to the application call flow to


prompt the caller to enter the new stock price.
A variable name is
case-sensitive, must 2 Double-click the icon to open the AskForNumber form.
start with a letter, and
cannot contain spaces. A sample AskForNumber form is shown below:
For example, number,
Number, and NUMBER
represent three different
valid names.

3 Define the AskForNumber form to prompt the caller to enter the


new price.

a In the Prompt field, enter the message number or text that


prompts the caller to enter the new price.

b In the Minimum length field, enter the minimum length allowed


for the new stock price.

c In the Maximum length field, enter the maximum length allowed


for the new stock price.

2-10 ODBC Database Interface Developer’s Guide Preliminary Edition


Sample Call Flows

d From the If star (*) pressed during input then list, select Treat
star as a decimal point.

e In the Assign result to field, enter AFNPrice to assign the new


stock price to the AFNPrice variable.

4 Save and exit the form.

5 Add a DataBaseEdit form icon to the application call flow. It uses


the AFNPrice variable to update the column in the database table.

6 Double-click the icon to open the DataBaseEdit form.

A sample DataBaseEdit form is shown below:

7 Define the DataBaseEdit form to update the ODBC_DB database


with data from the CURRENT_QUOTE column in the PRICES table
where STOCK_NAME is ABC Corp. The data inserted into this
column is the data assigned to the AFNPrice variable.

In the Query field, enter the query to update the information in the
database. In this example, the following query updates the
ODBC_DB database with the stock price for ABC Corp.:

For more information 'UPDATE PRICES SET CURRENT_QUOTE = ', (AFNPrice quoted),'
about entering queries on WHERE STOCK_NAME= ', ('ABC Corp.' quoted)
the DataBaseEdit form,
refer to “Database Query This is assigned to the AFNPrice variable on the AskForNumber
Reference,” Chapter 3.
form, as described in step e above.

Preliminary Edition Defining the Database Forms 2-11


Retrieving Data When a caller dials into the InterSoft system to request the latest value
in the system database, a DataBaseRead or a DataBaseRetrieve form
retrieves the information from the system’s database.

In this sample, the caller requests the latest stock price from the
application using a DataBaseRead form.

1 Add a DataBaseRead form icon to the application call flow.

2 Double-click the icon to open the DataBaseRead form.

A sample DataBaseRead form is shown below:

3 Define the DataBaseRead form.

a In the Database name field, enter the name of the database alias
from dbconf.dat. In this example, it is ODBC_DB.

b Select the Literal Query checkbox, and enter the query in the
Query field that is to retrieve the stock price from the database.
In this example, the following query retrieves the stock price
from the ODBC_DB database:

SELECT STOCK_NAME, CURRENT_QUOTE FROM PRICES

c Select First from the Execute rows list, and enter 20 in the First
field. (The first 20 rows are executed.)

2-12 ODBC Database Interface Developer’s Guide Preliminary Edition


Sample Call Flows

d In the Column name field, enter STOCK_NAME; and in the


Assign to field, enter D_Company. Optionally, enter a
description in the Comment field.

The DataBaseRead form extracts the STOCK_NAME from the


local database, ODBC_DB, and assigns it the D_Company
variable.

e In the Column name field, enter CURRENT_QUOTE; and in the


Assign to field, enter D_Price. Optionally, enter a description in
the Comment field.

For more information The DataBaseRead form extracts the updated stock price
about using the (CURRENT_QUOTE) from the local database (ODBC_DB) and
DataBaseRead form,
see the InVision
assigns it the D_Price variable.
Reference Guide.
The DataBaseRead form uses the AFNPrice variable to access
the stock price that was updated by the previous DataBaseEdit
form.

For information about entering queries on the DataBaseRead


form, refer to “Database Query Reference,” Chapter 3.

4 Save and exit the form.

5 Add a Play form icon to the application call flow. This form plays
the stock price to the caller.

6 Double-click the icon to open the Play form.

A sample Play form is shown below:

Preliminary Edition Defining the Database Forms 2-13


7 Define the Play form.

a In the Play mode field, select KeyOver from the list.

b In the first line of the Format field, enter the message number
501; and in the Value field, enter the message text The current
price is....

c In the second line of the Format field, select Monetary from the
list; and in the Value field, enter the variable name D_Price.

The InterSoft system accesses this Play form, which plays the stock
price (CURRENT_QUOTE) assigned to the D_Price variable on the
previous DataBaseRead form.

Assigned Form Variables


The data assigned to the form variables can be
referenced by other forms. For example, the data
assigned to the D_Price variable can be played to callers
as specified on the Play form.

8 Save and exit the form.

2-14 ODBC Database Interface Developer’s Guide Preliminary Edition


Sample Call Flows

DataBaseRetrieve and DataBaseProcess forms

Figure 2-6 illustrates how the DataBaseRetrieve and DataBaseProcess


forms may be used with other InVision forms to gather data from callers
and then play the data to them.

The steps to define all the forms needed in this sample call flow begin
on page 2-16.

Figure 2-6. DataBaseRetrieve and DataBaseProcess Sample Call


Flow

For a sample call flow that incorporates the DataBaseRead and


DataBase Edit forms in an application, refer to page 2-7.

Preliminary Edition Defining the Database Forms 2-15


Defining a Menu The Menu form provides options to the caller. For example, a Menu
form is used when a caller dials into the InterSoft system to update a
value in the system database.

In this example, the application greets the caller and then prompts the
caller to choose an option from the menu.

To add a Menu form to an application, follow these steps:

1 Add a new Menu form icon to the beginning of the call flow in the
application.

2 Double-click the icon to open the Menu form.

A sample Menu form is shown below:

2-16 ODBC Database Interface Developer’s Guide Preliminary Edition


Sample Call Flows

3 Define the Menu form to greet the caller and then prompt the caller
to choose an option from the menu.

d In the Prompt field, enter the message number or text that


prompts the caller to choose an option.

e In the Enable mask field, assign each menu option to a number


or character on the touchtone keypad, or enter an expression to
calculate the enable mask.

f In the ID field, assign an identification letter (A-Z) to each menu


option.

g In the Play field, enter the number of the message that


corresponds to each menu option.

h In the Message Text (Optional) field, enter the message text that
corresponds to each menu option.

i In the Label (optional) field, enter the label to be displayed


beside the menu option on the call flow diagram.

4 Save and exit the form.

Preliminary Edition Defining the Database Forms 2-17


Altering Data When a caller dials into the InterSoft system to update a value in the
system database, an AskForNumber form requests information from the
caller. In this example, the application prompts the caller to enter a new
value for a stock price in the database.

To modify data in an application, follow these steps:

1 Add a new AskForNumber form icon to the application call flow to


prompt the caller to enter the new stock price.
A variable name is
case-sensitive, must 2 Double-click the icon to open the AskForNumber form.
start with a letter, and
cannot contain spaces. A sample AskForNumber form is shown below:
For example, number,
Number, and NUMBER
represent three different
valid names.

3 Define the AskForNumber form to prompt the caller to enter the


new price.

a In the Prompt field, enter the message number or text that


prompts the caller to enter the new price.

b In the Minimum length field, enter the minimum length allowed


for the new stock price.

c In the Maximum length field, enter the maximum length allowed


for the new stock price.

2-18 ODBC Database Interface Developer’s Guide Preliminary Edition


Sample Call Flows

d From the If star (*) pressed during input then list, select Treat
star as a decimal point.

e In the Assign result to field, enter AFNPrice to assign the new


stock price to the AFNPrice variable.

4 Save and exit the form.

5 Add a DataBaseEdit form icon to the application call flow. It uses


the AFNPrice variable to update the column in the database table.

6 Double-click the icon to open the DataBaseEdit form.

A sample DataBaseEdit form is shown below:

7 Define the DataBaseEdit form to update the ODBC_DB database


with data from the CURRENT_QUOTE column in the PRICES table
where STOCK_NAME is ABC Corp. The data inserted into this
column is the data assigned to the AFNPrice variable.

In the Query field, enter the query to update the information in the
database. In this example, the following query updates the
ODBC_DB database with the stock price for ABC Corp.:

For more information 'UPDATE PRICES SET CURRENT_QUOTE = ', (AFNPrice quoted),'
about entering queries on WHERE STOCK_NAME= ', ('ABC Corp.' quoted)
the DataBaseEdit form,
refer to “Database Query This is assigned to the AFNPrice variable on the AskForNumber
Reference,” Chapter 3.
form, as described in step e above.

Preliminary Edition Defining the Database Forms 2-19


Retrieving Data When a caller dials into the InterSoft system to request the latest value
in the system database, a DataBaseRead or a DataBaseRetrieve form
retrieves the information from the system’s database.

In this sample, the caller requests the latest stock price from the
application using a DataBaseRetrieve form.

1 Add a DataBaseRetrieve form icon to the application call flow.

2 Double-click the icon to open the DataBaseRetrieve form.

A sample DataBaseRetrieve form is shown below:

For more information


about using the
DataBaseRetreive form,
see the InVision
Reference Guide.

3 Define the DataBaseRetrieve form.

a In the Database name field, enter the name of the database alias
from dbconf.dat. In this example, it is ODBC_DB.

b Enter the query in the Query field that is to retrieve the stock
price from the database. In this example, the following query
retrieves the stock price from the ODBC_DB database:

SELECT STOCK_NAME, CURRENT_QUOTE FROM PRICES

c In the Database result field, enter the name of the result


variable. This example uses myResult. This value will be
passed to the DataBaseRetrieve form.

4 Save and exit the form.

5 Add a DataBaseProcess form to the application call flow.

2-20 ODBC Database Interface Developer’s Guide Preliminary Edition


Sample Call Flows

6 Double-click the icon to open the DataBaseProcess form.

A sample DataBaseProcess form is shown below:

7 Define the DataBaseProcess form.

a In the Database data source field, enter the same result variable
as entered in the DataBaseRetrieve form in step 3 on page 2-20.
This example uses the myResult variable.

b Select Release Data.

c In the Column name field, enter CURRENT_QUOTE; and in the


Assign to field, enter D_Price. Optionally, enter a description in
the Comment field.

The DataBaseProcess form extracts the CURRENT_QUOTE from


the result (myResult) and assigns it the D_Price variable.

d Select First from the Execute rows list, and enter 20 in the First
field. (The first 20 rows are executed.)

8 Save and exit the form.

9 Add a Play form icon to the application call flow. This form plays
the stock price to the caller.

Preliminary Edition Defining the Database Forms 2-21


10 Double-click the icon to open the Play form.

A sample Play form is shown below:

11 Define the Play form.

a In the Play mode field, select KeyOver from the list.

b In the first line of the Format field, enter the message number
501; and in the Value field, enter the message text The current
price is....

c In the second line of the Format field, select Monetary from the
list; and in the Value field, enter the variable name D_Price.

The InterSoft system accesses this Play form, which plays the stock
price (CURRENT_QUOTE) assigned to the D_Price variable on the
previous DataBaseProcess form.

Assigned Form Variables


The data assigned to the form variables can be
referenced by other forms. For example, the data
assigned to the D_Price variable can be played to callers
as specified on the Play form.

12 Save and exit the form.

2-22 ODBC Database Interface Developer’s Guide Preliminary Edition


3

In this chapter... Database Query Reference


▼ Using Queries, 3-2
This chapter provides guidelines for formatting queries as well as
▼ Supported Command descriptions and examples of specific queries. It serves as a
Functions, 3-3
reference for entering queries in the DataBaseEdit, DataBaseRead,
▼ Formatting Queries, 3-4 and DataBaseRetrieve forms.
▼ Sample Queries, 3-7
This chapter lists some of the principal SQL commands supported
▼ Using Escape
Sequences, 3-26 by the DataBaseEdit, DataBaseRead, and DataBaseRetrieve
forms.
▼ Defining Stored
Procedures, 3-28

3-1
Using Queries
Queries or SQL statements are used on the DataBaseEdit,
DataBaseRead, and DataBaseRetrieve forms. You can alter data in a
database table by inserting, updating, or deleting records in the
DataBaseEdit form.
For more information
about SQL commands,
refer to any SQL
manual.
Access Rights for Altering ODBC Database Tables
For the supported SQL
commands, see A user must be assigned at least one of the following
page 3-3. access rights in order to insert, update, or delete data in
a database table:
• Database administrator authority (DBA) in the database
• Control privileges for inserting, updating, or deleting
data in the table

A query entered in the Query field on the DataBaseEdit form determines


what information is altered in a specified database. To change the query
field to a formula in the DataBaseEdit form, right-click the field and
select Convert Into A Formula from the list. For information on
For information about formatting queries, refer to page 3-4.
these forms, refer to the
InVision Reference
Guide.
The DataBaseRead and the DataBaseRetrieve forms can be used to
retrieve data from all records in a table or from a specific group of
records. A select group of records can be retrieved based on specified
field values or variables from other forms. Data retrieved from columns
in a database table is assigned to variables specified on the
DataBaseRead and the DataBaseProcess forms. For more information
on using variables in the DataBaseRead and the DataBaseRetrieve
forms, see “Defining the Database Forms,” Chapter 2.

A query entered in the Query field on the DataBaseRead or the


DataBaseRetrieve form determines the information that is retrieved
from a database and from which records the data is retrieved. By default,
the Query field contains the following query:

'SELECT * FROM. . .WHERE. . .'

This query must be modified to retrieve records successfully. For


information on formatting queries, refer to page 3-4.

3-2 ODBC Database Interface Developer’s Guide Preliminary Edition


Supported Command Functions

Supported Command Functions


The DataBaseEdit, DataBaseRead, and DataBaseRetrieve forms
support SQL command functions that retrieve data in table form.
Depending on the driver, the DataBaseEdit, DataBaseRead, and
DataBaseRetrieve forms may or may not support the following
These functions are functions:
maintained by the ODBC
drivers that support Core • SUM
SQL grammar, as defined
by the ISO SQL-92
• MIN
standard. • MAX
• AVG
• DISTINCT
• COUNT

Workaround for the COUNT Function


If the COUNT function is not supported by the ODBC
driver being used, use the following workaround. The
COUNT function indicates the number of rows affected by
a query. Although this function is not supported by the
DataBaseRead or the DataBaseRetrieve form, this data
can be returned to a variable defined by the user on the
DataBaseRead or DataBaseRetrieve form.
For more information, refer to the InVision Reference
Guide.

All other SQL commands described in this chapter are supported by the
DataBaseEdit, DataBaseRead, and DataBaseRetrieve forms.

Preliminary Edition Database Query Reference 3-3


Formatting Queries
Queries consist of SQL commands and command options. Query
command line parameters include column and table names, and can
include field values. The number, order, and type of command line
parameters can vary with each query.

The general format of a query is shown below. In the following sample


format, required parameters are listed in braces ({}) and optional
parameters in brackets ([ ]).

{Command}{Column}{Table}[Column][Command Option][Field Value]

The command line parameters are described below:

{Command}
Specifies the type of action to be performed, such as SELECT,
INSERT, UPDATE, or DELETE.

{Column}
Specifies the column or field from which to retrieve or alter data.
Multiple columns can be listed.

{Table}
Specifies the database table from which to retrieve or alter data.

[Column]
Specifies an additional column or field to be examined when a
command option is used. Multiple columns can be listed.

[Command Option]
Specifies the criteria that data must meet in order to be retrieved or
altered. The WHERE and DISTINCT command options are described in
this chapter.

[Field Value]
Specifies the value to be inserted when a field is created or updated.
This parameter can also be used to specify search criteria. The field
value can be a specific value or a variable from another InVision
form. Multiple field values can be listed.

3-4 ODBC Database Interface Developer’s Guide Preliminary Edition


Formatting Queries

Table 3-1 provides formatting guidelines to use when creating queries.


A sample query that uses these guidelines is on page 3-6. All the
sample queries in this chapter follow these formatting guidelines.
Table 3-1. Query Formatting Guidelines

Description Guideline
Spaces Enter a space between command line
parameters. The parameters are listed on
page 3-4.

Case-sensitivity Enter SQL commands and command options in


uppercase. Column and table names are not
case-sensitive.

Single quotation marks Enclose character strings in single quotation


marks (’ ’).

Commas Enter a comma between column names.

Formatting variables Enclose the portion of the query preceding the


variable in quotation marks if the query uses a
variable. The quotation marks identify the
variable as a character string.
Place a comma between the quoted portion and
the variable to concatenate the character string
with the variable.
Insert the quoted operator after a variable that
accesses a field defined as the character data
type. The quoted operator places quotation
marks around the variable data.
Insert the printString operator after a variable
that accesses a field defined as the integer data
type. The printString operator enables an
integer to be read as a character string.

Preliminary Edition Database Query Reference 3-5


A sample query that uses the formatting guidelines in Table 3-1 on
page 3-5 is shown below. This query is made up of a character string, a
set of variables, and a second character string. The formatting of the
query is described in detail following this sample.

'SELECT PERSONNEL_ID, DEFER_RATE FROM ACC_INFO WHERE


PLAN_ID IN (',planOne printString,,planTwo
printString,,planThree printString,')'

'SELECT PERSONNEL_ID, DEFER_RATE FROM ACC_INFO WHERE


PLAN_ID IN (',
The first character string, or the portion of the query preceding the
variable set, is enclosed in single quotation marks. A comma is
placed between the quoted portion and the variable set. A comma is
also inserted between the two column names (PERSONNEL_ID and
DEFER_RATE).

planOne printString,,planTwo printString,,planThree


printString,
The variable set lists three variables (planOne, planTwo, and
planThree). Since these variables are assigned to integer type
fields, they are followed by the printString operator. The
variables are delimited by double commas, which the form
interprets as a single comma between the variables. Place a comma
at the end of the variable set to separate the variables from the
remainder of the query.

')'
Since the third portion of this query is a character string, it is
enclosed in single quotation marks.

If the planOne variable equals 1, planTwo equals 2, and planThree


equals 3, this query would be interpreted as follows:

SELECT PERSONNEL_ID, DEFER_RATE FROM ACC_INFO


WHERE PLAN_ID IN (1, 2, 3)

The SELECT command and WHERE command option are described in


Table 3-2 on page 3-7, and the IN command operator is described in
Table 3-5 on page 3-10.

3-6 ODBC Database Interface Developer’s Guide Preliminary Edition


Sample Queries

Sample Queries
This topic discusses basic SQL commands and includes examples of
queries that use these commands. Some commands, such as SELECT, can
be used along with other commands in queries that both retrieve and
alter data. These commands can be used in queries on the DataBaseEdit,
DataBaseRead, DataBaseProcess, and DataBaseRetrieve forms.

Table 3-2 lists the SQL commands described in this chapter. This table
briefly describes each command, and lists the forms in which each
command is commonly used. The following table also lists the pages in
this chapter where information about each command can be found:
Table 3-2. SQL Commands and Application Forms

SQL Command Description Form Refer to


SELECT Retrieves data DataBaseRead page 3-9
from all records in DataBaseRetrieve
a table

SELECT WHERE Retrieves data DataBaseRead page 3-10


from specific DataBaseRetrieve
records in a table

SELECT DISTINCT Retrieves unique DataBaseRead page 3-18


data from a table DataBaseRetrieve

INSERT SELECT Inserts records DataBaseEdit page 3-19


into a table DataBaseProcess

UPDATE WHERE Updates records in DataBaseEdit page 3-22


a table DataBaseProcess

DELETE WHERE Deletes records DataBaseEdit page 3-24


from a table DataBaseProcess

Preliminary Edition Database Query Reference 3-7


Defining Column Names

The limit for database column names is 30 characters. Therefore, when


a column name exceeds the 30-character limit, it must be given an alias
that is used when the result set is returned. You can use the
DataBaseRead and DataBaseRetrieve forms to construct an SQL query
statement that assigns an alias to a column name.

The sample column name, SUPEREXTREMELY_LONG_COLUMN_NAME,


exceeds 30 characters, as shown in the following SQL statement:

SELECT SUPEREXTREMELY_LONG_COLUMN_NAME FROM


FICTITIOUS_TABLE WHERE
SUPEREXTREMELY_LONG_COLUMN_NAME=’SAMPLE’

The following example demonstrates using SHORTER_COLUMN_NAME


instead of SUPEREXTREMELY_LONG_COLUMN_NAME:

SELECT SUPEREXTREMELY_LONG_COLUMN_NAME AS
"SHORTER_COLUMN_NAME"FROM FICTITIOUS_TABLE WHERE
SAMPLE_COLUMN_NAME=’SAMPLE’

The Column name field holds the name of the specific column of the
table from which to retrieve the data. When using an alias for the
column name in the SQL statement, also use this alias in the Column
name field.

An SQL statement on a DataBaseRead form is shown below:

Column
name alias

Figure 3-1. SQL Statement on a DataBaseRead Form

3-8 ODBC Database Interface Developer’s Guide Preliminary Edition


Sample Queries

Defining the SELECT Command


The SELECT SQL command is used to retrieve data from a database
table. This command can retrieve data from specific columns or from all
columns in a row. When it is used without a command option, SELECT
retrieves data from all rows in a table.
When you retrieve data
from a database with a The following table provides a sample database. The queries in
large number of records Table 3-4 refer to the sample database table in Table 3-3.
or rows, use the WHERE
command option to Table 3-3. ACC_INFO Sample Database Table
retrieve data only from
the necessary records or Table Name: ACC_INFO
rows. For more
information, refer to PLAN PERSONNEL STATE DEFER ENROLL
page 3-10. _ID _ID _ID _RATE _DATE
Record 1 12345 12345678 TX 5.01 01-01-1995

Record 2 (null) 12345600 CT 5.00 06-01-1994

Record 3 67896 00238759 CT 6.82 10-15-1994

Record 4 92847 57837892 NC 3.74 05-03-1996

The following table lists examples of queries that use the SELECT
command to retrieve specific data from all rows in a table:
Table 3-4. SELECT Commands

SELECT Command
Retrieve specific columns from a table.

Description: SELECT {Columns} FROM {Table}

Example: SELECT PLAN_ID, PERSONNEL_ID FROM ACC_INFO

Data Retrieved: 12345 12345678


(null)12345600
67896 00238759
92847 57837892

Retrieve all data in a table.


Description: SELECT * FROM {Table}
The * wildcard is used in place of a specific column name
and retrieves all data in all rows.

Example: SELECT * FROM ACC_INFO

Data Retrieved: 12345 12345678 TX 5.01 01-01-1995


(null) 12345600 CT 5.00 06-01-1994
67896 00238759 CT 6.82 10-15-1994
92847 57837892 NC 3.74 05-03-1996

Preliminary Edition Database Query Reference 3-9


Defining the WHERE Command

The WHERE command option is used with the SELECT command to enter
search criteria in a query. WHERE specifies the conditions that a row must
meet to be selected for access. If you do not use the WHERE command
option in a query, you can access data in every row of a table.

The WHERE command operators listed in Table 3-5 below define search
criteria in queries. Examples of the command operators used in queries
are listed in Table 3-9 on page 3-15.
Table 3-5. WHERE Command Operators

Operator Description
= Selects records containing a field value equal to a specified
condition.

!= Selects records containing a field value not equal to a


specified condition.

> Selects records containing a field value greater than a


specified condition.

>= Selects records containing a field value greater than or equal


to a specified condition.

< Selects records containing a field value less than a specified


condition.

<= Selects records containing a field value less than or equal to a


specified condition.

AND Selects records that satisfy multiple specified conditions.

OR Selects records that satisfy one of several specified


conditions.

NOT Selects records that satisfy an equality or inequality


condition.

IS NOT Selects records that satisfy the opposite of a specified


condition.

BETWEEN Selects records containing a field value within a range of


specified conditions.

IN Selects records containing a field value equal to one of


several values listed.

3-10 ODBC Database Interface Developer’s Guide Preliminary Edition


Sample Queries

Table 3-5. WHERE Command Operators (continued)

Operator Description
IS NULL Selects records in which a specified field value is null. Null
occurs where no value is entered or where the value is
specifically set to null. Null should not be confused with the
following field values:
• A numeric value of 0
• A character string of all blanks
• A character string of length 0
• The NULL character string

LIKE Selects records containing a specific character string in a


column. The percent (%) or underscore (_) wildcard can be
used before or after the field value in the query statement.
These wildcards can be used together, one immediately
before and one after the field value. These wildcards are
described below:
• % searches for characters anywhere within a string by
ignoring zero or more characters.
• _ searches for characters near the beginning or end of a
string by ignoring one character.

Preliminary Edition Database Query Reference 3-11


AND/OR Command Table 3-6 lists formatting guidelines for the AND/OR command operator.
Operator Guidelines Examples of queries formatted with some of these guidelines follow the
table.

Table 3-6. AND/OR Command Operator Guidelines

Description Guideline
Parentheses • When using both AND and OR clauses in a query, enclose
one or both of the clauses in parentheses to ensure the
expression is clear.
• When more than one level of parentheses is used, the
condition is evaluated from the innermost pair of
parentheses outward, as in algebraic expressions.
• When parentheses are used, all conditions connected by
AND are evaluated before the conditions connected by
OR.

Quotation marks • When using a text variable and a literal text string as
search criteria in an AND/OR clause, enclose both the
text variable and literal text string in quotation marks.
Enclose the text variable in quotation marks with the
quoted string operator.

Both AND and OR clauses are used in the following query. Only one of
these clauses is enclosed in parentheses. The database is first searched
based on the DEFER_RATE and STATE_ID criteria. If a record does not
meet the specified criteria, the database searches for records based on
the ENROLL_DATE criterion.

'SELECT PLAN_ID, PERSONNEL_ID FROM ACC_INFO WHERE


(DEFER_RATE > 0.05 AND STATE_ID='CT') OR ENROLL_DATE
BETWEEN '01-01-1992' AND '01-31-1992' '

In the following query, both a literal text string and a variable are used
as search criteria in the same AND clause. Both the text string,
01-01-1992, and the today_date variable are enclosed in quotation
marks. The variable is placed in quotation marks because it is followed
by the quoted string operator.

'SELECT PLAN_ID, PERSONNEL_ID FROM ACC_INFO WHERE


(DEFER_RATE > ',calRate printString, 'AND STATE_ID=',
getState quoted, ')', 'OR ENROLL_DATE BETWEEN "01-01-1992"
', 'AND', "today_date" quoted

3-12 ODBC Database Interface Developer’s Guide Preliminary Edition


Sample Queries

In this query, if the calRate variable is set to 0.05, getState is TX,


and today_date is 03-06-1994, the statement is interpreted as shown
below:

SELECT PLAN_ID, PERSONNEL_ID FROM ACC_INFO WHERE


(DEFER_RATE > 0.05 AND STATE_ID="TX") OR ENROLL_DATE
BETWEEN "01-01-1992" AND "03-06-1994"

IN Command Table 3-7 lists formatting guidelines for the IN command operator. An
Operator Guidelines example of a query formatted using some of these guidelines follows the
table.

Table 3-7. IN Command Operator Guidelines

Description Guideline
Parentheses Enclose the set of values in parentheses.

Commas Separate each entry in the set of values from the next with a
comma. Spaces can be used after the commas in the set.

Double Insert double commas between a literal text string and a


commas variable in the set of values.

The following query includes literal text strings and a variable in the set
of values. The variable in the set (stateID quoted) is surrounded by
double commas.

'SELECT PERSONNEL_ID, DEFER_RATE FROM ACC_INFO WHERE


STATE_ID IN ("CT"',,stateId quoted,,' "OK") '

If the stateID variable is set to TX, the query is interpreted as shown


below:

SELECT PERSONNEL_ID, DEFER_RATE FROM ACC_INFO WHERE


STATE_ID IN ("CT", "TX", "OK")

Preliminary Edition Database Query Reference 3-13


LIKE Command The following table lists formatting guidelines for the LIKE command
Operator Guidelines operator:

Table 3-8. LIKE Command Operator Guidelines

Description Guideline
Single quotation marks The field value immediately following the
LIKE command operator must always be
enclosed in single quotation marks, unless the
field value is a variable from another form.
Case-sensitivity Field values in single quotes are case-sensitive.
For example, the '_IL%' field value will not
select records that include William in the
specified column. However, this command will
select records that include WILLIAM in the
column.

Valid Columns for the LIKE Command Operator


The LIKE command operator can be used only with
character type columns or data fields.

3-14 ODBC Database Interface Developer’s Guide Preliminary Edition


Sample Queries

WHERE Command Table 3-9 lists examples of queries that use the SELECT command along
Option Examples with the WHERE command option to retrieve field values from specific
records. The sample queries listed in the following table refer to the
database table in Table 3-3 on page 3-9:
Table 3-9. Retrieving Data from Specific Records

SELECT WHERE Command


Retrieve specific columns from rows in which a field value meets a specific
criterion.

Description: SELECT {Columns} FROM {Table} WHERE [Column] =


[Field Value]

Example: SELECT PLAN_ID, PERSONNEL_ID, DEFER_RATE FROM


ACC_INFO WHERE PERSONNEL_ID = 12345678

Data Retrieved: 12345 345678 501

Retrieve specific columns from rows in which a field value is equal to or greater
than specified criteria.
Description: SELECT {Columns} FROM {Table} WHERE [Column] >
[Field Value] AND [Column] = [Field Value]

Example: SELECT PLAN_ID, PERSONNEL_ID FROM ACC_INFO


WHERE DEFER_RATE > 0.05 AND STATE_ID='CT'

Data Retrieved: (null) 12345600


67896 00238759

Retrieve specific columns from rows in which a field value is equal to that of a
specified form variable.

Description: SELECT {Columns} FROM {Table} WHERE [Column] = [Field


Value]
Example: 'SELECT PLAN_ID, PERSONNEL_ID, DEFER_RATE
FROM ACC_INFO WHERE PERSONNEL_ID=', pin_no
In this example, the pin_no variable is equal to 00238759.

Data Retrieved: 67896 00238759 6.82

Retrieve specific columns from rows in which a field value is greater than or equal
to a specified form variable.

Description: SELECT {Columns} FROM {Table} WHERE [Column] >=


[Field Value]

Example: 'SELECT PLAN_ID, PERSONNEL_ID, DEFER_RATE


FROM ACC_INFO WHERE DEFER_RATE >=', calRate
printString
In this example, the calRate variable is greater than or
equal to 5.01.

Data Retrieved: 12345 12345678 5.01


67896 00238759 6.82

Preliminary Edition Database Query Reference 3-15


Table 3-9. Retrieving Data from Specific Records (continued)

SELECT WHERE Command


Retrieve specific columns from rows in which a field value is greater than and
equal to specified form variables.

Description: SELECT {Columns} FROM {Table} WHERE [Column]


>[Field Value] AND [Column] = [Field Value]

Example: 'SELECT PLAN_ID, PERSONNEL_ID FROM ACC_INFO


WHERE DEFER_RATE > ', calRate printString,
'AND STATE_ID=', getState quoted
In this example, the calRate variable is equal to 5.01 and
the getState variable is equal to CT.

Data Retrieved: 67896 00238759

Retrieve all columns from rows in which a field value is not null.

Description: SELECT * FROM {Table} WHERE [Column] IS NOT NULL

Example: SELECT * FROM ACC_INFO WHERE PLAN_ID IS NOT


NULL

Data Retrieved: 12345 12345678 TX 5.01 01-01-1995


67896 00238759 CT 6.82 10-15-1994
92847 57837892 NC 3.74 05-03-1996

Retrieve all columns from rows in which a field value is not equal to a specified
criterion.

Description: SELECT * FROM {Table} WHERE [Column]! = [Field


Value]

Example: SELECT * FROM ACC_INFO WHERE STATE_ID! = 'CT'

Data Retrieved: 12345 12345678 TX 5.01 01-01-1995


(NULL) 12345600 CT 5.00 06-01-1994
92847 57837892 NC 3.74 05-03-1996

Retrieve specific columns from rows in which a field value is the opposite of
multiple specified conditions.

Description: SELECT [Columns] FROM [Table] WHERE NOT {Field


Values}
Example: SELECT PLAN_ID, PERSONNEL_ID FROM ACC_INFO
WHERE NOT (DEFER_RATE > 5.05 AND
STATE_ID='CT')

Data Retrieved: 12345 12345678 TX 5.01 01-01-1995


92847 57837892 NC 3.74 05-03-1996

3-16 ODBC Database Interface Developer’s Guide Preliminary Edition


Sample Queries

Table 3-9. Retrieving Data from Specific Records (continued)

SELECT WHERE Command


Retrieve specific columns from rows in which a specified field value equals one of
several values.

Description: SELECT {Columns} FROM {Table} WHERE [Column] IN


[Field Value]
Example: SELECT PERSONNEL_ID, DEFER_RATE FROM ACC_INFO
WHERE STATE_ID IN ('CT','OK','CA')

Data Retrieved: 12345600 5.00


00238759 6.82

Retrieve all columns from rows in which a specified field value is null.

Description: SELECT * FROM {Table} WHERE [Column] IS NULL

Example: SELECT * FROM ACC_INFO WHERE PLAN_ID IS NULL

Data Retrieved: (null) 12345600 CT 5.00 06-01-1994

Retrieve specific columns in rows in which a field value begins with a specified
character.

Description: SELECT {Columns} FROM {Table} WHERE [Column] LIKE


[Field Value]

Example: SELECT PERSONNEL_ID, STATE_ID FROM ACC_INFO


WHERE STATE_ID LIKE 'T%'
In this example, the ‘%’ is a wildcard character that represents
any string that starts with ‘T.’

Data Retrieved: 12345678 TX

Preliminary Edition Database Query Reference 3-17


Defining the DISTINCT Command

Use the SELECT command together with the DISTINCT command option
to retrieve records that contain unique values in specified columns. If
the data is duplicated in a column, the duplicated value is retrieved only
once.

Table 3-10 lists an example of a query that uses the SELECT command
with the DISTINCT command option to retrieve records that contain
duplicate data. The sample query in the following table refers to the
database table in Table 3-3 on page 3-9:
Table 3-10. Retrieving Unique Records

SELECT DISTINCT Command


Retrieve unique data in a specified column.

Description: SELECT DISTINCT {Column} FROM {Table}

Example: SELECT DISTINCT (STATE_ID) FROM ACC_INFO

Data Retrieved: TX
CT
NC
Since CT is a duplicate field value, CT is retrieved only
once.

3-18 ODBC Database Interface Developer’s Guide Preliminary Edition


Sample Queries

Defining the INSERT Command

When tables are defined, they do not contain data. Use the INSERT
command to insert user-defined data or data from other tables.

The INSERT command is used with the VALUES command option to


insert user-defined values into specific columns in a record. To insert
data into specific columns, list the column names after the table name,
as shown in Table 3-11 on page 3-20. If columns are not specified, the
field values listed after the VALUES command option are inserted into
the columns in the order they appear in the query. The number of field
values in the list must equal the number of columns in the table.

Inserting Data with the VALUES Command Option


The data type of each value to be inserted must be
compatible with the data type of the field into which the
data is inserted.

To insert data from another table, use the INSERT command with the
SELECT command. The SELECT command is described on page 3-9.

Preliminary Edition Database Query Reference 3-19


Table 3-11 contains examples of the INSERT command used with the
VALUES command option and the SELECT command. The sample
queries listed in the following table refer to the database table in
Table 3-3 on page 3-9:
Table 3-11. INSERT Command

INSERT Command
Add a row to a table.
Description: INSERT INTO {Table} VALUES [Field Values]

Example: INSERT INTO ACC_INFO VALUES (12345, 12345678,


'TX', 5.01, 01-01-1999)
The specified field values are inserted into each column in
the row. The field values are inserted into columns in the
order they are listed.

Record 12345 12345678 TX 5.01 01-01-1999


Inserted:

Add a row to a table. Insert specific values for some columns.

Description: INSERT INTO {Table} [Columns] VALUES [Field Values]

Example: INSERT INTO ACC_INFO (PERSONNEL_ID, STATE_ID,


DEFER_RATE, ENROLL_DATE) VALUES (12345600,
'CT', 5.00, 06-01-1999)
If no field value is inserted into a column that is assigned the
no data required data type, a null value is inserted into the
column.

Record (null) 12345600 CT 5.00 06-01-1999


Inserted:

Insert from another table rows in which a specific field value is null. In the inserted
rows, insert data only in specified columns.

Description: INSERT INTO {Table} {Column} SELECT {Column} FROM


{Table}WHERE [Column] IS NULL

Example: INSERT INTO ADMIN(PIN_NO)SELECT PERSONNEL_ID


FROM ACC_INFO WHERE PLAN_ID IS NULL

Record 12345600
Inserted: In the new row, this value is added to the PIN_NO column in
the ADMIN table.

3-20 ODBC Database Interface Developer’s Guide Preliminary Edition


Sample Queries

Table 3-11. INSERT Command (continued)

INSERT Command
Insert variable data into a table.
Description: INSERT INTO {Table} VALUES [Field Values]

Example: 'INSERT INTO ACC_INFO VALUES (', pin_no


printString,,state quoted,,defer
printString,, date quoted, ')'
In this example, the pin_no variable is equal to 12345600,
state is equal to CT, defer is equal to 5.00, and date is
equal to 06-01-1999.

Record (null) 12345600 CT 5.00 06-01-1999


Inserted:

Preliminary Edition Database Query Reference 3-21


Defining the UPDATE Command

The UPDATE command locates a value in a specified field and replaces it


with new data. Since multiple records can contain the same value in a
field, several search criteria may be necessary to change a specific
record without affecting other records.

Table 3-12 lists examples of queries that use the UPDATE command to
update records. The sample queries listed in the following table refer to
the database table in Table 3-3 on page 3-9:
Table 3-12. UPDATE Command

UPDATE Command
Update a column in specific rows.

Description: UPDATE {Table} SET {Column}= [Field Value] WHERE


{Column} = [Field Value]

Example: UPDATE ACC_INFO


SET DEFER_RATE=DEFER_RATE+0.01
WHERE PLAN_ID=12345

Values 12345 12345678 TX 5.02 01-01-1995


Updated:

Update multiple columns in rows that contain a specified character string in a


column.

Description: UPDATE {Table} SET {Column}= [Field Value], {Column}


= [Field Value] WHERE {Column}= [Field Value]

Example: UPDATE ACC_INFO


SET DEFER_RATE=DEFER_RATE+0.01,
PLAN_ID=4545 WHERE PLAN_ID=12345

Values 4545 12345678 TX 5.02 01-01-1995


Updated:

Update multiple columns in rows that contain a specified variable in a column.

Description: UPDATE {Table} SET {Column} = [Field Value], {Column}


= [Field Value] WHERE {Column} = [Field Value]

Example: 'UPDATE ACC_INFO


SET DEFER_RATE=DEFER_RATE+0.01,
PLAN_ID=4545 WHERE PLAN_ID=', planNumber
In this example, the planNumber variable is equal to 92847.

Values 4545 57837892 NC 3.75 05-03-1996


Updated:

3-22 ODBC Database Interface Developer’s Guide Preliminary Edition


Sample Queries

Table 3-12. UPDATE Command (continued)

UPDATE Command
Update multiple columns in rows that contain a field value equal to a form
variable.

Description: UPDATE {Table} SET {Column} = [Field Values],


{Column}= [Field Value], WHERE {Column} = [Field
Value]

Example: 'UPDATE ACC_INFO


SET DEFER_RATE=DEFER_RATE+',
def_rate printString,, 'PLAN_ID=4545',
'WHERE PLAN_ID=', planNumber
In this example, the planNumber variable is equal to 67896
and the def_rate variable is equal to 0.10.
Values 4545 00238759 CT 6.92 10-15-1994
Updated:

Preliminary Edition Database Query Reference 3-23


Defining the DELETE Command

The DELETE command is used to delete records based on specified field


values. The DELETE command searches the table for a specific field
value and deletes any records that contain the value.

Use WHERE When Deleting Records


If the WHERE command option is not used with the DELETE
command to specify field values, all records in the table
are deleted.

Table 3-13 lists examples of queries that use the DELETE command to
delete specific records from a table. The sample queries listed in the
following table refer to the database table in Table 3-3 on page 3-9:
Table 3-13. DELETE Command

DELETE Command
Delete rows that contain specific data in a column.

Description: DELETE FROM [Table] WHERE {Column} = {Field Value}

Example: DELETE FROM ACC_INFO WHERE PERSONNEL_ID =


12345678

Records 12345 12345678 TX 5.01 01-01-1995


deleted:

Delete rows that contain specific data in multiple columns.

Description: DELETE FROM [Table] WHERE {Column} = {Field Value}


AND {Column} = {Field Value}

Example: DELETE FROM ACC_INFO WHERE PERSONNEL_ID =


00238759 AND PLAN_ID = 67896

Records 67896 00238759 CT 6.82 10-15-1994


Deleted:

Delete rows in which a field value is equal to a form variable.

Description: DELETE FROM [Table] WHERE {Column} = {Field Value}

Example: 'DELETE FROM ACC_INFO WHERE PERSONNEL_ID =',


pin_no
In this example, the pin_no variable is equal to 00238759.
Records 67896 00238759 CT 6.82 10-15-1994
Deleted:

3-24 ODBC Database Interface Developer’s Guide Preliminary Edition


Sample Queries

Table 3-13. DELETE Command (continued)

DELETE Command
Delete specific records based on multiple variables from other forms.
Description: DELETE FROM [Table] WHERE {Column} = {Field Value}
AND {Column} = {Field Value}

Example: 'DELETE FROM ACC_INFO WHERE PERSONNEL_ID =',


pin_no, 'AND PLAN_ID =', plan_no printString
In this example, the pin_no variable is equal to 00238759,
and the plan_no variable is equal to 67896.

Records 67896 00238759 CT 6.82 10-15-1994


Deleted:

Preliminary Edition Database Query Reference 3-25


Using Escape Sequences
An ODBC Database interface escape sequence allows an application to:
• Access stored procedures.
• Access multiple result sets.
• Direct a series of queries to be performed on a single database
server in a replicated database environment.
• Dynamically disable the automatic failover facility.

The escape sequence mechanism consists of an escape sequence prefix


to the SQL statement. An escape sequence prefix must begin with
$$(line[n] and end with a close parenthesis, ), followed by the SQL
statement.

Bracketing
Bracketing results in the exclusion of subsequent
transactions from automatic failover and directs
subsequent transactions to the same database server.

Automatic failover is disabled for transactions that contain an escape


sequence that opens a bracket. The syntax for opening a bracket is as
follows:

$$(line[n] open_bracket) SQL statement


The escape sequence
must contain the line
number information. Once a bracket is open, the automatic failover is disabled for all
intermediate transactions. Intermediate SQL statements within an open
bracket, directed to the same server, must contain the following syntax:

$$(line[n]) SQL statement

A closed bracket enables the automatic failover once again. The syntax
for closing a bracket is as follows:

$$(line[n] close_bracket no_query)

The same escape mechanism is used to support the stored procedure


multiple result set feature used with InterVoice-Brite’s native drivers.

3-26 ODBC Database Interface Developer’s Guide Preliminary Edition


Using Escape Sequences

The syntax to access a stored procedure is as follows:

$$(line[n]procedure) StoredProcedureName

The syntax to retrieve the next result set from a previously executed
stored procedure is as follows:

$$(line[n]next_result no_query)

The syntax to clear the result sets that are still pending is as follows:

$$(line[n] clear_results no_query)

Automatic Failover

If a query to a database server fails, the system attempts an automatic


retry on another server selected from the current server resource group.
If the server resource group contains only one server, then an automatic
retry is not attempted.

Load Balance
Queries are balanced across database servers within a server resource
group. The server selection from a server resource group is based on a
round-robin selection algorithm. Each request for a server selection
from a server resource group provides the next server from the list of
For more information servers contained within that server resource group. Load balancing is
about automatic failover not based upon query complexity or database server loading.
and load balancing, refer
to the ODBC Database
Interface Administrator’s
Guide.

Preliminary Edition Database Query Reference 3-27


Defining Stored Procedures
Stored procedures are a collection of SQL statements that reside on a
database server and can be executed by any user who has been granted
appropriate permission. Stored procedures can accept input parameters.
They are executed faster than SQL commands with identical,
dynamically issued syntax. The stored procedures are processed more
quickly because they are precompiled and contain a query plan before
they are executed.

Stored Procedure Parameter Types


The ODBC Database interface supports stored
procedure input parameters but does not support output
parameters. Stored procedures may return data as result
set data.

The examples in this topic refer to the sample database tables in


Table 3-14 below and Table 3-15 on page 3-29.

Table 3-14. BASIC_INFO Sample Database Table

Table Name: BASIC_INFO

NAME_ID SS#_ID SALARY_ID

Record 1 John Doe 333224444 40000.00

Record 2 Jane Doe 111223333 80000.00

Record 3 Pat Smith 555112222 35000.00

Record 4 Chris Jones 888663333 90000.00

3-28 ODBC Database Interface Developer’s Guide Preliminary Edition


Defining Stored Procedures

Table 3-15. PERSONAL_INFO Sample Database Table

Table Name: PERSONAL_INFO

NAME_ID PERSONNEL_ID AGE_ID GENDER_ID


Record 1 John Doe 98981 35 Male

Record 2 Jane Doe 97972 29 Female

Record 3 Pat Smith 72722 32 Female

Record 4 Chris Jones 54321 40 Male

Stored procedures are supported by the ODBC Database interface and


may be used to initiate a transaction or perform a query. Stored
procedures can return result set types of No Result Set, Single Result
Set, or Multiple Result Set. Each set type is described beginning below:

No Result Set
No data is returned by the SQL query.

Single Result Set


One or more rows from one table are returned by the SQL query.

For example, the query is written to retrieve the name, Social


Security number, and salary of a specific employee. The single
result set would return the following information: John Doe,
333224444, 40000.00.

Multiple Result Set


Data is returned from two or more tables. Or different sets of data
from the same table are returned by the single SQL query (usually a
stored procedure).

For example, the query is written to retrieve the name, Social


Security number, salary, personnel identification, gender, and age of
an employee when only the last name is known. The multiple result
set would return the following information: John Doe, 333224444,
40000.00, 98981, M, 35 and Jane Doe, 111223333, 80000.00, 97972, F,
29.

Defined Escape Sequences


The multiple result set option uses the defined escape
sequences to switch between the returned responses.
See “Using Escape Sequences” on page 3-26.

Preliminary Edition Database Query Reference 3-29


Glossary

AskForNumber form
An InVision form that requests and collects caller input from a
touchtone keypad, speech, or computer keyboard. The application
stores this information in a variable for later use within the
application.

Clipper
A programming language and compiler. Clipper is a superset of
dBase III. It employs the basics of object oriented programming by
using built-in classes and replaceable database drivers. There is no
Windows version of Clipper, but many third-party products are
available to translate Clipper to Windows.

commit
An operation that successfully terminates a series of one or more
SQL statements. All database changes are permanently applied to
the database and are recognized by all users.

database
A collection of data structured by fields and records and organized
for quick information retrieval. Databases can consist of a single file
or multiple files. Multiple databases are related to each other by a
common field, such as employee number or Social Security number.
A database record is a complete entry that may include information
such as name, address, city, state, and zip code. A database field is
one element in the database record, such as address or zip code.

DataBaseEdit form
An InVision form that inserts, deletes, and updates records and
fields in a database.

Preliminary Edition Glossary-1


DataBaseProcess form
An InVision form that processes information retrieved by the
Database Retrieve form. This form is created during code generation
based on the input and output parameters of the Demo
TransactionSummary form. It is accessed from the green IO tab
page of the Palette.

DataBaseRead form
An InVision form that retrieves records or columns that meet the
search criteria.

DataBaseRetrieve form
An InVision form that retrieves information from a database. This
form is created during code generation based on the input and output
parameters of the Demo TransactionSummary form. It is accessed
from the green IO tab of the Palette.

DataBase Specific Client


A group of files generally supplied along with the database
management system that must be installed on the system. The
ODBC Database interface uses these files to access the information
stored on a database server.

dBASE
A database management system that began as Vulcan. Subsequent
versions with extra features became known as dBASE III,
dBASE III+, and dBASE IV. The dBASE data storage method is
now the standard among spreadsheets and database management
systems.

DB2
A family of relational database products offered by IBM. DB2
provides an open database environment that runs on a wide range of
platforms. A DB2 database can grow from a small single-user
application to a large multiuser system. DB2 databases are
accessible from any application program that uses an ODBC, JDBC,
or CORBA interface.

exclusive lock
A lock that is exclusive to the user who obtains it; one of the two
common locking modes employed by various databases. See also
shared lock.

grammar level
The grammar or commands supported by the various Open
DataBase Connectivity (ODBC) standard levels.

Glossary-2 ODBC Database Interface Developer’s Guide Preliminary Edition


HTTP (hypertext transfer protocol)
A protocol used for communication between a Web server and a
Web browser. HTTP specifies how messages are formatted and
transmitted, and it determines the actions Web servers and browsers
should take in response to various commands. For example, when a
user enters a URL in a browser, the browser sends an HTTP
command to the Web server directing it to download the requested
Web page.

Informix
A Relational Database Management System (RDBMS) that
incorporates 4GL database language into Standard Query Language
(SQL) in a database environment that residing in a networked
system.

Interprocess Exchange Process (IPX)


The process that is the focal point of runtime communication
between all processes. Whenever a process sends a message or
responds to another process, it must communicate through the
Interprocess Exchange Process (IPX).

InterSoft system
An automation solution for customer service applications. It
combines voice messaging, call processing, audiotex, speech
recognition, call directing, and interactive voice response. This
system is the interface between telephone callers and a host
computer, the Internet, a local area network (LAN), a wide area
network (WAN), or telecommunication network, and local or
remote databases. This interface allows any telephone in a home,
office, or phone booth—whether it is local or across the country—
to become a computer terminal. The telephone becomes the input
device (to enter requests), and the human voice becomes the output
(to provide requested information). The system can also act as the
dial-up gateway to connect personal computers and other data
terminals to remote computers.

InterSoft version 2
The core software program used to bring InVision applications into
runtime. InterSoft version 2 is designed to run on the Windows NT
operating system.

InterSoft version 3
The core software program used to bring InVision applications into
runtime. InterSoft version 3 is designed to run on the Windows NT
and Windows 2000 operating systems.

Preliminary Edition Glossary-3


InVision
The graphical development tool that is used to create applications
that run on InterSoft systems.

IQTalkD
The runtime engine that interprets the InVision application. It can
also interface with user-defined programs written in C language or
Assembly.

Isolation Level
A particular locking strategy employed in the database system to
improve data consistency.

IvIViews
The set of predefined InterSoft version 2 templates used to display
IVIDEPOT information in HTML format within a Web browser; a
general term for such templates.

key-value pair
A parameter used to build a connection string to the data source. The
keyword of a key-value pair is ODBC driver specific.

library file (.lib)


An InVision application file that consists of one or more
subroutines.

load balancing
A process by which servers equally distribute queries within a server
resource group.

locking
A database operation that prevents multiple users from modifying a
table or record at the same time.

Microsoft SQL Server


A distributed database management system from Microsoft that can
respond to queries formatted in the SQL language from client
machines. Connected workstations continually process and update
the data on the server, then the server calculates and coordinates any
changes that are necessary.

Microsoft Visual FoxPro


A tool for building database applications. FoxPro uses object-
oriented language to develop databases for desktop systems, for
client/server systems, and for the World Wide Web. It also employs
structured query language (SQL) to manipulate large amounts of
data.

Glossary-4 ODBC Database Interface Developer’s Guide Preliminary Edition


network client
The software that allows client workstations access to LAN facilities
such as network mass storage, database servers, or e-mail.

ODBC (Open DataBase Connectivity)


A specification for an application program interface (API) that
enables applications to access multiple database management
systems using standardized SQL grammar.

ODBC Driver
A driver program used by the ODBC Database interface to access
information stored on the database. Each driver provides the ability
to interface with a particular manufacturer’s database format.

ODBC Driver Manager


The module that supervises and controls the interaction between the
ODBC driver and the ODBC interface. ODBC drivers must be
registered with the Driver Manager to be used on the system.

OLE (Object Linking and Embedding)


A method of sharing information among applications. When an
object is linked to a compound object, such as a spreadsheet or a
document, the compound object contains only a reference to the
linked object. Changes made to the linked object are reflected in the
compound object. When an object is embedded in a compound
object, the compound object contains a copy of the embedded
object. Changes made to the embedded object are not seen in the
compound object.

Oracle
A principal manufacturer of database products. Oracle applications
are designed for high capacity workstations and servers. Oracle uses
structured query language (SQL), which is now the industry
standard.

Pervasive
Formerly Btrieve, one of the first database management systems
designed for LANs. Pervasive is a key-indexed record management
system. Records can be retrieved, inserted, updated, or deleted with
sequential or random access.

Play form
The InVision form that plays messages and calculated values to the
caller.

Preliminary Edition Glossary-5


query
An SQL command statement entered on the InVision DataBaseEdit
and DataBaseRead forms to alter or retrieve data in a database.

relational database
The type of database accessed through the ODBC Database
interface by SQL statements or stored procedures. A relational
database may contain several tables, all of which store related
information and common column names and can be linked by the
SQL join operation.

replicated database
A copy of the master database that resides on multiple servers.
When a change is made to one table in the master database, it is
automatically made to the remaining database copies on the other
servers.

rollback
An action that invalidates any database changes made by one or
more SQL statements.

shared lock
A type of lock that allows multiple users to access a single locked
object; one of two common locking modes employed by various
databases. See also exclusive lock.

SQL (Structured Query Language)


A function used to carry out database commands. See also query.

structure
A part of a database; a generalized programming concept that
describes collections of variables, arrays, etc. A database can consist
of one or more structures that are used to store, locate, and maintain
information.

subroutine
The portion of the InVision call flow that contains reusable forms.
It can be internal to a specific application or shared by other
applications through a subroutine library (.lib) file. InVision
subroutines can be local, callable, overwriting, and overwritable.
They support parameter passing and named returns, and can be
indirected.

subroutine library
See library file.

Glossary-6 ODBC Database Interface Developer’s Guide Preliminary Edition


subroutine page
The InVision application’s .app or .lib page view that contains icons
representing the call flow for a particular subroutine. A subroutine
page exists for each subroutine called and is listed by subroutine
name.

SubroutineCall form
The InVision form that transfers execution to the entry point defined
by the specified SubroutineEntry form name.

SubroutineEntry form
The InVision form that defines the entry point of the subroutine
along with information that defines parameters to the subroutine. It
is used only by the subroutine module.

SubroutineReturn form
The InVision form that stops execution of the SubroutineEntry
forms and returns control to the SubroutineCall form that invoked
the SubroutineEntry form. It is used only by the subroutine module.

Sybase
A client/server database management system that is widespread in
commercial and military applications.

Xbase
A programming language used for business applications in a
database environment. It is very similar to natural language English.
A command phrase begins with several key verbs that can be
followed by a clause containing a keyword. In some applications,
SQL commands may be used as well.

Preliminary Edition Glossary-7


Index

A Comment field 2-13, 2-21


ACC_INFO 3-9 commit, defined Glossary-1
Adobe Acrobat Reader ix company variable 2-13
AFNPrice variable 2-13 Connect Premium for DB2 (DRDA), supported
algorithms, load balancing 3-27 database 1-6
altering data, access rights 3-2 control privileges
AND/OR command operator guidelines delete 3-2
parentheses 3-12 insert 3-2
quotation marks 3-12 update 3-2
AskForNumber form, defined Glossary-1 conventions used in this manual xiii
audience for this manual vii Core Installation Documentation CD-ROM ix
automatic failover Core Product Documentation Guide ix
automatic retry 3-27 Core Software Documentation CD-ROM ix
bracketing 3-26 Core SQL grammar 3-3
escape sequence 3-26 customer support xiv

C D
caution note xiii data
CD-ROMs altering 2-10, 2-11, 2-18, 2-19
core hardware documentation ix retrieving 2-20
core software documentation ix database
Clipper, defined Glossary-1 access rights 3-2
column 1-4 alias 2-12, 2-20
Column name field 2-13, 2-21 defined Glossary-1
column names features 1-7
character limit 3-8 table 1-4
character limit exceeded, alias 3-8 database administrator authority (DBA) 3-2
command line parameters Database name field 2-12, 2-20
[Column] 3-4 DataBase Specific Client, defined Glossary-2
[Command Option] 3-4
[Field Value] 3-4
{Column} 3-4
{Command} 3-4
{Table} 3-4

Preliminary Edition Index-1


DataBaseEdit form 2-5 E
altering 2-10, 2-18 escape sequence 3-26
defined Glossary-1 exclusive locks, defined Glossary-2
formula 3-2
queries, using 3-2 F
Query field 3-2 features, ODBC 1-7
DataBaseProcess form 2-4 field 1-4
defined Glossary-2 fields
DataBaseRead form 2-6 Assign to 2-13, 2-21
Assign to field 2-13, 2-21 Column name 2-13, 2-21
Column name field 2-13, 2-21 Comment 2-13, 2-21
Comment field 2-13, 2-21 Database name 2-12, 2-20
defined Glossary-2 Execute rows 2-12, 2-21
defining 2-12 Format 2-14, 2-22
Execute rows field 2-12, 2-21 Play mode 2-14, 2-22
Literal Query checkbox 2-12 Query 2-12, 2-20, 3-2
queries, using 3-2 Value 2-14, 2-22
Query field 2-12, 2-20 figures, list of iii
retrieving 2-20 files
DataBaseRetrieve form 2-3 dbconf.dat, database alias 2-12, 2-20
defined Glossary-2 library, defined Glossary-4
defining 2-20 forms
queries, using 3-2 DataBaseEdit 2-5
databases supported DataBaseProcess 2-4
Connect Premium for DB2 (DRDA) 1-6 DataBaseRead 2-6
DB2 1-6 DataBaseRetrieve 2-3
Informix 1-6 Play 2-13, 2-21
Microsoft SQL Server 1-6
Oracle 1-6 G
Pervasive 1-6 general note xiii
Sybase 1-6 grammar level, defined Glossary-2
DB2 1-6
defined Glossary-2 I
supported database 1-6 IN command operator guidelines
dBASE, defined Glossary-2 commas 3-13
dbconf.dat, database alias 2-12, 2-20 double commas 3-13
DELETE command 3-24 parentheses 3-13
deleting data rows 3-24 information symbols used in this manual xiii
DISTINCT command 3-18 Informix 1-6
documentation defined Glossary-3
Core Product Documentation Guide ix supported database 1-6
InterVoice-Brite ix INSERT command 3-19
DRDA. see Connect Premium for DB2 Interprocess Exchange Process (IPX), defined
Glossary-3
InterSoft system, defined Glossary-3
InterSoft, defined Glossary-3

Index-2 ODBC Database Interface Developer’s Guide Preliminary Edition


InterVoice-Brite M
documentation ix manual reference xiii
technical support xiv Microsoft SQL Server
Web site ix defined Glossary-4
InVision supported database 1-6
defined Glossary-4 Microsoft Visual FoxPro, defined Glossary-4
forms multiple connections, licensing 1-4
AskForNumber 2-10, 2-18
DataBaseEdit 2-11, 2-19 N
DataBaseProcess 2-4 network client, defined Glossary-5
DataBaseRead 2-12 note boxes
DataBaseRetrieve 2-3, 2-20 caution xiii
defining the DataBaseRead form 2-12 general xiii
defining the DataBaseRetrieve form manual reference xiii
2-20 tip xiii
Menu 2-9, 2-17 warning xiii
Play 2-2, 2-13, 2-21
IQTalkD, defined Glossary-4 O
ISO SQL-92 standard 3-3 ODBC (Open DataBase Connectivity), defined
isolation level, defined Glossary-4 Glossary-5
IvIViews, defined Glossary-4 ODBC Database interface
concept diagram 1-3
K escape sequence
key-value pair, defined Glossary-4 access multiple result sets 3-26
access stored procedures 3-26
L direct queries to be performed 3-26
library file (.lib), defined Glossary-4 disable automatic failover 3-26
LIKE command operator features 1-7
guidelines ODBC Branded drivers, required platform
case-sensitivity 3-14 type 1-6
single quotation marks 3-14 ODBC Driver Manager, defined Glossary-5
valid columns 3-14 ODBC Driver, defined Glossary-5
list of figures iii ODBC supported
list of tables v Connect Premium for DB2 (DRDA) 1-6
Literal Query checkbox 2-12 DB2 1-6
load balancing 3-27 Informix 1-6
defined Glossary-4 Microsoft SQL Server 1-6
escape sequence 3-27 Oracle 1-6
locking, defined Glossary-4 Pervasive 1-6
Sybase 1-6
OLE (Object Linking and Embedding), defined
Glossary-5
Oracle
defined Glossary-5
supported database 1-6

Preliminary Edition Index-3


P S
Pervasive SELECT command 3-9
defined Glossary-5 shared lock, defined Glossary-6
supported database 1-6 SQL (Structured Query Language)
Play form 2-13, 2-21 automatic failover 3-26
defined Glossary-5 command functions 3-3
Format field 2-14, 2-22 AVG 3-3
Play mode field 2-14, 2-22 COUNT 3-3
Value field 2-14, 2-22 DISTINCT 3-3
price variable 2-14, 2-22 MAX 3-3
printString operator 3-5, 3-6 MIN 3-3
purpose of this manual vii SUM 3-3
command line parameters, query format 3-4
Q commands 3-2, 3-7
query DELETE WHERE 3-7
DataBaseEdit 2-11, 2-19 INSERT SELECT 3-7
defined Glossary-6 SELECT 3-7
format 3-4 SELECT DISTINCT 3-7
guidelines SELECT WHERE 3-7
case sensitivity 3-5 UPDATE WHERE 3-7
commas 3-5 COUNT function, workaround 3-3
formatting variables 3-5 defined Glossary-6
single quotation marks 3-5 escape sequences 3-26
spaces 3-5 load balance 3-27
statement, default 3-2 query strings 2-2
quoted operator 3-5 SELECT command 3-9
stored procedures
R described 3-28
RealCare xiv input parameters 3-28
record 1-4 supported
relational database, defined Glossary-6 multiple result set 3-29
replicated database, defined Glossary-6 no result set 3-29
retrieving data 3-2 single result set 3-29
default query statement 3-2 structure (database), defined Glossary-6
rollback, defined Glossary-6 subroutine library. see library file
row 1-4 subroutine page, defined Glossary-7
subroutine, defined Glossary-6
SubroutineCall form, defined Glossary-7
SubroutineEntry form, defined Glossary-7
SubroutineReturn form, defined Glossary-7
Sybase
defined Glossary-7
supported database 1-6

Index-4 ODBC Database Interface Developer’s Guide Preliminary Edition


T X
tables, list of v Xbase, defined Glossary-7
technical support xiv
tip xiii

U
UPDATE 3-22
updating data rows 3-22

V
variables 2-2
AFNPrice 2-13
calRate 3-13
company 2-13
double comma delimitation 3-6
planOne 3-6
planThree 3-6
planTwo 3-6
price 2-13, 2-14, 2-22
stateID quoted 3-13

W
warning note xiii
Web site, InterVoice-Brite ix
WHERE command 3-10
deleting data rows 3-24
inserting values 3-19
operators 3-10
[ 3-10
[!=] 3-10
[=] 3-10
[>=] 3-10
[>] 3-10
AND 3-10
BETWEEN 3-10
IN 3-10
IS NOT 3-10
IS NULL 3-11
LIKE 3-11
NOT 3-10
OR 3-10
retrieving data 3-15
updating records 3-22
using AND/OR command 3-12
using IN command 3-13
using LIKE command 3-14

Preliminary Edition Index-5

You might also like