Manual Informix 10
Manual Informix 10
Manual Informix 10
Version 10.0/8.5
G251-2277-00
DB2 IBM Informix
®
Version 10.0/8.5
G251-2277-00
Note!
Before using this information and the product it supports, read the information in “Notices” on page D-1.
Notices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . D-1
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . X-1
Contents v
vi IBM Informix DB-Access User’s Guide
Introduction
About This Manual . . . . . . . . . . . . . . . . . . . . . . . . . . . . vii
Types of Users . . . . . . . . . . . . . . . . . . . . . . . . . . . . . viii
Software Dependencies . . . . . . . . . . . . . . . . . . . . . . . . . . viii
Assumptions About Your Locale . . . . . . . . . . . . . . . . . . . . . . . viii
New Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ix
Documentation Conventions . . . . . . . . . . . . . . . . . . . . . . . . . ix
Typographical Conventions . . . . . . . . . . . . . . . . . . . . . . . . . ix
Feature, Product, and Platform . . . . . . . . . . . . . . . . . . . . . . . . x
Syntax Diagrams . . . . . . . . . . . . . . . . . . . . . . . . . . . . xi
How to Read a Command-Line Syntax Diagram . . . . . . . . . . . . . . . . xii
Keywords and Punctuation . . . . . . . . . . . . . . . . . . . . . . . xiii
Identifiers and Names . . . . . . . . . . . . . . . . . . . . . . . . . xiv
Example Code Conventions . . . . . . . . . . . . . . . . . . . . . . . . xiv
Additional Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . xv
Installation Guides . . . . . . . . . . . . . . . . . . . . . . . . . . . xv
Online Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xv
Locating Online Notes . . . . . . . . . . . . . . . . . . . . . . . . . xvi
Online Notes Filenames . . . . . . . . . . . . . . . . . . . . . . . . xvii
Informix Error Messages . . . . . . . . . . . . . . . . . . . . . . . . . xvii
Manuals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xviii
Online Manuals . . . . . . . . . . . . . . . . . . . . . . . . . . . xviii
Printed Manuals . . . . . . . . . . . . . . . . . . . . . . . . . . . xviii
Online Help . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xviii
Accessibility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xviii
IBM Informix Dynamic Server Version 10.0 and CSDK Version 2.90 Documentation Set . . . . . xviii
Compliance with Industry Standards . . . . . . . . . . . . . . . . . . . . . . xxi
IBM Welcomes Your Comments . . . . . . . . . . . . . . . . . . . . . . . . xxii
In This Introduction
This introduction provides an overview of the information in this manual and
describes the conventions it uses.
This manual assumes that you use the U.S. 8859-1 English locale as the
default locale. The default is en_us.8859-1 (ISO 8859-1) on UNIX platforms or
en_us.1252 (Microsoft 1252) for Windows environments. This locale supports
U.S. English format conventions for dates, times, and currency, and also
supports the ISO 8859-1 or Microsoft 1252 code set, which includes the ASCII
code set plus many 8-bit characters such as é, è, and ñ.
New Features
For a comprehensive list of new features for your database server, see the
IBM Informix: Getting Started Guide.
Documentation Conventions
This section describes the conventions that this manual uses. These
conventions make it easier to gather information from this and other volumes
in the documentation set.
Convention Meaning
KEYWORD All primary elements in a programming language statement
(keywords) appear in uppercase letters in a serif font.
italics Within text, new terms and emphasized words appear in italics.
italics Within syntax and code examples, variable values that you are to
italics specify appear in italics.
boldface Names of program entities (such as classes, events, and tables),
boldface environment variables, file and pathnames, and interface elements
(such as icons, menu items, and buttons) appear in boldface.
monospace Information that the product displays and information that you
monospace enter appear in a monospace typeface.
KEYSTROKE Keys that you are to press appear in uppercase letters in a sans serif
font.
Introduction ix
Convention Meaning
> This symbol indicates a menu item. For example, “Choose Tools >
Options” means choose the Options item from the Tools menu.
Dynamic Server
UNIX Only
Windows Only
This markup can apply to one or more paragraphs within a section. When an
entire section applies to a particular product or platform, this is noted as part
of the heading text, for example:
Table Sorting (Linux Only)
Introduction xi
Component represented in PDF Component represented in HTML Meaning
---+------------------+--- Optional items with choice
+--FOR UPDATE-----+ are shown below the main
’--FOR READ ONLY--’ line, one of which you
might specify.
.---NEXT---------. The values below the
----+----------------+--- main line are optional, one
+---PRIOR--------+ of which you might
’---PREVIOUS-----’ specify. If you do not
specify an item, the value
above the line will be used
as the default.
.-------,-----------. Optional items. Several
V | items are allowed; a
---+-----------------+--- comma must precede each
+---index_name---+ repetition.
’---table_name---’
-t table
(1)
Setting the Run Mode
-S server -T target
The second line in this diagram has a segment named “Setting the Run
Mode,” which according to the diagram footnote, is on page 17-4. This
segment is shown in the following segment diagram (the diagram uses
segment start and end components).
To construct a command correctly, start at the top left with the command.
Follow the diagram to the right, including the elements that you want. The
elements in the diagram are case sensitive.
Introduction xiii
shown in uppercase letters. When you use a keyword in a command, you can
write it in uppercase or lowercase letters, but you must spell the keyword
exactly as it appears in the syntax diagram.
You must also use any punctuation in your statements and commands exactly
as shown in the syntax diagrams.
The following syntax diagram uses variables to illustrate the general form of a
simple SELECT statement.
SELECT column_name FROM table_name
When you write a SELECT statement of this form, you replace the variables
column_name and table_name with the name of a specific column and table.
Example Code Conventions
Examples of SQL code occur throughout this manual. Except as noted, the
code is not specific to any single IBM Informix application development tool.
If only SQL statements are listed in the example, they are not delimited by
semicolons. For instance, you might see the code in the following example:
CONNECT TO stores_demo
...
COMMIT WORK
DISCONNECT CURRENT
To use this SQL code for a specific product, you must apply the syntax rules
for that product. For example, if you are using DB–Access, you must delimit
multiple statements with semicolons. If you are using an SQL API, you must
use EXEC SQL at the start of each statement and a semicolon (or other
appropriate delimiter) at the end of the statement.
Tip: Ellipsis points in a code example indicate that more code would be
added in a full application, but it is not necessary to show it to describe
the concept being discussed.
Additional Documentation
For additional information, refer to the following types of documentation:
v Installation guides
v Online notes
v Informix error messages
v Manuals
v Online help
Installation Guides
Installation guides are located in the /doc directory of the product CD or in
the /doc directory of the product‘s compressed file if you downloaded it from
the IBM Web site. Alternatively, you can obtain installation guides from the
IBM Informix Online Documentation site at
http://www.ibm.com/software/data/informix/pubs/library/.
Online Notes
The following sections describe the online files that supplement the
information in this manual. Please examine these files before you begin using
your IBM Informix product. They contain vital information about application
and performance issues.
Introduction xv
Online File Description Format
TOC Notes The TOC (Table of Contents) notes file HTML
provides a comprehensive directory of
hyperlinks to the release notes, the fixed and
known defects file, and all the documentation
notes files for individual manual titles.
Documentation Notes The documentation notes file for each manual HTML, text
contains important information and
corrections that supplement the information
in the manual or information that was
modified since publication.
Release Notes The release notes file describes feature HTML, text
differences from earlier versions of IBM
Informix products and how these differences
might affect current products. For some
products, this file also contains information
about any known problems and their
workarounds.
Machine Notes (Non-Windows platforms only) The machine text
notes file describes any platform-specific
actions that you must take to configure and
use IBM Informix products on your
computer.
Fixed and Known This text file lists issues that have been text
Defects File identified with the current version. It also lists
customer-reported defects that have been
fixed in both the current version and in
previous versions.
Before Installation
All online notes are located in the /doc directory of the product CD. The
easiest way to access the documentation notes, the release notes, and the fixed
and known defects file is through the hyperlinks from the TOC notes file.
The machine notes file and the fixed and known defects file are only provided
in text format.
After Installation
Dynamic Server
ids_win_fixed_and_known ids_win_fixed_and_known
_defects_version.txt _defects_10.0.txt
On UNIX platforms, use the finderr command to read the error messages and
their corrective actions.
Dynamic Server
On Windows, use the Informix Error Messages utility to read error messages
and their corrective actions. To display this utility, choose Start > Programs >
IBM Informix Dynamic Server version > Informix Error Messages from the
taskbar.
End of Dynamic Server
Introduction xvii
You can also access these files from the IBM Informix Online Documentation
site at http://www.ibm.com/software/data/informix/pubs/library/.
Manuals
Online Manuals
A CD that contains your manuals in electronic format is provided with your
IBM Informix products. You can install the documentation or access it directly
from the CD. For information about how to install, read, and print online
manuals, see the installation insert that accompanies your CD. You can also
obtain the same online manuals from the IBM Informix Online Documentation
site at http://www.ibm.com/software/data/informix/pubs/library/.
Printed Manuals
To order hardcopy manuals, contact your sales representative or visit the IBM
Publications Center Web site at
http://www.ibm.com/software/howtobuy/data.html.
Online Help
IBM Informix online help, provided with each graphical user interface (GUI),
displays information about those interfaces and the functions that they
perform. Use the help facilities that each GUI provides to display the online
help.
Accessibility
IBM is committed to making our documentation accessible to persons with
disabilities. Our books are available in HTML format so that they can be
accessed with assistive technology such as screen reader software. The syntax
diagrams in our manuals are available in dotted decimal format, which is an
accessible format that is available only if you are using a screen reader. For
more information about the dotted decimal format, see the Accessibility
appendix.
IBM Informix Dynamic Server Version 10.0 and CSDK Version 2.90
Documentation Set
The following tables list the manuals that are part of the IBM Informix
Dynamic Server, Version 10.0 and the CSDK Version 2.90, documentation set.
PDF and HTML versions of these manuals are available at
http://www.ibm.com/software/data/informix/pubs/library/. You can order
hardcopy versions of these manuals from the IBM Publications Center at
http://www.ibm.com/software/howtobuy/data.html.
Introduction xix
Table 1. Database Server Manuals (continued)
Manual Subject
J/Foundation Developer’s Writing user-defined routines (UDRs) in the Java programming language
Guide for Informix Dynamic Server with J/Foundation.
Large Object Locator Using the Large Object Locator, a foundation DataBlade module that can
DataBlade Module User’s be used by other modules that create or store large-object data. The Large
Guide Object Locator enables you to create a single consistent interface to large
objects and extends the concept of large objects to include data stored
outside the database.
Migration Guide Conversion to and reversion from the latest versions of Informix
database servers. Migration between different Informix database servers.
Optical Subsystem Guide The Optical Subsystem, a utility that supports the storage of BYTE and
TEXT data on optical disk.
Performance Guide Configuring and operating IBM Informix Dynamic Server to achieve
optimum performance.
R-Tree Index User’s Guide Creating R-tree indexes on appropriate data types, creating new operator
classes that use the R-tree access method, and managing databases that
use the R-tree secondary access method.
SNMP Subagent Guide The IBM Informix subagent that allows a Simple Network Management
Protocol (SNMP) network manager to monitor the status of Informix
servers.
Storage Manager Informix Storage Manager (ISM), which manages storage devices and
Administrator’s Guide media for your Informix database server.
Trusted Facility Guide The secure-auditing capabilities of Dynamic Server, including the creation
and maintenance of audit logs.
User-Defined Routines and How to define new data types and enable user-defined routines (UDRs)
Data Types Developer’s to extend IBM Informix Dynamic Server.
Guide
Virtual-Index Interface Creating a secondary access method (index) with the Virtual-Index
Programmer’s Guide Interface (VII) to extend the built-in indexing schemes of IBM Informix
Dynamic Server. Typically used with a DataBlade module.
Virtual-Table Interface Creating a primary access method with the Virtual-Table Interface (VTI)
Programmer’s Guide so that users have a single SQL interface to Informix tables and to data
that does not conform to the storage scheme of Informix Dynamic Server.
Introduction xxi
IBM Welcomes Your Comments
We want to know about any corrections or clarifications that you would find
useful in our manuals, which will help us improve future versions. Include
the following information:
v The name and version of the manual that you are using
v Section and page number
v Your suggestions about the manual
This email address is reserved for reporting errors and omissions in our
documentation. For immediate help with a technical problem, contact IBM
Technical Support.
In This Chapter
This chapter introduces a new user to DB–Access. It provides information
about how to set up your DB–Access environment and the demonstration
database.
SQL and SPL allow you to perform data-definition tasks, such as specifying
the number and type of data columns in a table, and data-management tasks,
such as storing, viewing, and changing table data. The DB–Access interface
allows you to apply powerful Informix extensions to SQL and SPL.
You can use DB–Access for the following aspects of database processing:
v Using ad hoc queries that you execute infrequently
v Connecting to one or more databases, transferring data between the
database and external text files, and displaying information about a
database
v Displaying system catalog tables and the Information Schema, which are
explained in the IBM Informix: Guide to SQL Reference
v Practicing the statements and examples provided in the IBM Informix: Guide
to SQL Tutorial or the IBM Informix: Database Design and Implementation
Guide
v Testing applications that you intend to store for use in a production
environment
Using DB-Access
You can use the DB–Access user interface to:
v Run statements interactively, discarding them after you achieve the desired
results, or saving them in a file for repetitive execution.
v Type statements directly in the DB–Access text-entry screen or your
preferred text editor.
v Start DB–Access in menu mode and select options from the menus.
Figure 1-1 on page 1-3 illustrates the top two levels of the DB–Access menu
hierarchy. The view of available options summarizes the types of database
tasks that you can accomplish with DB–Access.
Setting Up DB-Access
This section reviews the procedure for setting up the DB-Access environment.
Pre-DB-Access Installation
Before you set up the DB–Access environment, you must perform the
following preparatory steps:
1. Install the database server and set environment variables.
You can then run the initialization script for the demonstration database
(optional) and invoke the DB–Access program, as described in “Invoking
DB-Access” on page 1-10.
Environment Variables
As part of the installation and setup process, the system or database
administrator sets certain environment variables that enable IBM Informix
products to work within a particular operating-system environment. This
section lists the environment variables that affect your ability to use
DB–Access.
UNIX Only
Dynamic Server
Note: In the menu mode, multiple SQL commands in a dbaccess editor can
execute all at once and will consume only one dbaccess history entry.
End of Extended Parallel Server
Dynamic Server
For more information on environment variables, see the IBM Informix: Guide
to SQL Reference.
Dynamic Server
For descriptions of the databases and their contents, see the IBM Informix:
Guide to SQL Reference.
The scripts that you use to install the demonstration databases reside in the
$INFORMIXDIR/bin directory on UNIX platforms and in the
%INFORMIXDIR%\bin directory in Windows environments.
Table 1-1 lists the databases available for each database server. To set up or
reinitialize the demonstration database, run the corresponding initialization
script that Table 1-1 shows.
Table 1-1. Demonstration Databases
Server Type Database Name Model Initialization Script
All Informix database servers stores_demo Relational database dbaccessdemo
IBM Informix Extended Parallel sales_demo Dimensional data dbaccessdemo -dw
Server warehouse
IBM Informix Dynamic Server superstores_demo Object-relational dbaccessdemo_ud
database
Demonstration Installation
When you run the installation script for a demonstration database, the script
asks you if you would like to copy sample SQL command files. Command
files that the demo includes have a .sql extension and contain sample SQL
statements that you can use.
Always initialize or run DB–Access from the directory in which you want to
store SQL command files for the following reasons:
UNIX Only
You must have UNIX read and execute permissions for each directory in
the pathname that you create.
Tip: If you want to discard changes that you made to your database or to the
command files, rerun the demonstration initialization script. When the
script prompt message displays, press Y to replace the command files
with the original versions.
Command-Line Syntax
The illustrations in this section show the syntax of the initialization scripts.
For assistance in reading the diagrams, see “Syntax Diagrams” on page xi in
the introduction to this manual.
To create stores_demo:
dbaccessdemo
-log dbname -dbspace dbspace_name
dbaccessdemo -dw
Dynamic Server
To create superstores_demo:
dbaccessdemo_ud
-log dbname -dbspace dbspace_name
Examples:
v The following command creates a database named stores_demo:
dbaccessdemo
v The following example creates an instance of the stores_demo database
named demo_db:
dbaccessdemo demo_db
v The following command initializes the stores_demo database and also
initiates log transactions:
dbaccessdemo -log
v The following command creates an instance of the stores_demo database
named demo_db in dbspace_2:
dbaccessdemo demo_db -dbspace dbspace_2
UNIX Only
Use the UNIX chmod command to enable execution of the SQL files that the
initialization script installed.
End of UNIX Only
Invoking DB-Access
For more information on how to invoke DB-Access, see the following
references:
v To display all the menus, start DB–Access at its main menu. See
“Displaying the Main Menu” on page 1-11.
v To start and exit from a specific DB–Access menu or screen, see “Displaying
Other Menus or Options” on page 1-12.
v To execute a file that contains SQL statements without displaying the
DB–Access menus, see “Executing a Command File” on page 1-17.
v To type DB–Access options at the command line, without the full-screen
menu interface, see “Using DB-Access Interactively in Non-Menu Mode” on
page 1-19.
v To check the DB–Access version or transfer nonprintable characters in
hexadecimal form, see “Activating the XLUF Feature for Nonprintable
Characters” on page 1-19.
Windows Only
You can set up the DB–Access program icon to perform any of the commands
that this chapter shows.
Windows Only
Tip: If your operating system cannot find dbaccess, place the full path before
the program name, as follows:
$INFORMIXDIR/bin/dbaccess
UNIX Only
Without arguments, the single word dbaccess starts the main menu with no
database selected and no options activated. You can then select submenus
from the main menu.
dbaccess database
-ansi -nohistory -q
query_language _menu_option
filename
table
-t
table_menu_option
table
-d database_menu_option
-c connect_menu_option
-s
-e database filename
-
-v
-V
-X
-help
Dynamic Server
If you exit from a submenu or option that you specified from the command
line, you will exit directly to the operating-system command line.
Menu Suboptions
The following menu suboptions allow you to access submenus directly.
When you select the Modify option on the QUERY-LANGUAGE menu, you
must first select a command file to modify from the CHOOSE menu. The
MODIFY screen then appears and displays the text.
Tip: You cannot go directly to the Run or Output option on the SQL menu.
Trying to do so results in an error message.
When DB–Access starts, the database and database server name that you
specify appear on the dashed line, as Figure 1-2 shows.
Figure 1-2. The DB-Access Main Menu with Database and Database Server Name
The following sample command executes the SQL statements in a file named
sel_stock.sql on the mystores database:
dbaccess mystores sel_stock
The following sample command executes the SQL statements in the sel_all.sql
file on the database that file specifies:
dbaccess - sel_all.sql
You do not need to specify the -ansi option on the command line if the
DBANSIWARN environment variable is set.
DB–Access displays the SQLSTATE value with the warning under the
following circumstances:
v You include the -ansi option or set the DBANSIWARN environment
variable.
v You access or create an ANSI database.
v You run DB–Access in line mode or specify a .sql input file.
v Execution of a SQL statement generates a warning rather than an error.
For example, the following calculation shows how many bytes a DECIMAL(5)
column requires in the default locale (where the decimal point occupies a
single byte):
Important: The .unl files that contain data in a hexadecimal format are not
compatible with Informix database servers prior to Version 6.0.
However, .unl files generated without the XLUF functionality are
fully compatible with Version 6.0 or later database servers.
For more information, see the descriptions of the LOAD and UNLOAD
statements in the IBM Informix: Guide to SQL Syntax. Also see the discussion
of the various SQL utilities in the IBM Informix: Migration Guide and the data
types information in the IBM Informix: Guide to SQL Reference.
Using DB-Access Interactively in Non-Menu Mode
If you do not want to use the menus and do not have a prepared SQL file,
use your keyboard or standard input device to enter SQL statements.
When you type a semicolon (;) to end a single SQL statement, DB–Access
processes that statement. When you press CTRL-D to end the interactive
session, DB–Access stops running. The following example shows user input
and results in an interactive session:
dbaccess - -
>database stores_demo;
Database selected.
(count(*))
21
1 row(s) retrieved.
>^D
dbaccess - -
>database stores_demo;
Database selected.
(count(*))
21
1 row(s) retrieved.
>^D
Batch Command Input on UNIX Platforms: You can use an in-line shell
script to supply one or more SQL statements. For example, you can use the
UNIX C, Bourne, or Korn shell with in-line standard input files:
dbaccess mystores- <<EOT!
select avg(customer_num) from customer
where fname matches ’[A-G]*’;
EOT!
21
1 row(s) retrieved.
>
Connected.
ENTER PASSWORD:
Connected.
Important: For security reasons, do not enter the password on the screen
where it can be seen. Also, do not include the USING password
clause in a CONNECT statement when you use DB–Access
interactively. If you are in interactive mode and attempt to enter a
password before the prompt, an error message appears.
UNIX Only
ENTER PASSWORD:
Database created.
Table created.
3> insert into customer values (102, "Carole Sadler", "Sports Spot");
1 row(s) inserted.
4> history;
4> run 3;
1 row(s) inserted.
5> history;
5>
The history command lists the SQL statements used in the current session.
The number of commands that are logged is determined by the
IFMX_HISTORY_SIZE environment variable. For more information see
“Environment Variables” on page 1-4.
Related Manuals
For information on how to install the database server, set environment
variables, and put the database server online, see the manuals for your
database server listed in Table 1-2.
In This Chapter
This chapter provides introductory information about the following topics:
v Using the DB–Access user interface
v Alternative approaches
v Related manuals
If you are familiar with DB–Access, you might prefer to skip this introductory
chapter.
A message below the option menu briefly describes the function of the
highlighted option. If you highlight another option, the description changes.
To find out what an option does, simply highlight it and read the description.
The dashed line at the bottom of the header displays the name of the current
database, if one is selected, and a reminder to press CTRL-W for Help.
DB–Access displays the screen for the menu option that you select.
mystores@dbserver1
sysmaster@dbserver1
If Global Language Support (GLS) is enabled, the listed items are sorted
according to the code-set collation order of the current locale.
End of Global Language Support
---------------------------------------------------------------------------
The Run option runs the current SQL statements and displays the
output on your terminal.
If the Help text is longer than one page, the Screen option is highlighted.
Press RETURN to view the next screen. To select the Resume option, highlight it
with the SPACEBAR or the right arrow key and then press RETURN or the R key.
If the Help text is only one page, the Resume option is highlighted, and you
need only press RETURN.
For an illustration of how to read the syntax diagrams that appear when you
request online Help for creating, modifying, or editing an SQL statement, see
Appendix A, “How to Read Online Help for SQL Statements.”
Alternative Approaches
This section illustrates some common database tasks and lists alternative
procedures to use them. This section can help you determine your preferred
method of using the DB–Access interface.
For each task listed in this section, the number in the last column indicates
which chapter to consult for detailed instructions. You also need the
companion documents listed in “Related Manuals” on page 2-10.
Database-Level Tasks
The database you use is called the current database. To select an existing
database as current, you can:
v Use the following command line syntax:
dbaccess databasename
For more information about using DB–Access from the command line, see
“Invoking DB-Access” on page 1-10.
v Use any method from within DB–Access that is described in the following
list.
Option or SQL
Menu Screen Statement Action Chapter
DATABASE Create Prompts for a database name, 4
dbspace, and log options and
then creates the new database.
SQL CREATE DATABASE Creates the database you 3
name in the statement with
the appropriate setup for the
keywords you use.
Option or SQL
Menu Screen Statement Action Chapter
DATABASE Drop Lists available databases and 4
drops the database you
choose from the list.
SQL DROP DATABASE Drops the database named in 3
the command.
Option or SQL
Menu Screen Statement Action Chapter
DATABASE cLose Closes the current database. 4
SQL CLOSE DATABASE Closes the current database. 3
CONNECTION Disconnect Closes the current database 6
and disconnect from a
database server.
SQL DISCONNECT Closes the current database 3
CURRENT and disconnect from the
current database server.
To display information about a database, such as the dbspaces that contain it,
choose the Info option on the DATABASE menu.
Table-Level Tasks
To create a table, allocate storage, or apply fragmentation, use one of the
following methods.
Option or SQL
Menu Screen Statement Action Chapter
TABLE Create Uses the Schema Editor. 5
SQL CREATE TABLE Uses the SQL editor or system 3
editor and SQL statements.
Option or SQL
Menu Screen Statement Action Chapter
TABLE Alter Guides you, with menus, 5
through the available choices
for changing an existing table.
CREATE TABLE Modify Enables you to change a 5
schema before you build the
table.
SQL ALTER TABLE Changes an existing table 3
according to the keywords
you include with the
statement.
SQL ALTER FRAGMENT v Changes an existing 3
fragmentation strategy (for
a table or index).
v Creates the table fragments.
Option or SQL
Menu Screen Statement Action Chapter
TABLE Drop Drops the current table. 5
SQL DROP TABLE Drops the table named in the 3
command.
To move a table from current database to another database, use one of the
following methods.
Option or SQL
Menu Screen Statement Action Chapter
TABLE Move Guides you, with menus, 5
through available choices for
moving a table from the
current database to another
database.
SQL Move Table Moves the table named in the 3
command.
To display the data stored in a table, run a SELECT statement from the SQL
editor. Use the procedures described in Chapter 3, “The Query-language
Option,” on page 3-1.
Tip: Several command files are included with DB–Access that contain sample
practice SELECT statements. Appendix B lists the demonstration files that
are supplied with the stores_demo database.
Related Manuals
As you work with any of the following IBM Informix companion documents,
you might find reasons to use DB–Access:
v The IBM Informix: Database Design and Implementation Guide introduces
database-definition fundamentals for a variety of objectives, strategies, and
Informix database servers.
v The IBM Informix: Guide to SQL Tutorial introduces data-manipulation
fundamentals and explains how to design SQL and other language
applications to select, combine, report, and alter data.
v The IBM Informix Client Software Developer's Kit contains programmer’s
guides for developers whose data resides on an Informix database server.
In This Chapter
This chapter describes how to use the Query-language option on the
DB–Access main menu. When you select the Query-language option,
DB–Access displays the SQL menu. Use the various SQL menu options to
enter, modify, save, retrieve, and run SQL statements.
If you have not set the DBEDIT environment variable, you must select a text
editor to use for the session. If you select Use-editor, DB–Access prompts you
to accept or override the default system editor once each session, as Figure 3-1
shows.
USE-EDITOR >>vi
Enter editor name. (RETURN only for default editor)
Figure 3-1. Sample System Editor Screen for Entering and Modifying SQL Statements
UNIX Only
Windows Only
v If you use a text editor as the system default, you must save the .sql files as
text.
Press RETURN to select the default editor you named after the USE-EDITOR
prompt. To use a different editor, type the name of that editor and press
RETURN.
SQL: New Run Modify Use-editor Output Choose Save Info Drop Exit
Enter new SQL statements using the SQL editor.
If you select the Query-language option on the main menu and have not
selected a database, the SELECT DATABASE screen appears. Specify a
database at the prompt or press the Interrupt key to display the SQL menu.
From the SQL menu, create or choose and run an SQL statement to specify the
current database.
Figure 3-3. The NEW Screen for Entering New SQL Statements
As Figure 3-3 shows, the NEW screen starts with the cursor positioned below
the header, which indicates where you enter text on the screen. Use the editor
to enter statements and edit them before you run them. To string several SQL
statements together, separate them with a semicolon.
For more information on arrow and cursor-positioning keys, see “Using the
Keyboard with DB-Access” on page 2-2.
To make the full text appear on the screen, press RETURN at a logical place in
the first 80 characters of each line. If you need to type a quoted character
string that exceeds 80 characters, such as an insert into a long CHAR column,
use a system editor instead of the SQL editor.
When you use the SQL editor, you can type as many lines of text as you need.
You are not limited by the size of the screen, although you might be limited
by the memory constraints of your system or the maximum SQL statement
size of 64 kilobytes.
If you insert more lines than one screen can hold, the SQL editor scrolls down
the page with the additional text. The beginning and ending line numbers of
the current page are displayed on the fourth line of the text-entry screen, as
Figure 3-4 shows.
When you finish entering a new SQL statement or statements, press ESC to
return to the SQL menu.
SQL: New Run Modify Use-editor Output Choose Save Info Drop Exit
Run the current SQL statements.
Figure 3-5. The SQL Menu with SQL Statement Text Ready to Run
Press RETURN or the R key to select the Run option. DB–Access first checks
each statement to ensure that it conforms to the SQL syntax and usage rules.
If your statements contain no syntax mistakes, DB–Access processes them.
Tip: You can check your SQL statements for ANSI compatibility if you set the
DBANSIWARN environment variable or invoke DB–Access with the
-ansi option.
Statements That the Run Option Supports
Table 3-1 lists the statements that you can execute with the Run option.
Table 3-1. SQL Statements for Run Option
Options
SQL Statement XPS IDS
ALTER ACCESS_METHOD x
ALTER FRAGMENT x x
ALTER FUNCTION x
ALTER INDEX x
ALTER PROCEDURE x
ALTER ROUTINE x
For information about additional statements for Optical Subsystem, see the
IBM Informix: Optical Subsystem Guide.
Tip: To execute statements that are not listed, use the SQL menu options New
(or Use-editor) and Save to enter and save them, and then run the saved
file from the command line.
If you use the Run option with a SELECT statement and that SELECT
statement runs correctly, DB–Access displays the requested results below the
header. If your query retrieves more rows than can fit on a single screen, the
results screen has a menu at the top, as Figure 3-6 shows.
customer_num 106
call_dtime 1997-06-12 08:20
user_id maryj
call_code D
call_descr Order was received, but two of the cans of ANZ tennis balls within
the case were empty
res_dtime 1997-06-12 08:25
res_descr Authorized credit for two cans to customer, issued apology. Called
ANZ buyer to report the QA problem.
customer_num 110
call_dtime 1997-07-07 10:24
user_id richc
call_code L
call_descr Order placed one month ago (6/7) not received.
res_dtime 1997-07-07 10:30
res_descr Checked with shipping (Ed Smith). Order sent yesterday- we were
waiting for goods from ANZ. Next time will call with delay if
necessary.
Note: When running a query that returns more than one screen of data, it is
important to note that a cursor is still open and its corresponding locks
are still held until all data is returned.
If you try to execute a statement that contains more than one SQL statement,
you might not see the error message immediately. If, for example, the first
statement is a SELECT statement that runs correctly and the next statement
contains a typing error, the data that the first statement retrieved appears on
the screen before the error message appears for the second statement.
Figure 3-7. The SQL Menu with SQL Statement Text to Be Modified
If you press RETURN, DB–Access calls the SQL editor and positions the cursor
on the line with the first error. You can correct the error with the SQL editor,
or you can press ESC to exit to the SQL menu and select the Use-editor option
to edit the statement with your system editor. To exit, perform one of the
following steps:
v If you use the SQL editor to make changes, press ESC when you finish
editing the statement.
v If you use the system editor to make changes, exit the file according to the
convention for that editor.
You then return to the SQL menu, where you can press RETURN to run the
statement again.
If the SQL statement is new, the screen is blank. If you want to change or call
up this statement with the Choose option, the text of the SQL statement
appears on the screen.
If an error occurs while you run an SQL statement, the edit screen contains
the error message with a pointer to the likely cause. Figure 3-8 shows how an
editor screen might look after a syntax error. The editor used in this example
displays the name of the temporary file assigned to the SQL statement.
^
#
#201:A syntax error has occurred
#
unit CHAR(4),
unit_descr CHAR(15),
PRIMARY KEY (stock_num, manu_code) CONSTRAINT stock_man_primary,
FOREIGN KEY (manu_code) REFERENCES manufact
)
Figure 3-8. A Temporary Text-Editing File with SQL Statement Text to Be Corrected
Make your corrections to the text. When you finish entering or modifying
your SQL statement or statements, exit the editor as you normally do. The
SQL menu reappears with the Run option highlighted. The statement text
appears in the bottom half of the screen.
Press RETURN to run the statement or select another menu option to save the
statement in a command file or direct its output.
The SELECT statement must be on the screen as the current statement. Then
you can select the Output option from the SQL menu, which displays the
OUTPUT menu, as Figure 3-9 shows.
Type a name for the file and press RETURN. DB–Access forwards the results of
the query to that file and displays a message that indicates how many rows
were retrieved. The query results do not appear on the screen.
Warning: If you enter the name of an existing file, this procedure overwrites
the existing file with the query results.
UNIX Only
On a UNIX operating system, you must have permission to run the target
program.
End of UNIX Only
Select the Choose option on the SQL menu to display the CHOOSE screen
with a list of the command files that you can access. These files have the
extension .sql, although the extension is not shown. For example, Figure 3-13
on page 3-17 lists the command files included in the demonstration database.
If no current database exists, the list includes all the command files located in
the current directory and in any directories that the DBPATH environment
variable specifies.
Important: This list includes only those filenames that have the .sql
extension. If you create a new SQL file outside of DB–Access and
save it without the .sql extension, it will not appear in the list of
files to choose. Add the .sql extension to the filename and then
select Choose again.
Note: DB–Access can only recognize files that are stored in the directory from
which you started DB–Access. If the Choose command results in an
empty list, and you know you have command files, exit DB–Access,
change directories to the directory that contains your .sql files, and
restart DB–Access.
To select a command file, use the arrow keys to highlight its name or enter
the name of the file at the prompt.
When the SQL menu reappears, it displays the command file statements on
the screen as the current statements. To modify, run, edit, or output these
statements, choose the appropriate menu option.
To leave the CHOOSE screen without selecting a command file, press the
Interrupt key, which returns you to the SQL menu.
To save the current SQL statement or statements in a file, select the Save
option on the SQL menu. The SAVE screen appears and prompts you to enter
a name for the command file, as Figure 3-14 shows.
SAVE >>
Enter the name you want to assign to the command file.
You assign the left portion of the filename. Use 1 to 10 characters. Start with a
letter, then use any combination of letters, numbers, and underscores (_). Press
RETURN to save the file.
UNIX Only
You can use uppercase and lowercase letters in the name. However, remember
that UNIX operating systems are case sensitive. The file orders is not the same
as Orders or ORDERS.
End of UNIX Only
DB–Access appends the extension .sql to the name that you assign when it
stores the statements in a file. For example, if you name your file cust1,
DB–Access stores the file with the name cust1.sql. The CHOOSE screen still
lists cust1, but the operating system identifies the same file as cust1.sql if you
list the directory files from the command line.
To leave the SAVE screen without assigning a name to a command file, press
the Interrupt key, and you return to the SQL menu.
The Table option on the main menu displays a TABLE menu, which in turn
has an Info option. The Info option screens are the same for both the SQL
menu and TABLE menu. For more information on the Info option, see
“Displaying Table Information” on page 5-34.
To leave the INFO FOR TABLE screen without requesting table information,
press the Interrupt key.
To remove command files from the current database directory, select the Drop
option on the SQL menu. The DROP COMMAND FILE screen appears with
an alphabetical list of command files in the current database, as Figure 3-15
shows.
Figure 3-15. The DROP COMMAND FILE Screen with Sample Files
If GLS is enabled, the order in which DB–Access lists the names of command
files might vary, depending on the locale you use.
End of Global Language Support
Type the name of the command file that you want to drop or highlight it with
the arrow keys and press RETURN. A special menu appears that asks for
confirmation before it drops the command file as Figure 3-16 shows.
You can store the SPL routine in a separate command file and then call it from
an application or execute it as a stand-alone program. After you create the
SPL routine, you can execute it within DB–Access with the appropriate SQL
statement. The following example details the steps.
Dynamic Server
If you use Dynamic Server, use the CREATE FUNCTION statement if the
routine returns values.
For more information on the CREATE FUNCTION statement, see the
IBM Informix: Guide to SQL Syntax.
End of Dynamic Server
2. Use the Run option to create the routine and register it in the
sysprocedures system catalog table.
3. Use the NEW screen to enter an EXECUTE PROCEDURE statement that
names the routine that you want to run.
Dynamic Server
If you use Dynamic Server and created your routine with the CREATE
FUNCTION statement, enter an EXECUTE FUNCTION statement to run
the function.
End of Dynamic Server
4. Use the Run option to execute the routine and display the results.
Figure 3-17 shows the text of the routine in the c_proc.sql command file,
which is supplied with the demonstration database. To try this routine, use
the Choose option and then select c_proc.
Dynamic Server
If you use Dynamic Server, change the word procedure in c_proc.sql to function
because the routine returns a value.
End of Dynamic Server
To register the routine in the database, select the Run option, as Figure 3-17
shows.
end procedure;
Figure 3-17. Displaying the Text of an SPL Routine on the SQL Menu
DB–Access displays a message to indicate that the database server created the
routine. To execute the routine, select New from the SQL menu and then enter
the appropriate EXECUTE statement. In the following example, the user
requests the address of a customer whose last name is Pauli:
EXECUTE PROCEDURE read_address ("Pauli")
Dynamic Server
Ludwig
Pauli
213 Erstwild Court
Sunnyvale
CA
94086
Tip: SPL routines are stored in the system catalog tables in executable format.
Use the Routines option on the DATABASE INFO menu to display a list
of the routines in the current database or to display the text of a
specified routine.
Related Manuals
The following companion manuals provide details for the Informix
implementation of SQL statements and SPL programming logic:
v For tutorial information on SQL statements and SPL routines, see the
IBM Informix: Guide to SQL Tutorial.
v For reference information on the syntax and usage of SQL and SPL
statements, see the IBM Informix: Guide to SQL Syntax.
v For reference information on SQL system catalog tables, data types, and
environment variables, see the IBM Informix: Guide to SQL Reference.
Dynamic Server
In This Chapter
This chapter describes how to use the Database option. To perform any of the
following actions, select the Database option from the main menu.
v Create a database or select a database.
The database you work with is called the current database.
v Retrieve and display information about a database, such as available
dbspaces and the text of routines.
v Delete an existing database or close the current database.
v Commit or rollback transactions.
You can only access databases that reside on the current database server. To
select a database server as current, you can specify a database server when
you invoke DB–Access, you can use the Connection menu, or you can run a
CONNECT statement from the SQL menu. If you do not explicitly select a
database server, DB–Access uses the default database server that the
$INFORMIXSERVER environment variable specifies as the current database.
Selecting a Database
To work with an existing database, choose the Select option from the
DATABASE menu. The SELECT DATABASE screen appears, as Figure 4-2
shows.
productn@factory
The SELECT DATABASE screen also appears whenever you need to specify a
database, such as when you choose the Table or Query-language option
without specifying a database on the DB–Access command line.
To leave the SELECT DATABASE screen and return to the DATABASE menu
without selecting a database, press the Interrupt key.
List of Available Databases
When the SELECT DATABASE screen appears, the first database in the list of
available databases is highlighted, accompanied by the names of database
servers. The list is organized alphabetically by database server and then by
database for each database server. You can display a maximum of 512
database names on the SELECT DATABASE screen.
For example, to select the demodb database on the current database server,
type demodb or highlight demodb@dbserver1 and press RETURN.
The name of the database that you select appears on the dashed line below
the screen header.
Creating a Database
To create a new database instead of selecting an existing one, select the Create
option from the DATABASE menu. The CREATE DATABASE screen appears,
as Figure 4-3 shows.
Enter a name for the database that you want to create and press RETURN.
Note: You can assign any name to your database, as long as you follow the
syntax guidelines described in the IBM Informix: Guide to SQL Syntax.
To create a database on another database server, specify the server name with
the database name. Follow the syntax guidelines described in the
IBM Informix: Guide to SQL Syntax.
After you name the new database, the CREATE DATABASE menu appears as
Figure 4-4 shows.
If you exit without specifying a value for dbspace or logging, the defaults
apply to the database.
Tip: This menu option provides information about the database that the SQL
statement INFO does not display.
When you select the Info option on the DATABASE menu, the SELECT
DATABASE screen appears, as Figure 4-2 shows.
After you select a database, the DATABASE INFO menu appears, with the
database you selected identified in the dashed line.
Figure 4-8 shows the DATABASE INFO menu for IBM Informix Dynamic
Server.
Figure 4-8. The DATABASE INFO Menu for IBM Informix Dynamic Server
Number of When
Id Name Chunks Created Mirror
3 dbspace2 1 04/28/94 N
Figure 4-9. The DATABASE INFO Menu with Dbspaces Information Displayed
If the current database supports NLS, you can select the Nls option on the
DATABASE INFO menu to display information about collating sequence and
C CType (character classification type), as Figure 4-10 shows.
Figure 4-10. The DATABASE INFO Menu with NLS Information Displayed
An error message displays if the database does not support NLS or the
environment variables for NLS are not properly set.
DB–Access does not provide an option on the DATABASE INFO menu for
displaying the GLS collating sequence and character classification type. To
obtain information about the GLS locale enabled for your database server,
enter the following query with the SQL editor that is described in Chapter 3:
SELECT tabname, site FROM systables
WHERE tabid = 90 OR tabid = 91
The row with tabid 90 stores the COLLATION category of the database locale.
The row with tabid 91 stores the CTYPE category of the database locale.
Figure 4-11 shows the result of the preceding query for the default U.S.
English locale.
tabname GL_COLLATE
site en_US.819
tabname GL_CTYPE
site en_US.819
2 row(s) retrieved
Dynamic Server
Figure 4-12 shows the SELECT ROUTINE screen that appears if you use
Dynamic Server. The SELECT PROCEDURE screen looks the same although
the prompt uses different wording for an SPL routine.
read_address
If the routine exists in the system catalog and it fits on the DATABASE INFO
menu, the text appears on the screen, as Figure 4-13 shows.
end procedure
Figure 4-13. The DATABASE INFO Menu with Text of Selected Routine Displayed
If the routine text does not fit on one screen, the DISPLAY menu appears with
partial text, as Figure 4-14 shows.
Figure 4-14. The DISPLAY Menu with Partial Routine Text Displayed
To display the next page of text, select the Next option. To display text from
the beginning, select the Restart option.
Selecting a Different Database
To display information about a different database, select the Database option
on the DATABASE INFO menu. The SELECT DATABASE screen appears and
you can select a database, as described in “Selecting a Database” on page 4-2.
You can then use the other options of the DATABASE INFO menu, as this
chapter describes.
Deleting a Database
To delete an existing database on a specified database server, select the Drop
option from the DATABASE menu. The DROP DATABASE screen appears, as
Figure 4-15 shows.
mydata@dbserver1
demodb@dbserver1
personnel@mynewdb
You cannot delete the current database. The current database is the database
whose name appears in the dashed line below the header of the display.
The DROP DATABASE Screen
To delete a database, use the DROP DATABASE screen in either of the
following ways:
v Type the database name and press RETURN.
v Use the arrow keys to highlight the name of the database that you want to
delete and press RETURN.
To leave the DROP DATABASE screen without deleting a database, press the
Interrupt key. You return to the DATABASE menu.
Confirming Your Decision to Delete a Database
When you delete a database, DB–Access displays a special menu that asks for
confirmation before it deletes the database, as Figure 4-16 shows.
mydata@dbserver1
demodb@dbserver1
personnel@mynewdb
The default is No, which helps prevent deleting a database by mistake. If you
want to delete the highlighted database, press the Y key or use the right arrow
key to highlight Yes, and press RETURN. DB–Access deletes the database and all
data that it contains. Be absolutely sure that you choose the correct database
to delete.
If you select the cLose option when no database name is on the Help line,
DB–Access displays an error message.
If you begin a transaction but do not commit it or roll it back, and then try to
close a database with transactions, the TRANSACTION menu appears, as
Figure 4-17 shows.
The TRANSACTION menu ensures that you either commit or roll back an
active transaction before you close the current database. The following list
shows the two menu options:
v The default option is Commit.
Press the Y key or RETURN and DB–Access commits the transactions and
closes the database.
v If you want to roll back the transactions, use an arrow key to move the
highlight to the Rollback option.
Press RETURN, and DB–Access rolls back the transactions and closes the
database.
If you press the Interrupt key, DB–Access displays the DATABASE menu
without committing or rolling back the transactions.
Related Manuals
The following manuals contain information pertinent to database connection
and creation:
v For syntax information, see the IBM Informix: Guide to SQL Syntax.
v For information about environment variables, see the IBM Informix: Guide to
SQL Reference.
In This Chapter
This chapter describes how to use the features of the Table option on the main
menu. Select this option if you want to perform any of the following table
management tasks without SQL programming:
v Create a new table
v Define fragmentation strategy for a new or existing table
v Alter, delete, or display information about an existing table
If no current database exists when you select the Table option, the SELECT
DATABASE screen appears. Select from a list of databases defined for the
current database server or press the Interrupt key to display the main menu.
At the prompt, type the name of the new table and press RETURN. You can
assign any name to the table, as long as you follow the syntax guidelines for
naming database objects described in the IBM Informix: Guide to SQL Syntax.
After you enter the new table name, the CREATE TABLE menu appears, as
Figure 5-3 shows.
---- Page 1 of 1 ---- mydata@mydbserv ------------ Press CTRL-W for Help -----
customer
items
orders
Enter the name of the table that you want to alter after the prompt or use the
arrow keys to highlight the table name in the list. After you press RETURN, the
ALTER TABLE menu and the table schema appear, as Figure 5-5 shows.
ALTER TABLE clients: Add Modify Drop Screen Table_options Constraints Exit
Adds columns to the table above the line with the highlight.
--- Page 1 of 1 --- mydata@mydbserv ----------- Press CTRL-W for Help -----
Important: You must have the Alter privilege to successfully alter a table.
Without the privilege, you can use the menus from the ALTER
TABLE screen, but an error results when you attempt to select
Build-new-table from the EXIT screen. For references explaining
the Alter privilege and other table-level privileges, see page 5-2.
To use the LOAD statement to insert data into a table, you must
have both Insert and Select privileges for the table. You need the
Important: You must use the SPACEBAR to move between menu options
because the arrow keys control cursor movement in the Schema
Editor.
Important: Before you use the Add option from the ALTER TABLE menu,
you must position the highlight in the Schema Editor to indicate
where you want to insert the new column or columns. To move
the highlight within the displayed columns, use the up and down
arrow keys. To scroll more of the column list onto the screen, use
the Screen option on the menu. When you select the Add option,
the highlighted line moves down to make an empty line for the
new column.
The Schema Editor progresses from left to right, completing one horizontal
line of description for each column, with the name of the column at the left.
Use the right arrow key to move the highlight to each field. To accept the
default entry for each field, press RETURN or an arrow key.
As you finish one column, the cursor moves to the next line down, so that
you can type another column name. Thus, the columns that make up the table
are listed vertically.
You can change or bypass any field entry in a line before you move to the
next line in either of the following ways:
v Use the left arrow key to move back to a field that you passed on the
current line.
v Press the Interrupt key to cancel a prompt without inserting a value into
the current (highlighted) field.
After you move the cursor to another line, you must use the Modify option
on the CREATE TABLE menu to change your entry, as “Modifying Columns
(Modify Option)” on page 5-12 describes.
Column Name
The Add option on the CREATE TABLE (or ALTER TABLE) menu places the
cursor on an empty line and displays the ADD COLUMN NAME prompt.
Type the name of the column after the ADD COLUMN NAME prompt and
press RETURN. You can assign any name, as long as you follow the identifier
syntax guidelines described in the IBM Informix: Guide to SQL Syntax.
---- Page 1 of 1 ---- mydata@mydbserv ---------- Press CTRL-W for Help ----
customer_num
Figure 5-6. The ADD COLUMN NAME Screen with Column Name Entered
ADD TYPE clients : Char Numeric Serial Date Money date-Time ...
Permits any combination of letters, numbers, and punctuation.
---- Page 1 of 1 ----- mydata@mydbserv ---------- Press CTRL-W for Help ----
customer_num
Figure 5-7. The ADD TYPE Menu for Defining Column Data Types
To select the data type for the column, type the first capitalized letter of the
data type, using either uppercase or lowercase letters or the SPACEBAR to
highlight it and then press RETURN.
Important: Use the spacebar to move to your choice. Use the arrow keys to
control cursor movement in the lower part of the screen.
Dynamic Server
The CREATE TABLE menu provides options for built-in data types. To define
a column with one of the extended data types, such as smart large objects,
user-defined (opaque) data types, or a collection data type, use the SQL menu
to enter and run a CREATE TABLE statement.
End of Dynamic Server
If you select one of the following data type categories from the ADD TYPE
menu, DB–Access displays one or two submenus for that category.
Tip: Although some data types described above are not included in the menu
mode, you can use any data types in interactive, non-menu mode.
Locale Character Data: If you use character data in a default locale, select
Char for fixed-length data or Varchar if the table will have varying-length
entries in that column.
If you use a nondefault locale, select Nchar for fixed length or Nvarchar for
varying length.
End of Global Language Support
----- Page 1 of 1 ------ mydata@mydbserv ------- Press CTRL-W for Help ------
cust_blob
Figure 5-8. The SELECT BLOBSPACE Screen for Storing Variable-Length Data
Column Index
DB–Access can construct only a nonclustered, ascending B-tree column index.
Select the Yes option to create this type of index with the ADD INDEX menu,
as Figure 5-9 shows.
----- Page 1 of 1 ----- mydata@mydbserv ----------- Press CTRL-W for Help ----
If you do not want to index the values in this column or if you want any
other type of index, such as an R-tree index, select the No option. You must
create an R-tree index directly with SQL.
empl_num Integer U
70% No
last_name Char 20 D 90% No
insurance Integer Dups Yes
ss_num Integer Unique No
Important: You can only set a fill-factor value when you create a new index.
You can modify the fill factor through the Modify option on the
CREATE TABLE menu. However, you cannot alter it through the
ALTER TABLE menu after the table for the index is created.
Enter any positive value to a maximum of 100. A value less than 1 or greater
than 100 results in an error.
---- Page 1 of 1 ----- mydata@mydbserv --------- Press CTRL-W for Help ----
Select Yes to allow null values in the column or No to force the column to
always have a non-null value.
----- Page 1 of 1 ---- mydata@mydbserv --------- Press CTRL-W for Help ----
To create the table that contains the displayed columns and return to the
TABLE menu, select Build-new-table. To return to the TABLE menu without
saving the new or modified table definition, select Discard-new-table.
To leave a Modify screen or menu without making any changes, press the
Interrupt key at any time.
Deleting Columns (Drop Option)
To delete a column from a table schema, perform the following steps:
1. Position the highlight anywhere on the column that you want to delete.
2. Select the Drop option on the CREATE TABLE (or ALTER TABLE) menu.
The column line is then partially or completely highlighted on the screen.
DB–Access displays the DROP menu that prompts you to verify your
decision, as Figure 5-13 shows.
--- Page 1 of 1 ---- mydata@mydbserv --------- Press CONTROL-W for Help ---
Select Yes from the DROP menu to delete the line currently highlighted in the
Schema Editor; select No to keep the line.
Arranging Storage and Locking (Table_options)
To display the TABLE_OPTIONS menu, as Figure 5-14 shows, select
Table_options from the CREATE TABLE menu (or ALTER TABLE menu). You
can then specify storage-management parameters, such as location and
distribution of data on the storage media.
---- Page 1 of 1 ---- mydata@mydbserv ---------- Press CTRL-W for Help ----
Selecting Dbspaces
To display the STORAGE menu, as Figure 5-15 shows, select the Storage
option from the TABLE_OPTIONS menu.
----- Page 1 of 1 ----- mydata@mydbserv -------- Press CTRL-W for Help ----
Figure 5-15. The STORAGE Menu for Storing Table Data and Defining Fragmentation Strategy
To display the SELECT DBSPACE screen, as Figure 5-16 shows, select Dbspace
from the STORAGE menu. Use the arrow keys to highlight a dbspace from
the list of dbspaces in the current database and then press RETURN.
----- Page 1 of 1 ---- mydata@mydbserv --------- Press CTRL-W for Help ----
rootdbs
pers_dbs
empl_dbs
Figure 5-16. The SELECT DBSPACE Screen for Specifying Table Storage
----- Page 1 of 1 ----- mydata@mydbserv -------- Press CTRL-W for Help ----
Select the strategy that you want from the FRAGMENT menu, as the
following table shows.
Extended Parallel Server does not support rowids for fragmented tables.
End of Extended Parallel Server
----- Page 1 of 1 ----- mydata@mydbserv ----------- Press CTRL-W for Help ----
Dbspace Name
dbspace1
dbspace2
Figure 5-18. The ROUND_ROBIN Menu for Selecting Fragment Storage Spaces
Use the arrow keys to highlight a dbspace from the list on the SELECT
DBSPACE screen, as Figure 5-16 on page 5-14 shows, and press RETURN. If you
try to add a dbspace that is already part of another strategy, an error message
appears.
When you return to the ROUND_ROBIN menu, the screen displays all
dbspaces currently chosen for the strategy.
----- Page 1 of 1 ----- mydata@mydbserv -------- Press CTRL-W for Help ----
Figure 5-19. The EXPRESSION Menu for Defining Expression Fragmentation Strategy
The Add option on the EXPRESSION menu displays the SELECT DBSPACE
screen, as Figure 5-16 on page 5-14 shows. Use the arrow keys to highlight a
dbspace from the list and press RETURN. If you try to add a dbspace that is
already part of another strategy, an error message appears.
----- Page 1 of 1 ----- mydata@mydbserv --------- Press CTRL-W for Help ----
dbspace1 field1<100
dbspace2 field1>=100 and field1<200
dbspace3 remainder
Figure 5-20. The EDIT EXPRESSION Menu for Defining and Editing Expressions
After you exit the editor, DB–Access displays the CONFIRM CHANGES
menu, as Figure 5-21 shows.
field1<100
To save the edits to the expression, press RETURN. To discard the edits to the
expression, select DISCARD. You return to the EXPRESSION menu.
Figure 5-22 shows how the ALTER FRAGMENT menu displays a table with a
round-robin fragmentation strategy. Figure 5-23 shows how the ALTER
FRAGMENT menu displays a table with an expression-based fragmentation
strategy.
ALTER FRAGMENT - new_acct: Add Drop Screen Init aTtach detaCh Exit
Add one new dbspace to the end of the list.
----- Page 1 of 1 ---- newstores@mydbserv ------- Press CTRL-W for Help ---
Dbspace Name
dbspace1
dbspace2
dbspace3
Figure 5-22. The ALTER FRAGMENT Menu for Round-Robin Fragmentation Strategy
----- Page 1 of 1 ----- newstores@mydbserv --------- Press CTRL-W for Help ----
dbspace3 remainder
Figure 5-23. The ALTER FRAGMENT Menu for Expression Fragmentation Strategy
Important: You can execute only one menu option in an ALTER FRAGMENT
menu, and it can be applied to the current strategy only once. For
example, you can add only one dbspace to a round-robin strategy,
and you cannot delete a dbspace during the same ALTER TABLE
session.
---- Page 1 of 1 ---- newstores@mydbserv -------- Press CTRL-W for Help ----
Figure 5-24. The ATTACH TABLES Menu for Expression Fragmentation Strategy
---- Page 1 of 1 ---- newstores@mydbserv -------- Press CTRL-W for Help ----
acct
cur_acct
myacct
If the table uses round-robin strategy, the resulting new fragment or fragments
will be positioned at the end of the fragmentation strategy and the ALTER
FRAGMENT menu returns.
----- Page 1 of 1 ---- newstores@mydbserv -------- Press CTRL-W for Help ----
v Select Before to attach the new fragment before a dbspace that you select
in the next step.
v Select After to attach the new fragment after the dbspace that you select
in the next step.
v Select None to attach the new fragment in the default position.
3. If you select Before or After as the attach position, the SELECT DBSPACE
screen appears, as Figure 5-27 shows, listing the dbspaces that the strategy
encompasses prior to attaching the new one.
----- Page 1 of 1 ---- newstores@mydbserv -------- Press CTRL-W for Help ---
dbspace1
dbspace2
dbspace3
Select the dbspace before or after which you want to attach the added
fragment.
The ATTACH TABLES menu reappears, as Figure 5-24 on page 5-20 shows,
and shows values for the Position and Dbspace fields.
Detaching a Dbspace
The detaCh option from the ALTER FRAGMENT menu displays the DETACH
DBSPACE screen, as Figure 5-28 shows.
----- Page 1 of 1 ---- newstores@mydbserv ------- Press CTRL-W for Help ----
dbspace1
dbspace2
dbspace3
After you correctly enter a dbspace on the DETACH DBSPACE screen, the
NEW TABLE screen appears, as Figure 5-29 shows.
---- Page 1 of 1 ---- newstores@mydbserv -------- Press CTRL-W for Help ----
Figure 5-29. The NEW TABLE Screen for Naming a Detached dbspace
Enter the name you want to assign to the new, unfragmented table. This table
stores the records from the dbspace you previously selected through the
DETACH DBSPACE screen. The display returns to the ALTER FRAGMENT
menu.
----- Page 1 of 1 ---- newstores@mydbserv ------- Press CTRL-W for Help ----
----- Page 1 of 1 ----- mydata@mydbserv ----------- Press CTRL-W for Help ----
----- Page 1 of 1 ----- mydata@mydbserv ---------- Press CTRL-W for Help ----
To select extent size on either screen, perform one of the following actions:
v Press RETURN to accept the default size of 8 kilobytes.
v Type a number (representing kilobyte units) and press RETURN.
The minimum extent size is 4 kilobytes.
----- Page 1 of 1 ----- mydata@mydbserv ---------- Press CTRL-W for Help ----
The LOCK_MODE menu lets you choose the mode to use when the database
locks the rows in a table. The LOCK_MODE menu has the following options.
Option Purpose
Page Locks the entire page on which a row resides
Row Locks a selected row individually
Exit Exits to the TABLE_OPTIONS menu
One row of a table is the smallest object that you can lock. A disk page
contains one or more rows of a table. To determine if you will enhance
performance by locking a disk page rather than individual rows on the page,
see your IBM Informix: Performance Guide. Unless you specify row-level
locking before you exit, DB–Access uses the default (Page).
If you select Add or Drop, another menu prompts you to verify your
selection. Select Yes to execute the Add or Drop; select No to cancel the Add
or Drop.
Defining Constraints
You can use the DB–Access Schema Editor to define constraints for columns
in a specified table. You can define primary-key, foreign-key, column-level and
table-level check, and unique constraints, as well as add and modify column
default values.
If you select the Constraints option from the CREATE TABLE menu, the
CONSTRAINTS menu appears, as Figure 5-34 shows.
constraint1 column1
column2 column2
column3 column3
If you break from the ADD CHECK VALUE menu or exit without defining
the check value, you return to the CHECK CONSTRAINTS menu. If you
defined the check value, you remain in add mode, a new line is inserted, the
Constraint Name is the current field, and the ADD CONSTRAINT NAME
prompt appears.
cons2 column1
column2
column3
cons3 column4
Important: You cannot modify unique constraints after you create them. To
identify the unique constraints listed on the UNIQUE
column1 User
column3 Null
column5 Today
column7 Literal
ADD DEFAULT TYPE mytab: Literal User Current Null Today Db-server-name Site-name
Assign a literal value using either the SQL editor or a system editor.
The ADD DEFAULT TYPE menu has the following options that let you assign
default values to the column.
Option Default Value Assigned
Literal A literal default value entered either in the
SQL editor or a user-specified system editor
User The login name of the current user
Current The current system clock time of day
Null Null
Today The current system date
Db-server-name The current database server name
Site-name The current site name
v If you select User, Null, Today, Db-server-name, or Site-name, the system
assigns that value to the default type and returns you to the DEFAULTS
menu in add mode.
v If you select Current as the default value, the qualifier is taken from the
column definition.
v If you enter a default value and the type is DATETIME or INTERVAL, enter
only the value. The qualifier comes from the column definition.
v If you select Literal as the default type, the ADD DEFAULT VALUE menu
appears, which lets you assign a literal as the default value.
The ADD DEFAULT VALUE menu lets you add or modify the default value
for a column in the current table with either the SQL editor or a system editor,
as Figure 5-43 shows.
Data Validation: When you enter a default value, DB–Access validates your
entry. The database server validates the literal value and checks the following
information:
v The column name must exist.
v The column type cannot be SERIAL.
v If the column does not allow nulls, you cannot specify the default type as
Null.
v You can use the default type Current only with a DATETIME column type.
v You can use the default type Db-server-name only with a column type of
CHAR, NCHAR, VARCHAR, or NVARCHAR, which has a minimum
length of 18 characters.
v You can use the default type Site-name only with a column type of CHAR,
NCHAR, VARCHAR, or NVARCHAR, which has a minimum length of 18
characters.
v You can use the default type Today only with a column type of DATE.
v You can use the default type User only with a column type of CHAR,
NCHAR, VARCHAR, or NVARCHAR, which has a minimum length of 18
characters.
When you select the Info option on the TABLE menu, the INFO FOR TABLE
screen appears, as Figure 5-44 shows.
clients
customer
orders
This screen lists the names of tables that exist in the current database. Note
the following items:
v If you are not the table owner, the table name is prefixed by the owner
name, as in june.clients.
v If the list of tables does not fit on one screen, the last entry is an ellipsis
(...). Use the arrow keys to highlight the ellipsis, and the next page of table
names appears.
To leave the INFO FOR TABLE screen without requesting table information,
press the Interrupt key. You return to the TABLE menu.
For example, for the customer table, type customer or use the arrow keys to
highlight it and press RETURN. The INFO menu appears, with customer in the
top line, as Figure 5-45 and Figure 5-46 on page 5-35 show.
Figure 5-45. The INFO Menu for Displaying Table Information (First Screen)
Figure 5-46. The INFO Menu for Displaying Table Information (Second Screen)
Tip: From the CREATE TABLE menu, use Table-options to view extent and
lock mode information, or issue a SELECT statement to list the table
description in the systables system catalog table.
Displaying Column Information
Use the Columns option on the INFO menu to display the following
information for each column of the specified table: the name of the column,
the data type of the column, and whether null values are allowed in the
column.
Figure 5-47 shows the kind of information that you see when you select the
Columns option for the cust_calls table.
customer_num INTEGER no
call_dtime DATETIME YEAR TO MINUTE yes
user_id CHAR(32) yes
call_code CHAR(1) yes
call_descr CHAR(240) yes
res_dtime DATETIME YEAR TO MINUTE yes
res_descr CHAR(240) yes
For descriptions of these data types, see the IBM Informix: Guide to SQL
Reference.
Figure 5-48 shows the display of column information for a table that has
BOOLEAN, INT8, and SERIAL8 columns as well as other built-in data types.
Figure 5-48. Displaying Column Information for a Table with Several Built-in Types
Large Objects: Large objects are built-in data types that store a large amount
of data in a single column. Within a table, large-object data type columns
actually contain pointers to the physical storage spaces where the database
server places the large data objects.
Dynamic Server
v CLOB, BLOB
End of Dynamic Server
The Columns option displays the specific data type for any column that
contains pointers to large objects. Figure 5-49 shows the display of column
information for a table that has a BYTE column.
id integer yes
binary_col byte yes
Opaque Data Types: An opaque data type characterizes data that cannot be
represented by any of the built-in types that belong to the database server.
DB–Access can identify and display opaque data types.
For example, suppose you assign an opaque data type called circle_t to a
column named circle_col. The Columns option displays the opaque data type
name in the Type column, as Figure 5-50 shows.
id integer yes
circle_col circle_t yes
Figure 5-50. Displaying Information for a Column with an Opaque Data Type
DB–Access displays the specific kind of collection type in the Type column.
For example, Figure 5-51 shows the display of a SET data type column named
siblings.
id integer yes
siblings set yes
Figure 5-51. Displaying Information for a Column with a Collection Data Type
Row Types: The Columns option for a table that includes a column with a
row type displays the string Row in the Type column. DB–Access displays
this string whether the column has a named or unnamed row type. Assume
you define row type rectangle_t and assign it to column rect. Figure 5-52
id integer yes
rect row yes
The following table shows the meaning of each column in the display.
Display Column Description
Index Name The name of the index
Owner The owner of the index
Type The index type (unique or duplicate)
Clstr Indicates whether the index is clustered. (A
clustered index causes the table to be
physically reordered in the same sequence as
the index.)
Access Method The index access method (such as B-tree or
functional)
Columns The column or columns on which the index is
defined
For further information about the types of indexes available on your database
server, see your IBM Informix: Performance Guide.
Dynamic Server
You can display information for non-B-tree indexes, including indexes based
on user-defined secondary access methods that Dynamic Server permits. For
Unless your login is listed separately, you have the privileges given for public
(a general category for all users).
betty col1
col2
col3
wilma All
public None
You can select from the following options on the CONSTRAINTS menu.
Select the referenceD option on the REFERENCE menu to display other tables
and columns that reference your current columns as foreign keys, as
Figure 5-60 shows.
constraint1 assembly
partnum
Select the Check option on the CONSTRAINTS menu to display the check
constraints placed on columns of the current table, as Figure 5-62 shows.
Displaying Triggers
When you select the triGgers option from the INFO menu, the INFO FOR
TRIGGER screen appears, as Figure 5-63 shows.
updrec_t
Select a trigger from the list of trigger names in the current table. If you do
not want to select a trigger, press the Interrupt key, and you return to the
TABLE INFO menu.
If the header and body information for the selected trigger fit on one screen,
the INFO menu reappears, displaying the trigger information, as Figure 5-64
shows.
Figure 5-64 shows the header information for a trigger, which consists of the
CREATE TRIGGER statement and trigger name, the SQL statement that
If the trigger does not fit on a single INFO menu screen, use the menu at the
top of the screen as follows:
v Press N, or if the Next option is highlighted, press RETURN to advance to the
next screen of trigger information. Continue to press N or RETURN as needed
to page through the information.
v Select Restart at any time to display the trigger information from the
beginning.
v Select Exit to return to the TABLE menu.
Displaying Fragmentation Information
Figure 5-65 shows the kind of information that you see when you select the
Fragments option for an indexed table created with a round-robin
fragmentation strategy.
cust dbspace1 T
cust dbspace2 T
cust rootdbs T
cust dbspace1 I
cust dbspace2 I
cust rootdbs I
Figure 5-65. Fragmentation Information where Round-Robin Strategy Applies to Both Table and
Index
Dynamic Server
If you use Dynamic Server, the display includes a Type column to indicate
whether the fragment on the line is part of an index or the table data. In
Figure 5-65, the cuts table was created with round-robin strategy, but the
index was created without specifying a strategy. In this case, the indexes are
located in default dbspaces.
End of Dynamic Server
Suppose, when creating an index, you use the following statement to apply a
fragmentation strategy:
create index idx on cust(custnum) fragment by expression
custnum < 200 in dbspace1,
custnum > 200 in dbspace2,
remainder in rootdbs;
cust dbspace1 T
cust dbspace2 T
cust rootdbs T
idx dbspace1 I (custnum < 200)
idx dbspace2 I (custnum > 200)
idx rootdbs I remainder
Figure 5-66. Fragmentation Information Where Table and Index Have Different Strategies
Idx/Tbl Name shows the index name because the fragmentation was explicitly
applied to the index.
Dropping a Table
Use the Drop option on the TABLE menu to delete an existing table schema
from the database. Press the D key, or highlight Drop and press RETURN. The
DROP TABLE screen appears, as Figure 5-67 shows.
clients
customer
orders
This screen lists the names of tables that exist in the current database. You can
delete a table in one of the following ways:
v Type the table name and press RETURN. You must use this method and
include the full pathname if you want to delete a table that is not in the
current database.
v Use the arrow keys to highlight the name of the table that you want to
delete from the database and press RETURN.
To leave the DROP TABLE screen without deleting a table, press the Interrupt
key. You return to the TABLE menu.
Warning: When you delete a table, you delete both the table and all the data
it contains.
clients
customer
orders
The default is No to prevent you from deleting a table. You must explicitly
delete a table. Thus, if you want to delete the highlighted table, press the Y
key or use the right arrow key to highlight Yes and press RETURN. DB–Access
deletes the table.
clients
customer
orders
This screen lists the names of tables that exist in the current database. You can
move a table in one of the following ways:
v Type the table name and press RETURN.
v Use the arrow keys to highlight the name of the table that you want to
move from the database and press RETURN.
To leave the MOVE TABLE screen without moving a table, you can press the
Interrupt key to return to the TABLE menu.
Note: You cannot use the Move option on the TABLE menu to move a table
that has dependency objects such as views or referential constraints
associated with it. To move such a table use the SQL Command MOVE
mydata@mydbserv
demodb@mydbserv
personnel@mynewdb
This screen lists the names of databases that are available in the current
instance. You can only move a table to a database that is in the same instance
as the database you are moving the table from. You can select the database in
one of these ways:
v Type the database name and press RETURN.
v Use the arrow keys to highlight the name of the database in which you
want to move a table and press RETURN.
After you select a database to move the table to, DB-Access displays the
″RENAME″ screen, you can use this to rename the table. The ″RENAME″
screen appears as Figure 5-71 shows.
RENAME >>
Enter a new name for the table or press enter to keep the same name.
To keep the original table and owner name, press RETURN at the prompt
without typing anything. To rename the table, type the name at the prompt
and press RETURN.
You can also change the owner of the table by including the name of the
owner in the new table name. For example to change the table name to
neworders and make the user john the owner you would type this:
john.neworders
Related Manuals
Have the following manuals available while you create or alter a table schema
or structure:
v For information on how to name a table or a column, see the IBM Informix:
Guide to SQL Syntax.
v For information about data types, see the IBM Informix: Guide to SQL
Reference.
v For information about fragmentation and storage space allocation, see your
IBM Informix: Administrator's Guide.
v For recommendations concerning fragmentation, indexes, and extent size,
see your IBM Informix: Performance Guide.
v For information about nondefault locale names and character data types
(CHAR, VARCHAR, NCHAR, NVARCHAR, and TEXT), see the
IBM Informix: GLS User's Guide.
v For information on how to design, implement, and manage your database,
see the IBM Informix: Database Design and Implementation Guide.
In This Chapter
This chapter describes the Connection and Session options on the main menu.
Use the Connection option if you want to connect to a specific database server
and database or explicitly disconnect from the current database environment.
Use the Session option to display information about the current DB–Access
session.
coral
cowry
seahorse
starfish
If you do not specify a user identifier on the USER NAME screen and press
RETURN, you see the standard SELECT DATABASE screen listing databases on
the chosen database server.
If you enter the login name that you want DB–Access to use when connecting
to the target database server, DB–Access displays the PASSWORD screen, as
Figure 6-3 shows.
coral
cowry
seahorse
starfish
From the PASSWORD screen, enter a password associated with the user
identifier or press RETURN if you do not want to enter a password. For security
reasons, the password that you enter on the screen is not displayed.
Tip: If you press CRTL-C on the USER NAME screen, DB–Access might try to
connect to the specified database server rather than interrupt the session.
This situation occurs because pressing CRTL-C on this screen is the
equivalent of using the current user name.
If the user identifier and password combination are valid, you connect to the
target database server. You can then select a database from that database
server. The SELECT DATABASE SERVER screen appears, as Figure 6-4 shows.
coral
cowry
seahorse
starfish
Permissions Needed
To access a specific database, you must have permission. If you do not have
permission to connect to the specified database server, an error message
If you have the correct permissions for the specified database server, you are
prompted to specify a database to use on that database server.
When the SELECT DATABASE screen appears, the name of the specified
database server is highlighted, as Figure 6-5 shows.
borabora@coral
huahine@coral
moorea@corala
To select a database, type the database name or use the arrow keys to
highlight the name of a database, then press RETURN.
If you enter the CONNECT menu with a current connection, and the new
connection succeeds, DB–Access disconnects from the previous environment
and closes any databases that belong to that environment. For more
information, see “Implicit Closures” on page 6-5.
DISCONNECT: Yes No
Disconnect from the current database environment.
When you select the Disconnect option from the CONNECTION menu, you
must confirm your decision on the DISCONNECT confirmation screen. The
following two options are available:
v To confirm that you want to disconnect, press RETURN with the default Yes
option highlighted. DB–Access disconnects from the database server and
closes the database.
v If you do not want to disconnect, press the N key or use the right arrow key
to highlight No, and press RETURN. DB–Access returns to the CONNECTION
menu.
Transaction Processing
A database that has transaction logging prompts you to confirm or roll back
any transactions when you explicitly disconnect from the current database
environment or when you connect to another environment, which forces
The TRANSACTION menu ensures that you either commit or roll back an
active transaction before you close the current database. You have the
following menu options:
v The default is Commit. Press RETURN, and DB–Access commits the
transaction and closes the database.
v If you want to roll back the transaction, use an arrow key to move the
highlight to the Rollback option. Press RETURN and DB–Access rolls back the
transaction and closes the database.
Warning: Select an option carefully. You might commit transactions that you
do not want if you select Commit. You will lose any new
transactions if you select Rollback.
If you press the Interrupt key, DB–Access displays the DATABASE menu
without committing or rolling back the transaction.
Server
coral
OnLine
Connected to host carrots
Multi-threaded
Figure 6-8. Main Menu with Sample Session Information for a Dynamic Server Instance
If you are running a legacy database that supports Native Language Support,
the Session option shows the collating sequence and character type.
End of Native Language Support
The Session option does not display Global Language Support attributes, but
you can use the method shown in “Retrieving Nondefault Locale
Information” on page 4-8 to obtain these settings.
End of Global Language Support
To exit from the Session information screen, select another option on the main
menu.
The form of the syntax diagrams that appears when you request online Help
for SQL statements in DB–Access is different from the syntax diagrams in the
IBM Informix: Guide to SQL Syntax.
This syntax indicates that you can type either CREATE TABLE
or CREATE TEMP TABLE.
| The vertical bar indicates a choice among several options. For
example:
[VANILLA | CHOCOLATE [MINT] | STRAWBERRY]
The IBM Informix: Guide to SQL Syntax contains more detailed syntax
diagrams, as well as instructions for interpreting the diagram format used in
that book.
For a general explanation of how to use online Help in DB–Access, see “Using
the HELP Screen” on page 2-5.
Keywords in these command files are shown in uppercase letters to make the
SQL statements easier to read. Keywords in the actual command files are
lowercase.
When you select the Choose option on the SQL menu, the CHOOSE screen
appears. It displays a list of the command files that you can access, similar to
the display that Figure B-1 shows. These files are included with the
stores_demo database. Other .sql files are discussed later in this appendix.
CHOOSE >>
Choose a command file with the Arrow Keys, or enter a name, then press Return.
If you do not see the command files included with your demonstration
database, check the following:
Use these command files with DB–Access for practice with SQL and the
demonstration database. You can rerun the demonstration database
initialization script whenever you want to refresh the database tables and SQL
files.
c_calls.sql
The following command file creates the cust_calls table:
CREATE TABLE cust_calls
(
customer_num INTEGER,
call_dtime DATETIME YEAR TO MINUTE,
user_id CHAR(18) DEFAULT USER,
call_code CHAR(1),
call_descr CHAR(240),
res_dtime DATETIME YEAR TO MINUTE,
res_descr CHAR(240),
PRIMARY KEY (customer_num, call_dtime),
FOREIGN KEY (customer_num) REFERENCES customer (customer_num),
FOREIGN KEY (call_code) REFERENCES call_type (call_code)
);
c_custom.sql
The following command file creates the customer table:
CREATE TABLE customer
(
customer_num SERIAL(101),
fname CHAR(15),
lname CHAR(15),
company CHAR(20),
address1 CHAR(20),
address2 CHAR(20),
city CHAR(15),
state CHAR(2),
zipcode CHAR(5),
phone CHAR(18),
PRIMARY KEY (customer_num)
);
c_index.sql
The following command file creates an index on the zipcode column of the
customer table:
CREATE INDEX zip_ix ON customer (zipcode);
c_items.sql
The following command file creates the items table:
CREATE TABLE items
(
item_num SMALLINT,
order_num INTEGER,
stock_num SMALLINT NOT NULL,
manu_code CHAR(3) NOT NULL,
quantity SMALLINT CHECK (quantity >= 1),
total_price MONEY(8),
PRIMARY KEY (item_num, order_num),
c_manuf.sql
The following command file creates the manufact table:
CREATE TABLE manufact
(
manu_code CHAR(3),
manu_name CHAR(15),
lead_time INTERVAL DAY(3) TO DAY,
PRIMARY KEY (manu_code)
);
c_orders.sql
The following command file creates the orders table:
CREATE TABLE orders
(
order_num SERIAL(1001),
order_date DATE,
customer_num INTEGER NOT NULL,
ship_instruct CHAR(40),
backlog CHAR(1),
po_num CHAR(10),
ship_date DATE,
ship_weight DECIMAL(8,2),
ship_charge MONEY(6),
paid_date DATE,
PRIMARY KEY (order_num),
FOREIGN KEY (customer_num) REFERENCES customer (customer_num)
);
c_proc.sql
The following command file creates an SPL routine. It reads the full name and
address of a customer and takes a last name as its only argument.
Dynamic Server
To conform with the SQL standard preferred with Dynamic Server, define a
function if you want to return values from a routine.
End of Dynamic Server
CREATE PROCEDURE read_address (lastname CHAR(15))
RETURNING CHAR(15), CHAR(15), CHAR(20), CHAR(15), CHAR(2), CHAR(5);
DEFINE p_fname, p_city CHAR(15);
DEFINE p_add CHAR(20);
DEFINE p_state CHAR(2);
DEFINE p_zip CHAR(5);
SELECT fname, address1, city, state, zipcode
INTO p_fname, p_add, p_city, p_state, p_zip
FROM customer
END PROCEDURE;
c_state
The following command file creates the state table:
CREATE TABLE state
(
code CHAR(2),
sname CHAR(15),
PRIMARY KEY (code)
);
c_stock.sql
The following command file creates the stock table:
CREATE TABLE stock
(
stock_num SMALLINT,
manu_code CHAR(3),
description CHAR(15),
unit_price MONEY(6),
unit CHAR(4),
unit_descr CHAR(15),
PRIMARY KEY (stock_num, manu_code),
FOREIGN KEY (manu_code) REFERENCES manufact
);
c_stores.sql
The following command file creates the stores_demo database:
CREATE DATABASE stores_demo;
c_table.sql
The following command file creates a database named restock and then
creates a custom table named sports in that database:
CREATE DATABASE restock;
c_trig.sql
The following command file creates a table named log_record and then
creates a trigger named upqty_i, which updates it:
c_type.sql
The following command file creates the call_type table:
CREATE TABLE call_type
(
call_code CHAR(1),
code_descr CHAR(30),
PRIMARY KEY (call_code)
);
c_view1.sql
The following command file creates a view called custview on a single table
and grants privileges on the view to public. It includes the WITH CHECK
OPTION keywords to verify that any changes made to underlying tables
through the view do not violate the definition of the view.
CREATE VIEW custview (firstname, lastname, company, city) AS
SELECT fname, lname, company, city
FROM customer
WHERE city = ’Redwood City’
WITH CHECK OPTION;
c_view2.sql
The following command file creates a view on the orders and items tables:
CREATE VIEW someorders (custnum,ocustnum,newprice) AS
SELECT orders.order_num, items.order_num,
items.total_price*1.5
FROM orders, items
WHERE orders.order_num = items.order_num
AND items.total_price > 100.00;
d_trig.sql
The following command file drops the trigger that the c_trig.sql command file
created:
DROP TRIGGER upqty_i;
d_view.sql
The following command file drops the view named custview that the
c_view1.sql command file created:
DROP VIEW custview;
del_stock.sql
The following command file deletes rows from the stock table where the stock
number is 102. This delete will cascade to the catalog table (although the
related manufacturer codes will remain in the manufact table). The
del_stock.sql command file can be used following the alt_cat.sql command
file for practice with cascading deletes on a database with logging.
DELETE FROM stock WHERE stock_num = 102;
The stores_demo database has been changed. You might want to rerun the
dbaccessdemo script to rebuild the original database.
ins_table.sql
The following command file inserts one row into the sports table that the
c_table.sql command file created:
INSERT INTO sports
VALUES (0,18,’PARKR’, ’Parker Products’, ’503-555-1212’,
’Heavy-weight cotton canvas gi, designed for aikido or
judo but suitable for karate. Quilted top with side ties,
drawstring waist on pants. White with white belt.
Pre-washed for minimum shrinkage. Sizes 3-6.’);
opt_disk.sql
The following command file provides an example of a SELECT statement on
an optical-disc subsystem. It includes the read-only family() and volume()
operators that support optical storage. (This is available only with the Optical
Subsystem.)
sel_agg.sql
The SELECT statement in the following command file queries on table data
using aggregate functions. It combines the aggregate functions MAX and MIN
in a single statement.
SELECT MAX (ship_charge), MIN (ship_charge)
FROM orders;
sel_all.sql
The following example command file contains all seven SELECT statement
clauses that you can use in the Informix implementation of interactive SQL.
This SELECT statement joins the orders and items tables. It also uses display
labels, table aliases, and integers as column indicators; groups and orders the
data; and puts the results into a temporary table.
SELECT o.order_num, SUM (i.total_price) price,
paid_date - order_date span
FROM orders o, items i
WHERE o.order_date > ’01/01/90’
AND o.customer_num > 110
AND o.order_num = i.order_num
GROUP BY 1, 3
HAVING COUNT (*) < 5
ORDER BY 3
INTO TEMP temptab1;
sel_group.sql
The following example command file includes the GROUP BY and HAVING
clauses. The HAVING clause usually complements a GROUP BY clause by
applying one or more qualifying conditions to groups after they are formed,
which is similar to the way the WHERE clause qualifies individual rows. (One
advantage to using a HAVING clause is that you can include aggregates in
the search condition; you cannot include aggregates in the search condition of
a WHERE clause.)
sel_join.sql
The following example command file uses a simple join on the customer and
cust_calls tables. This query returns only those rows that show the customer
has made a call to customer service.
SELECT c.customer_num, c.lname, c.company,
c.phone, u.call_dtime, u.call_descr
FROM customer c, cust_calls u
WHERE c.customer_num = u.customer_num;
sel_ojoin1.sql
The following example command file uses a simple outer join on two tables.
The use of the keyword OUTER in front of the cust_calls table makes it the
subservient table. An outer join causes the query to return information on all
customers, even if they do not make calls to customer service. All rows from
the dominant customer table are retrieved, and null values are assigned to
corresponding rows from the subservient cust_calls table.
SELECT c.customer_num, c.lname, c.company,
c.phone, u.call_dtime, u.call_descr
FROM customer c, OUTER cust_calls u
WHERE c.customer_num = u.customer_num;
sel_ojoin2.sql
The following example command file creates an outer join, which is the result
of a simple join to a third table. This second type of outer join is called a
nested simple join.
This query first performs a simple join on the orders and items tables,
retrieving information on all orders for items with a manu_code of KAR or
SHM. It then performs an outer join, which combines this information with
data from the dominant customer table. An optional ORDER BY clause
reorganizes the data.
SELECT c.customer_num, c.lname, o.order_num,
i.stock_num, i.manu_code, i.quantity
FROM customer c, OUTER (orders o, items i)
WHERE c.customer_num = o.customer_num
AND o.order_num = i.order_num
AND manu_code IN (’KAR’, ’SHM’)
ORDER BY lname;
sel_ojoin3.sql
The following example SELECT statement is the third type of outer join,
known as a nested outer join. It queries on table data by creating an outer join,
which is the result of an outer join to a third table.
sel_ojoin4.sql
The following example queries on table data using the fourth type of outer
join. This query shows an outer join, which is the result of an outer join of
each of two tables to a third table. In this type of outer join, join relationships
are possible only between the dominant table and subservient tables.
This query individually joins the subservient tables orders and cust_calls to
the dominant customer table but does not join the two subservient tables. (An
INTO TEMP clause selects the results into a temporary table.)
SELECT c.customer_num, lname, o.order_num,
order_date, call_dtime
FROM customer c, OUTER orders o, OUTER cust_calls x
WHERE c.customer_num = o.customer_num
AND c.customer_num = x.customer_num
INTO temp service;
sel_order.sql
The following example uses the ORDER BY and WHERE clauses to query. In
this SELECT statement, the comparison ’bicycle%’ (LIKE condition, or
’bicycle*’ for a MATCHES condition) specifies the letters bicycle followed by
any sequence of zero or more characters. It narrows the search further by
adding another comparison condition that excludes a manu_code of PRC.
SELECT * FROM stock
WHERE description LIKE ’bicycle%’
AND manu_code NOT LIKE ’PRC’
ORDER BY description, manu_code;
sel_sub.sql
The following example uses a subquery to query. This self-join uses a
correlated subquery to retrieve and list the 10 highest-priced items ordered.
SELECT order_num, total_price
FROM items a
WHERE 10 >
sel_union.sql
The following example uses the UNION clause to query on data in two tables.
The compound query performs a union on the stock_num and manu_code
columns in the stock and items tables. The statement selects items that have a
unit price of less than $25.00 or that have been ordered in quantities greater
than three, and it lists their stock_num and manu_code.
SELECT DISTINCT stock_num, manu_code
FROM stock
WHERE unit_price < 25.00
UNION
upd_table.sql
The following example updates the sports table that the c_table.sql command
file created:
UPDATE sports
SET phone = ’808-555-1212’
WHERE mfg_code = ’PARKR’;
loaddw.sql
This file contains the commands necessary to load data from two sources:
v The files with the extension .unl in your demonstration directory
v Data selected from the stores_demo database
connect to "sales_demo";
load from ’costs.unl’
insert into cost;
load from ’time.unl’
insert into time;
connect to "sales_demo";
load from ’costs.unl’
insert into cost;
load from ’time.unl’
insert into time;
The superstores_demo database has row types and tables to support the
following table-inheritance hierarchies:
v customer/retail_customer
v customer/whlsale_customer
v location/location_us
v location/location_non_us
Each line starts with a dotted decimal number; for example, 3 or 3.1 or 3.1.1.
To hear these numbers correctly, make sure that your screen reader is set to
read punctuation. All syntax elements that have the same dotted decimal
number (for example, all syntax elements that have the number 3.1) are
mutually exclusive alternatives. If you hear the lines 3.1 USERID and 3.1
SYSTEMID, your syntax can include either USERID or SYSTEMID, but not both.
The dotted decimal numbering level denotes the level of nesting. For example,
if a syntax element with dotted decimal number 3 is followed by a series of
syntax elements with dotted decimal number 3.1, all the syntax elements
numbered 3.1 are subordinate to the syntax element numbered 3.
Certain words and symbols are used next to the dotted decimal numbers to
add information about the syntax elements. Occasionally, these words and
symbols might occur at the beginning of the element itself. For ease of
identification, if the word or symbol is a part of the syntax element, the word
or symbol is preceded by the backslash (\) character. The * symbol can be
used next to a dotted decimal number to indicate that the syntax element
repeats. For example, syntax element *FILE with dotted decimal number 3 is
read as 3 \* FILE. Format 3* FILE indicates that syntax element FILE repeats.
Format 3* \* FILE indicates that syntax element * FILE repeats.
The following words and symbols are used next to the dotted decimal
numbers:
? Specifies an optional syntax element. A dotted decimal number
followed by the ? symbol indicates that all the syntax elements with a
corresponding dotted decimal number, and any subordinate syntax
elements, are optional. If there is only one syntax element with a
dotted decimal number, the ? symbol is displayed on the same line as
the syntax element (for example, 5? NOTIFY). If there is more than one
syntax element with a dotted decimal number, the ? symbol is
displayed on a line by itself, followed by the syntax elements that are
optional. For example, if you hear the lines 5 ?, 5 NOTIFY, and 5
UPDATE, you know that syntax elements NOTIFY and UPDATE are
optional; that is, you can choose one or none of them. The ? symbol is
equivalent to a bypass line in a railroad diagram.
! Specifies a default syntax element. A dotted decimal number followed
by the ! symbol and a syntax element indicates that the syntax
element is the default option for all syntax elements that share the
same dotted decimal number. Only one of the syntax elements that
share the same dotted decimal number can specify a ! symbol. For
example, if you hear the lines 2? FILE, 2.1! (KEEP), and 2.1
(DELETE), you know that (KEEP) is the default option for the FILE
keyword. In this example, if you include the FILE keyword but do not
specify an option, default option KEEP is applied. A default option also
applies to the next higher dotted decimal number. In this example, if
the FILE keyword is omitted, default FILE(KEEP) is used. However, if
you hear the lines 2? FILE, 2.1, 2.1.1! (KEEP), and 2.1.1 (DELETE),
the default option KEEP only applies to the next higher dotted
decimal number, 2.1 (which does not have an associated keyword),
and does not apply to 2? FILE. Nothing is used if the keyword FILE is
omitted.
* Specifies a syntax element that can be repeated zero or more times. A
dotted decimal number followed by the * symbol indicates that this
syntax element can be used zero or more times; that is, it is optional
and can be repeated. For example, if you hear the line 5.1*
data-area, you know that you can include more than one data area or
IBM may have patents or pending patent applications covering subject matter
described in this document. The furnishing of this document does not give
you any license to these patents. You can send license inquiries, in writing, to:
IBM Director of Licensing
IBM Corporation
North Castle Drive
Armonk, NY 10504-1785
U.S.A.
The following paragraph does not apply to the United Kingdom or any
other country where such provisions are inconsistent with local law:
INTERNATIONAL BUSINESS MACHINES CORPORATION PROVIDES THIS
PUBLICATION “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER
EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY
OR FITNESS FOR A PARTICULAR PURPOSE. Some states do not allow
disclaimer of express or implied warranties in certain transactions, therefore,
this statement may not apply to you.
Any references in this information to non-IBM Web sites are provided for
convenience only and do not in any manner serve as an endorsement of those
Web sites. The materials at those Web sites are not part of the materials for
this IBM product and use of those Web sites is at your own risk.
IBM may use or distribute any of the information you supply in any way it
believes appropriate without incurring any obligation to you.
Licensees of this program who wish to have information about it for the
purpose of enabling: (i) the exchange of information between independently
created programs and other programs (including this one) and (ii) the mutual
use of the information which has been exchanged, should contact:
IBM Corporation
J46A/G4
555 Bailey Avenue
San Jose, CA 95141-1003
U.S.A.
The licensed program described in this information and all licensed material
available for it are provided by IBM under terms of the IBM Customer
Agreement, IBM International Program License Agreement, or any equivalent
agreement between us.
All IBM prices shown are IBM’s suggested retail prices, are current and are
subject to change without notice. Dealer prices may vary.
This information contains examples of data and reports used in daily business
operations. To illustrate them as completely as possible, the examples include
the names of individuals, companies, brands, and products. All of these
names are fictitious and any similarity to the names and addresses used by an
actual business enterprise is entirely coincidental.
COPYRIGHT LICENSE:
Each copy or any portion of these sample programs or any derivative work,
must include a copyright notice as follows:
© (your company name) (year). Portions of this code are derived from IBM
Corp. Sample Programs. © Copyright IBM Corp. (enter the year or years).
All rights reserved.
If you are viewing this information softcopy, the photographs and color
illustrations may not appear.
Notices D-3
Trademarks
AIX; DB2; DB2 Universal Database; Distributed Relational Database
Architecture; NUMA-Q; OS/2, OS/390, and OS/400; IBM Informix®;
C-ISAM®; Foundation.2000™; IBM Informix ® 4GL; IBM
Informix®DataBlade®Module; Client SDK™; Cloudscape™; Cloudsync™; IBM
Informix®Connect; IBM Informix®Driver for JDBC; Dynamic Connect™; IBM
Informix®Dynamic Scalable Architecture™(DSA); IBM Informix®Dynamic
Server™; IBM Informix®Enterprise Gateway Manager (Enterprise Gateway
Manager); IBM Informix®Extended Parallel Server™; i.Financial Services™;
J/Foundation™; MaxConnect™; Object Translator™; Red Brick™; IBM
Informix® SE; IBM Informix® SQL; InformiXML™; RedBack®; SystemBuilder™;
U2™; UniData®; UniVerse®; wintegrate®are trademarks or registered
trademarks of International Business Machines Corporation.
Java and all Java-based trademarks and logos are trademarks or registered
trademarks of Sun Microsystems, Inc. in the United States and other countries.
Other company, product, and service names used in this publication may be
trademarks or service marks of others.
Index X-3
dbspace (continued) Demonstration database (continued)
Round-robin fragmentation with 5-16 superstores_demo 1-7
SELECT DBSPACE screen 4-5 superstores_demo setup 1-9
specifying for table storage 5-14 working directory required for 1-8
storing a database 4-5 Dependencies, software viii
DECIMAL data type 5-37 Disabilities, visual
DECIMAL(p) values reading syntax diagrams C-1
checking, scale of 1-18 Disconnecting from a database environment 6-5
Default Disk space, managing with Extent Size screen 5-23
ADD DEFAULT TYPE menu 5-32 Distinct data type B-15
ADD DEFAULT VALUE menu 5-33 Distributed databases, requesting table information on
column type, null 5-32 another server 5-34
column values 5-32 Documentation conventions ix
column values, data validation 5-33 Documentation Notes xvi
column values, defining 5-31 Documentation set of all manuals xviii
column values, displaying 3-19 Documentation, types of xv
column, adding 5-32 machine notes xvi
column, data validation 5-33 online manuals xviii
database server, selecting 6-3 printed manuals xviii
dbspace for database data 4-5 Dotted decimal format of syntax diagrams C-1
defining values for columns 5-31 DROP DATABASE screen
dropping a check constraint 5-29 selecting from the DATABASE menu 4-10
dropping a foreign key 5-28 two ways to drop a database 4-10
for ADD DUPLICATES screen 5-10 Drop option
for ADD NAME screen 5-6 confirmation screen for dropping command
for CREATE DATABASE confirmation screen 4-5 files 3-21
for DISCONNECT confirmation screen 6-5 SQL menu 3-20
for DROP COMMAND FILE confirmation Dropping a command file
screen 3-21 confirming your decision 3-21
for DROP TABLE confirmation screen 5-46 from a menu 3-20
for exiting CREATE DATABASE menu 4-6 Dropping a database, from a menu 4-10
for LOCK MODE menu 5-24 Dropping a table
for LOG menu 4-5 confirming your decision 5-46
initial extent size 5-24 from a menu 5-45
length and scale, for number type 5-9 Dropping an SQL statement
length, for CHAR data type 5-9 confirming your decision 3-21
length, for MONEY data type 5-9 from a menu 3-20
length, for NCHAR data type 5-9
number, for SERIAL data type 5-9 E
operating system editor 3-3 Editor
printer, sending output to 3-15 creating new SQL statements 3-5
table storage location 5-14 entering literal values 5-32
Default locale viii modifying SQL statements 3-13
DEFAULTS menu 5-31 restrictions 3-6
DELETE key 2-2 text 2-6
Deletes, enabling cascading 5-28 en_us.8859-1 locale viii
DELIMIDENT environment variable 1-5, 1-6 ENABLE CASCADING DELETES menu 5-28
Demonstration database 1-6 Environment variables ix
installing 1-8 DBACCNOIGN 1-5
models 1-7 DBANSIWARN 1-18, 3-7
reinitializing 1-7 DBEDIT 1-5
sales_demo 1-9 DBFLTMASK 1-5
SQL command files B-1 DBPATH 3-17, 4-3
stores_demo setup 1-8 DELIMIDENT 1-5, 1-6
stores_demo, SQL command files B-2 IFMX_HISTORY_SIZE 1-6
Index X-5
INFO menu (continued) Keys (continued)
References option 5-40 RETURN 2-3
triGgers option 5-43 SPACEBAR 2-3
with SQL 5-35 used with SQL editor 3-5
Info option Keywords
Columns option 5-36 in syntax diagrams xiii
cOnstraints option 5-41
DATABASE menu 4-6 L
Exit option 5-36 Large objects
Indexes option 5-39 defined 5-37
Privileges option 5-40 simple 5-37
References option 5-40 smart 5-37
SQL menu 3-19 LIST data type 5-38
TABLE menu 5-3 Literal, assigning default value 5-32
Table option 5-36 Locale viii
triGgers option 5-43, 5-44 default viii
Information en_us.8859-1 viii
displaying for current database 4-6 LOCK MODE menu 5-24
displaying for current session 6-6 Lock mode, specifying page or row 5-24
displaying for tables 3-19, 5-34 LOG menu 4-5
Information Schema 1-17 Logging
Informix Dynamic Server documentation set xviii creating a database with 4-5
INFORMIXDIR/bin directory 1-7 specifying buffered or unbuffered 4-5
Input
interactive 1-20 M
reading from standard 1-19 Machine notes xvi
Installation Guides xv Main menu
INT8 data type 5-37 displaying from the command line 1-12
INTEGER data type 5-37 Query-language option 3-3
Interactive input, through standard input 1-20 selecting the Connection option 6-1
Interrupt key 2-2 selecting the Session option 6-6
INTERVAL data type 5-37 selecting the Table option 5-2
Invoking DB-Access Menu options
checking for ANSI compliance 1-18 CONNECTION menu 6-2
command-line options 1-10 DATABASE menu 4-2
DATABASE menu options 1-14 SQL menu 3-4
displaying the main menu 1-12 TABLE menu 5-3
executing a command file 1-17 Menus
SQL menu options 1-15 ADD CHECK VALUE 5-29
TABLE menu options 1-16 ADD DEFAULT TYPE 5-32
ISO 8859-1 code set viii ADD DEFAULT VALUE 5-33
ADD NULLS 5-11
K ADD TYPE 5-7
Keys chart of 1-3
arrow 2-2 CHECK CONSTRAINTS 5-29
BACKSPACE 2-2 CONNECTION 6-1
CONTROL 2-2 CONSTRAINTS 5-25, 5-41
CTRL-A 3-5 DEFAULTS 5-31
CTRL-D 1-20, 3-5 ENABLE CASCADING DELETES 5-28
CTRL-R 3-5 example 2-4
CTRL-W 2-5, A-1 HELP 2-5
CTRL-X 3-5 how to exit 2-4
DELETE 2-2 how to select an option 2-3
ESCAPE 2-2, 3-5 INFO 5-35
Interrupt 2-2 LOCK MODE 5-24
Index X-7
Running SQL statements (continued) Shell (continued)
when there are no errors 3-7 Korn 1-20
Sitename, saving in a column 5-32
S Size
sales_demo 1-7 setting initial extent 5-23
Sample-code conventions xiv setting next extent 5-23
Save option SMALLFLOAT data type 5-37
rules for naming saved files 3-18 SMALLINT data type 5-37
SQL menu 3-18 Software dependencies viii
Saving command files 3-18 SPACEBAR 2-3
Schema editor SPACEBAR key 2-3
creating a table 5-6 SPL Routines 3-21
defining a column 5-6 SQL
dropping a column from a table 5-12 entering statements 3-4
EXIT menu 5-11 how to read syntax in online Help screens A-1
Schema, building table with 5-11 INFO statement equivalent 3-19
Screen reader using from a menu 3-10
reading syntax diagrams C-1 SQL code xiv
Screens SQL command files
ADD FILL FACTOR PERCENTAGE 5-10 must be in current directory 1-7
CHOOSE 3-17 requirements for listing with Choose
CREATE DATABASE confirmation 4-6 command 3-17
DISCONNECT confirmation 6-5 sales_demo B-11
example 2-4 SQL editor
for DATABASE menu 4-1, 4-11 assigning default data type for column 5-32
for SQL menu 3-3, 3-21 CTRL-A editing key 3-5
for TABLE menu 5-2 CTRL-D editing key 3-5
for text entry 2-4 CTRL-R editing key 3-5
how to enter text 2-4 CTRL-X editing key 3-5
how to exit 2-5 editing keys 3-5
INFO FOR TABLE 5-34 editing restrictions 3-6
SELECT BLOBSPACE 5-9 ESC key 3-5
SELECT DATABASE 6-4 how to use 3-5
SELECT DATABASE SERVER 6-3 modifying SQL statements 3-13
SELECT DBSPACE 5-14 new SQL statements 3-5
SELECT PROCEDURE 4-9 SQL menu
SELECT ROUTINE 4-9 available options 3-4
structure of header 2-4 Choose option 3-16
SELECT BLOBSPACE screen 5-9 CHOOSE screen 3-16
SELECT DATABASE screen 6-4 Drop option 3-20
exit without selecting a database 6-4 Info option 3-19
selecting from the DATABASE menu 4-2 Modify option 3-13
two ways to select a database 4-3 OUTPUT menu 3-14
SELECT DATABASE SERVER screen 6-2, 6-3 Output option 3-14
SELECT DBSPACE screen 5-14 Run option 3-7
SELECT ROUTINE screen 4-9 running new SQL statements 3-7
Selecting a database server 6-2 Save option 3-18
Selecting a database, from a menu 4-2 SAVE screen 3-18
SERIAL data type 5-37 selecting options from the command line 1-15
SERIAL8 data type 5-37 SQL statements
Session information 6-6 appending query results to an existing file 3-15
SET data type 5-38 choosing a command file 3-16
Shell current, defined 3-2
Bourne 1-20 dropping 3-20
C 1-20 editing 3-2
Index X-9
UNIX (continued)
system editors 3-3
UNIX operating system
default locale for viii
USER clause of CONNECT statement
in DB-Access interactive mode 1-21
User id, saving in a column 5-32
User name
CONNECT statement with 1-21
specifying when connecting in background
mode 1-22
USER NAME prompt screen 6-2
user-defined data types 5-7
Users, types of viii
V
VARCHAR data type 5-37
Variables, in syntax diagrams xiv
Visual disabilities
reading syntax diagrams C-1
W
Windows NT
default locale for viii
Working directory 1-8
Y
Year values, two and four digit 1-5
Printed in USA
G251-2277-00
Spine information:
IBM DB2 IBM Informix Version 10.0/8.5 IBM Informix DB-Access User’s Guide