0% found this document useful (0 votes)
78 views88 pages

3630

manual de informix
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
78 views88 pages

3630

manual de informix
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 88

®

INFORMIX-Universal
Server

Using the SQL Editor

Version 2.0
December 1996
Part No. 000-3630
Published by INFORMIX Press Informix Software, Inc.
4100 Bohannon Drive
Menlo Park, CA 94025

Copyright  1981-1996 by Informix Software, Inc.; provided, portions may be copyright in third parties, as set
forth in documentation. All rights reserved.

The following are worldwide trademarks of Informix Software, Inc., or its subsidiaries, registered in the
United States of America as indicated by “,” and in numerous other countries worldwide:

INFORMIX

The following are worldwide trademarks of the indicated owners or their subsidiaries, registered in theUnited
States of America as indicated by “,” and in numerous other countries worldwide:

Adobe Systems Incorporated: PostScript


All other marks or symbols are registered trademarks or trademarks of their respective owners.

To the extent that this software allows the user to store, display, and otherwise manipulate various forms of
data, including, without limitation, multimedia content such as photographs, movies, music and other binary
large objects (blobs), use of any single blob may potentially infringe upon numerous different third-party
intellectual and/or proprietary rights. It is the user's responsibility to avoid infringements of any such third-
party rights.

RESTRICTED RIGHTS/SPECIAL LICENSE RIGHTS

Software and documentation acquired with US Government funds are provided with rights as follows: (1) if
for civilian agency use, with Restricted Rights as defined in FAR 52.227-19; (2) if for Dept. of Defense use, with
rights as restricted by vendor's standard license, unless superseded by negotiated vendor license as prescribed
in DFAR 227.7202. Any whole or partial reproduction of software or documentation marked with this legend
must reproduce the legend.

ii Using the SQL Editor


Table of
Contents

Table of Contents

Introduction
About This Manual . . . . . . . . . . . . . . . . . . 3
Organization of This Manual . . . . . . . . . . . . . 4
Documentation Conventions . . . . . . . . . . . . . . 4
Typographical Conventions . . . . . . . . . . . . . 5
Icon Conventions . . . . . . . . . . . . . . . . . 6
Command-Line Conventions . . . . . . . . . . . . . 6
Screen-Illustration Conventions . . . . . . . . . . . . 9
Additional Documentation . . . . . . . . . . . . . . . 9
Printed Documentation . . . . . . . . . . . . . . . 10
On-Line Documentation . . . . . . . . . . . . . . 10
Informix Welcomes Your Comments . . . . . . . . . . . . 12

Chapter 1 Introducing the SQL Editor


What is the SQL Editor? . . . . . . . . . . . . . . . . 1-3
Defining a Connection to a Database Server . . . . . . . . . 1-3
Setting Environment Variables . . . . . . . . . . . . 1-7
Launching the SQL Editor . . . . . . . . . . . . . . . 1-8
Launching from the Command Line . . . . . . . . . . 1-9
Obtaining Help . . . . . . . . . . . . . . . . . . . 1-11

Chapter 2 Using SQL Documents


Understanding the SQL Editor Window . . . . . . . . . . 2-3
Using the SQL Statements Text Box . . . . . . . . . . . 2-4
Using the Server/Database List Box . . . . . . . . . . 2-5
Using the SQL Result History Text Box . . . . . . . . . 2-5
Using the SQL Editor Menu Bar . . . . . . . . . . . . 2-5
Using the SQL Editor Toolbar . . . . . . . . . . . . . 2-6
Creating and Editing an SQL Document . . . . . . . . . . 2-8
Undoing Editing Actions . . . . . . . . . . . . . . 2-8
Locating and Replacing Text in a Document . . . . . . . . 2-9
Checking and Executing SQL Statements . . . . . . . . . . 2-10
Connecting to a Database Server or Database . . . . . . . 2-10
Checking SQL Statements . . . . . . . . . . . . . . 2-12
Executing SQL Statements . . . . . . . . . . . . . 2-12
Stopping Execution . . . . . . . . . . . . . . . . 2-13
Viewing Returned Database Data . . . . . . . . . . . . 2-13
Using the Returned Rows Grid . . . . . . . . . . . . . 2-14
Returning Complex Type Data . . . . . . . . . . . . 2-15
Using the Cell Viewer to View Returned Data . . . . . . . 2-17
Optimizing Query Performance . . . . . . . . . . . . . 2-19
Saving SQL Documents . . . . . . . . . . . . . . . . 2-19
Reverting to the Last Saved SQL Document . . . . . . . . . 2-21

Chapter 3 Supported SQL Statements


SQL Statement Categories . . . . . . . . . . . . . . . 3-5
Client/Server Connectivity Statements . . . . . . . . . . 3-6
Data Access Statements . . . . . . . . . . . . . . . . 3-7
Assigning Privileges to Users . . . . . . . . . . . . 3-7
Locking Data . . . . . . . . . . . . . . . . . . 3-12
Data Definition Statements . . . . . . . . . . . . . . . 3-13
Creating Databases . . . . . . . . . . . . . . . . 3-13
Modifying Databases . . . . . . . . . . . . . . . 3-16
Data Integrity Statements . . . . . . . . . . . . . . . 3-18
Enforcing Data Integrity . . . . . . . . . . . . . . 3-18
Data Manipulation Statements . . . . . . . . . . . . . 3-20
Modifying Data . . . . . . . . . . . . . . . . . 3-20
Retrieving Data . . . . . . . . . . . . . . . . . 3-20
Query Optimization Statements . . . . . . . . . . . . . 3-21
Evaluating the Current Optimization . . . . . . . . . . 3-21
Routine Statements . . . . . . . . . . . . . . . . . 3-23
Creating Procedures. . . . . . . . . . . . . . . . 3-24
Creating Functions . . . . . . . . . . . . . . . . 3-25
Executing, Modifying, and Removing Routines . . . . . . 3-26
Using Aggregates . . . . . . . . . . . . . . . . 3-26
Using Access Methods . . . . . . . . . . . . . . . 3-27

Appendix A Supporting Global Languages

Appendix B Error Messages

Index

iv Using the SQL Editor


Introduction

Introduction

About This Manual . . . . . . . . . . . . . . . . . . . 3


Organization of This Manual . . . . . . . . . . . . . . 4

Documentation Conventions . . . . . . . . . . . . . . . 4
Typographical Conventions . . . . . . . . . . . . . . 5
Icon Conventions . . . . . . . . . . . . . . . . . . 6
Command-Line Conventions . . . . . . . . . . . . . . 6
Screen-Illustration Conventions . . . . . . . . . . . . . 9

Additional Documentation . . . . . . . . . . . . . . . . 9
Printed Documentation . . . . . . . . . . . . . . . . 10
On-Line Documentation. . . . . . . . . . . . . . . . 10
On-Line Manuals . . . . . . . . . . . . . . . . . 11
On-Line Help . . . . . . . . . . . . . . . . . . 11
Release Notes, Documentation Notes, Machine Notes . . . . 11
Informix Welcomes Your Comments . . . . . . . . . . . . . 12
2 Using the SQL Editor
W elcome to the SQL Editor, the graphical product that enables you
to execute SQL statements within your windowing environment. The SQL
Editor provides an interface that makes it easy to create, edit, and save SQL
documents; check and execute SQL statements; and optimize query
performance.

In the SQL Editor, data that is returned by a SELECT statement or a RETURN


statement in a routine is displayed in the SQL Editor window. You can view,
save, or copy the resulting data. When you copy the data from the SQL Editor,
you can paste the data into a spreadsheet or a text editor.

About This Manual


This manual describes how to use the SQL Editor to create and manage
actions performed by SQL statements. To most efficiently use this manual,
you should:

■ know the operational features and characteristics of your system’s


windowing environment.
■ be familiar with general SQL statement syntax.

If you are unfamiliar with your windowing environment, refer to your


windowing environment documentation before continuing. If you are
unfamiliar with SQL, refer to the Informix Guide to SQL: Tutorial.

Introduction 3
Organization of This Manual

Organization of This Manual


This manual includes the following chapters and appendices:

■ This introduction provides an overview of the manual’s contents and


details the documentation conventions used.
■ Chapter 1, “Introducing the SQL Editor,” describes how to connect
to a database server, set environment variables, and launch the SQL
Editor. The help system is also discussed in this chapter.
■ Chapter 2, “Using SQL Documents,” provides a description of the
SQL Editor window. This chapter contains step-by-step instructions
on how to create, edit, and save an SQL document, prepare and
execute SQL statements, and view data returned by the SQL
statements.
■ Chapter 3, “Supported SQL Statements,” categorizes the supported
SQL statements into seven logical categories. Brief descriptions of the
supported SQL statements are included.
■ Appendix A, “Supporting Global Languages,” contains information
on how to use Global Language Support (GLS) in the SQL Editor.
■ Appendix B, “Error Messages,” describes error messages that can be
returned by the SQL Editor. This appendix also discusses the utility
that enables you to obtain an on-line description of an SQL error
message.

Documentation Conventions
This section describes the conventions that this manual uses. These conven-
tions make it easier to gather information from this and other volumes in the
documentation set.

4 Using the SQL Editor


Typographical Conventions

The following conventions are covered:

■ Typographical conventions
■ Icon conventions
■ Command-line conventions
■ Screen-illustration conventions

Typographical Conventions
This manual uses the following standard set of conventions to introduce new
terms, illustrate screen displays, describe command syntax, and so forth.

Convention Meaning

KEYWORD All keywords appear in uppercase letters. Words formatted as


keywords include SQL statements and environment variables.

italics Within text, new terms and emphasized words appear in italics.
Within syntax diagrams, values that you are to specify appear in
italics.

boldface Identifiers (names of classes, objects, constants, events, functions,


program variables, forms, labels, and reports), environment
variables, database names, filenames, table names, column names,
icons, menu items, command names, and other similar terms
appear in boldface type.

monospace Information that the product displays and information that you
enter appear in a monospace typeface.

KEYSTROKE Keys that you are to press appear as uppercase characters in a


straight font. ENTER and SHIFT are examples of keystroke
formatting.

♦ This symbol indicates the end of product- or environment-specific


information.

Introduction 5
Icon Conventions

Icon Conventions
Throughout the documentation, you will find text that is identified by several
different types of icons.

Comment icons identify warnings, important notes, or tips. This information


is always displayed in italics.

Product and environment icons identify paragraphs that contain product-


specific or environment-specific information. These icons can apply to a row
in a table, one or more paragraphs, or an entire section. A ♦ symbol indicates
the end of the product- or environment-specific information.

Command-Line Conventions
The Using the SQL Editor manual describes how to launch the SQL Editor
using command-line options. This manual also describes the dbschema
utility.

You enter command-line options and commands at the operating-system


prompt to perform certain functions. This section defines and illustrates the
format of the SQL statements that are available in Informix products. These
statements have their own conventions, which might include alternative
forms of a command or required and optional parts of the command.

Each syntax diagram displays the sequences of required and optional


elements that are valid in a command. A diagram begins at the upper-left
corner with a command. It ends at the upper-right corner with a vertical line.
Between these points, you can trace any path that does not stop or back up.
Each path describes a valid form of the command. You must supply a value
for words that are in italics.

6 Using the SQL Editor


Command-Line Conventions

You might encounter one or more of the following elements on a command-


line path.

Element Description

command This required element is usually the product name or


other keyword that invokes the product or calls the
compiler or preprocessor script for a compiled Informix
product. The command might appear alone or precede
one or more options. Enter commands in lowercase.

variable A word in italics represents a value that you must


supply, such as a database, file, or program name. A table
following the diagram explains the value.

/flag A flag is usually an abbreviation for a function, menu, or


option name, or for a compiler or preprocessor
argument. You must enter a flag exactly as shown,
including the preceding slash.

.ext A filename extension, such as .sql or .cob, might follow


a variable that represents a filename. The extension
might be optional in certain products.

(.,;+*-/) Punctuation and mathematical notations are literal


symbols that you must enter exactly as shown.

' ' Single quotation marks are literal symbols that you must
enter as shown.

Privileges
A reference in a box represents a subdiagram on the
p. 5-17 same page (if no page is supplied) or another page.
Imagine that the subdiagram is spliced into the main
Privileges diagram at this point.

A shaded option is the default action.


ALL

Syntax within a pair of arrows indicates a subdiagram.

(1 of 2)

Introduction 7
Command-Line Conventions

Element Description

The vertical line terminates the statement.

A branch below the main path indicates an optional


IS NULL path. (Any term on the main path is required, unless
NOT a branch can circumvent it.)

, A loop indicates a path that you can repeat. Punctuation


along the top of the loop indicates the separator symbol
variable for list items, as in this example.

, A gate ( 3 ) on a path indicates that you can only use


that path the indicated number of times, even if it is part
3 size of a larger loop. In this example, you can specify size
no more than three times within this statement segment.
(2 of 2)
Figure 1 illustrates how you read the command-line diagram for using the
message compiler utility, mkmsg.
Figure 1
Example of a Command-Line Diagram

mkmsg in-file

-v -Ddefines out-file

To construct the command correctly, start at the top left with the command
mkmsg. Then follow the diagram to the right, including the elements that
you want. The elements in the diagram are case sensitive.

8 Using the SQL Editor


Screen-Illustration Conventions

To read the example command-line diagram

1. Type the word mkmsg.


2. Use the optional -v flag and -Ddefines flag as necessary.
3. Type the name of the message file.
4. Optionally, type the name you want to give the compiled message
file.
At this point, your command is complete.
5. Press ENTER to execute the command.

Screen-Illustration Conventions
The illustrations in this manual represent a generic rendition of various
windowing environments. The windowing environment details of dialog
boxes, controls, and windows have been deleted or redesigned to provide
this generic look. Therefore, the illustrations in this manual depict the SQL
Editor a little differently than the way it might appear on your screen.

Additional Documentation
The Using the SQL Editor manual is included with other printed manuals, on-
line manuals, and on-line help.

This section describes the following parts of the documentation set:

■ Printed documentation
■ On-line documentation
■ Vendor-specific documentation
■ Related reading

Introduction 9
Printed Documentation

Printed Documentation
The following manuals are shipped with the INFORMIX-Universal Server
documentation set. These Informix manuals complement the information in
Using the SQL Editor:

■ Informix Guide to SQL: Tutorial. This manual provides a tutorial on


SQL as it is implemented by Informix products. It also describes the
fundamental ideas and terminology for planning and implementing
a relational database.
■ Informix Guide to SQL: Reference. This manual details the Informix
system catalog tables, describes Informix and common environment
variables that you should set, and describes the column data types
that Informix database servers support.
■ Informix Guide to SQL: Syntax. This manual provides a detailed guide
to the syntax of each SQL statement.

Informix Error Messages might also be useful if you do not want to look up
your error SQL messages on-line.

On-Line Documentation
Several different types of on-line documentation are available:

■ On-line manuals
■ On-line help
■ On-line error messages
■ Release notes, documentation notes, and machine notes

10 Using the SQL Editor


On-Line Documentation

On-Line Manuals
The Using the SQL Editor manual is provided on a CD so that you can view
and search for information on-line. For searches, you can specify a word or
phrase and specify which manuals you want to search. You can also place
electronic annotations and bookmarks on pages that are of particular interest
to you. Pages you view and print from the on-line manuals have the same
layout and design as the printed manuals.

On-Line Help
The SQL Editor on-line help facility provides a detailed, context-sensitive
explanation of program functions. Use the help file to access information
about each menu item. To invoke the on-line help, press F1.

Release Notes, Documentation Notes, Machine Notes


In addition to the printed set of Informix manuals, the following on-line files,
located in the release subdirectory of the installation directory, provide vital
information about application and performance issues. The available files
vary depending on your product version.

On-Line File Purpose

Documentation Describes features that are not covered in the manuals or that
notes have been modified since publication. These notes are named
for the manual that is described.

Product readme Describes feature differences from earlier versions of Informix


products and how these differences might affect current
products. This file also contains information about any known
problems and their workarounds.

Machine notes Describes any special actions that are required to configure and
use Informix products on your computer. Machine notes are
named for the product that is described.

Introduction 11
Informix Welcomes Your Comments

Informix Welcomes Your Comments


We need your help in identifying strengths and weaknesses in our manuals.
If you find areas in need of correction, clarification, or more information,
please let us know. Your information will help us better document future
versions of our products.

Send your comments to us, along with the manual title and version number,
using one of the following methods. Make sure you include your name,
address, and telephone number (or email address) with your comments.

32 USA Write to us: Informix Software, Inc.


Technical Publications Technical Publications
Informix Software, Inc.
Lenexa, KS 66219
16011 College Boulevard
Lenexa, KS 66219

Email us at: [email protected]

Fax us at: 913-599-7260


Attention: Technical Publications
Department

12 Using the SQL Editor


Chapter

Introducing the SQL Editor


1
What is the SQL Editor? . . . . . . . . . . . . . . . . . 1-3
Defining a Connection to a Database Server . . . . . . . . . . 1-3
Setting Environment Variables . . . . . . . . . . . . . 1-7

Launching the SQL Editor . . . . . . . . . . . . . . . . 1-8


Launching from the Command Line . . . . . . . . . . . 1-9

Obtaining Help . . . . . . . . . . . . . . . . . . . . 1-11


1-2 Using the SQL Editor
T his chapter provides an overview of the SQL Editor, includes
launching instructions, provides directions for setting environment
variables, and describes how to obtain on-line help.

What is the SQL Editor?


The SQL Editor is a graphical tool that allows you to connect to a Universal
Server and query database information. It also allows you to check and
execute supported SQL statements, and view the results of SQL statements.
For additional The SQL Editor provides Global Language Support (GLS). The GLS feature
information about allows the SQL Editor to easily handle different languages, cultural conven-
GLS, refer to tions, and code sets for languages other than U.S. English.
Appendix A,
“Supporting
Global
Languages.”
Defining a Connection to a Database Server
To use the SQL Editor, you must define a connection to a database server. Use
the Setnet32 utility to explicitly set the database server, host machine, and
user account information.

To specify database server information

1. Launch the Setnet32 utility.


The INFORMIX Setnet 32 window is displayed, as shown in
Figure 1-1 on page 1-4.
2. Click the Server Information tab to display the Server Information
page.

Introducing the SQL Editor 1-3


Defining a Connection to a Database Server

INFORMIX Setnet32 Figure 1-1


Specifying Database
Server Information
Environment Server Information Host Information About Setnet32

Informix Server:

HostName:
Use these controls to identify a database server;
Protocolname:
the host machine on which the database server
Service Name: resides; and the network protocol and service
used by the database server.
Make Default Server

Delete Server

OK Cancel Apply Help

3. In the Informix Server list box, type a database server name or select
one from the list.
4. In the HostName list box, type the name of the host on which the
database server resides or select one from the list.
5. Select the protocol that you want to use for network communication
from the Protocolname list box.
If a protocol is listed by default, it is the protocol that was selected for
the database server when the database server was installed on the
host machine. For more information about protocols, refer to the
Administrator’s Guide for your database server.

1-4 Using the SQL Editor


Defining a Connection to a Database Server

6. In the Service Name text box, type the service name that the
database server uses to listen to incoming requests.
If a service is provided by default, it is the service that was selected
when the database server was installed on the host machine. For
more information about services, refer to the Installation Guide for
your database server.
7. Click Apply to update the settings for the database server.
Repeat steps 2 through 7 for each database server that you need to
define.
8. Specify connection information for each host machine.

To specify a connection to a host machine

1. Click the Host Information tab to display the Host Information


page, as shown in Figure 1-2.

INFORMIX Setnet32 Figure 1-2


Specifying Connections
to Host Machines
Environment Server Information Host Information About Setnet32

Current Host: Use this list box to select a host machine.


User Name: Type your user name for the host machine.
Password Option: Use this list box to specify how the host machine
Password:
validates your password.

Delete Host Click this button to remove the settings for


the host selected in the Current Host list box.

OK Cancel Apply Help

Introducing the SQL Editor 1-5


Defining a Connection to a Database Server

2. In the Current Host list box, type a host machine name or select one
from the list.
3. In the User Name text box, type the user name that you use to
connect to the host machine specified in step 2.
4. In the Password Option list box, choose a password-handling mode.
If you select the Password option, type the host machine password
in the Password text box.
The following table describes the password-handling options.

Option Action

Ask password at Each time the user (specified in the User Name text box)
run time attempts to connect to a database server on the host
machine, the user is prompted to enter a password.

No password No password is sent to the host machine for the user


specified in the User Name text box. If the host machine
requires a password and one is not provided, the
connection fails and an error results.

Password Each time the user (specified in the User Name text box)
attempts to connect to a database server on the host
machine, the password entered in the Password text box is
checked against the password on the host machine. If the
passwords do not match, the user is not connected and an
error message is displayed.

5. Click Apply.
Repeat steps 2 through 5 for every host machine to which you cannot
connect, regardless of whether the same user name and password is
used to connect to every host machine.
6. Click OK to save the changes and exit the Setnet32 utility.
The information is saved for future connections to each specified
host machine.
Important: The settings you specify in the Setnet32 utility will not take effect until
you re-launch the SQL Editor.

1-6 Using the SQL Editor


Setting Environment Variables

Setting Environment Variables


If you want to customize the display of monetary and date data in the
Returned Rows grid of the SQL Editor, set the appropriate environment
variables using the Setnet32 utility. If you want to create or access a database
that easily handles different languages other than U.S. English, set the appro-
priate GLS environment variables.

To set environment variables


1. Double-click the Setnet32 product icon to display the
INFORMIX Setnet32 window.
2. Click the Environment tab to display the Environment page, as
shown in Figure 1-3.

INFORMIX Setnet32 Figure 1-3


Setting
Environment Server Information Host Information About Setnet32 Environment
Variables
INFORMIX Client Server Environment
CC8BITLEVEL=
CLIENT_LOCAL=
COLLCHAR=
CONRETRY= All environment
CONTIME= variables and settings
DB_LOCAL= are listed here.

Edit Environment Variable Save/Load

Variable Name Set Load From File...


Click these buttons to
Clear Save To File... load settings from a
file and save settings
to a file.
OK Cancel Apply Help

Introducing the SQL Editor 1-7


Launching the SQL Editor

3. In the INFORMIX Client Server Environment list box, select the


environment variable that you want to set.
4. In the Edit Environment Variable group, select an item from the
Variable Name list box or type an entry in the text box.
5. Click Set to update the INFORMIX Client Server Environment list
box with the new setting.
Repeat steps 3 through 5 for each environment variable that you
want to modify.
6. Click OK to save the changes and exit the Setnet32 utility.
Important: The settings you specify in the Setnet32 utility will not take effect until
you re-launch the SQL Editor.

Launching the SQL Editor


When you launch the SQL Editor, it displays a new SQL document in the SQL
Editor window. SQL documents are files that contain SQL statements,
returned database data, and summary information about executed
statements.

Tip: If you want to view more than one document simultaneously, launch another
instance of the SQL Editor.

Windows NT To launch the SQL Editor using Windows NT, version 3.51

1. Locate the program group where the SQL Editor is installed.


This is usually the Informix folder.
SQL
2. Double-click the SQL Editor application icon. ♦
SQL Editor icon
Windows 95 To launch the SQL Editor using Windows 95 or Windows NT, version 4.0

Windows NT 1. Click the Start button located on the taskbar.


2. Point to the folder that contains the SQL Editor application icon.
3. Click the SQL Editor application icon. ♦

1-8 Using the SQL Editor


Launching from the Command Line

Launching from the Command Line


You can also launch the SQL Editor from the operating system command-line
prompt using the sqleditor command. Refer to Figure 1-4 to view the
sqleditor command line syntax.

Use the sqleditor parameters to connect to a database server and open a


database. You can also specify a user name and password, open and execute
an SQL file, and send returned database data to a file.

Additionally, you can prevent the display of the splash box that is shown
when the SQL Editor is launched, minimize the SQL Editor window, and close
the SQL Editor after completing all other command-line options.

Figure 1-4
sqleditor
SQL Editor
/ns /min Server SQL File /output outfile /exit Command
and Line
Database
Syntax
Server
and
Database

/s server
/d dbname /u user
/pw password

SQL File

filename

/exec

Introducing the SQL Editor 1-9


Launching from the Command Line

The following table provides a list of parameters and descriptions.

sqleditor Parameters Description

sqleditor Launches the SQL Editor.

/ns Prevents the display of the SQL Editor splash box that
is shown when the SQL Editor is launched.

/min Minimizes the SQL Editor window.

/s server Connects to a database server.

/d dbname Opens a database.

/u user Identifies a user name that is recognized by the


database server.

/pw password Identifies the password for the user.


Some user names require a password to receive
access privileges.

filename Displays the specified file in the SQL Editor.

/exec Executes the SQL statements in a specified file.

/output outfile Sends data returned from executed SELECT and


EXECUTE PROCEDURE statements and summary
information about executed SQL statements to an
output file. If the specified output file does not exist,
a new one is created. If it does exist, the returned data
is added to the end of the output file.

/exit Exits the SQL Editor after performing all other


command-line options.

1-10 Using the SQL Editor


Obtaining Help

When you execute the sqleditor command with the /s, /u, or /pw options,
database server access permissions are validated. If your user name or
password are not known, the User Login dialog box is displayed. Enter your
user name and password for the selected database server in the appropriate
text boxes.

When you check the Save for Future Sessions check box in the User Login
dialog box, the user name and password you specified are validated and then
saved for future connections to that database server. If the user name or
password cannot be validated, that information is not saved and a connection
error is displayed.
For more infor- If you cannot connect to a database server, it is recommended that you use
mation about the Setnet32 utility to verify or specify the appropriate database server
the Setnet32 settings.
utility, refer to
“Defining a Con- Example
nection to a Data-
base Server.” sqleditor /s mars /d mydb /u alex /pw mypasswd trigger3.sql
/exec /output mydata.txt /exit

The sqleditor command connects to the mars database server, opens the
stores9 database, and executes the trigger3.sql file in the SQL Editor. Then,
the returned data and summary information about executed SQL statements
is sent to the mydata.txt file and the SQL Editor is exited.

Obtaining Help
The SQL Editor provides two types of help information: Help Topics and
What’s This? help. Help Topics include task help and reference help. Task
help provides information about a specific task. Reference help explains
concepts or provides general information about a feature. What’s This? help
provides context-sensitive help for elements on the screen.

Introducing the SQL Editor 1-11


Obtaining Help

To view Help Topics

1. Choose Help➞Help Topics to display the Help Topics dialog box.


If you are viewing a dialog box, use the right mouse button to click a
control, and then select Help Topics from the popup menu to display
the Help Topics dialog box.
2. From the Contents page of the Help Topics dialog box, double-click
a book icon to expand the list of topics.
3. Double-click the topic for which you want information.
Information about the selected topic is displayed.

To view What’s This? help


1. Choose Help➞What’s This? or click the What’s This? toolbar
What’s This?
button. (In a dialog box, click the ? button.) Alternatively, press SHIFT
button
+ F1.

The mouse pointer changes to the What’s This? pointer.


2. Click the screen element for which you want information.
A window displays information about the screen element.
3. Click in the popup window to dismiss it.

When you highlight a menu item, the status bar defines the action that the
menu item performs. When you position the pointer over a toolbar button,
the name of the button is displayed in a tooltip.

1-12 Using the SQL Editor


Chapter

Using SQL Documents


2
Understanding the SQL Editor Window . . . . . . . . . . . 2-3
Using the SQL Statements Text Box . . . . . . . . . . . . 2-4
Using the Server/Database List Box . . . . . . . . . . . 2-5
Using the SQL Result History Text Box . . . . . . . . . . 2-5
Using the SQL Editor Menu Bar . . . . . . . . . . . . . 2-5
Using the SQL Editor Toolbar . . . . . . . . . . . . . . 2-6

Creating and Editing an SQL Document . . . . . . . . . . . 2-8


Undoing Editing Actions . . . . . . . . . . . . . . . 2-8
Locating and Replacing Text in a Document . . . . . . . . . 2-9

Checking and Executing SQL Statements . . . . . . . . . . . 2-10


Connecting to a Database Server or Database . . . . . . . . 2-10
Checking SQL Statements . . . . . . . . . . . . . . . 2-12
Executing SQL Statements . . . . . . . . . . . . . . . 2-12
Stopping Execution . . . . . . . . . . . . . . . . . 2-13

Viewing Returned Database Data . . . . . . . . . . . . . . 2-13


Using the Returned Rows Grid. . . . . . . . . . . . . . . 2-14
Returning Complex Type Data . . . . . . . . . . . . . 2-15
Using the Cell Viewer to View Returned Data . . . . . . . . 2-17

Optimizing Query Performance . . . . . . . . . . . . . . 2-19


Saving SQL Documents . . . . . . . . . . . . . . . . . 2-19
Reverting to the Last Saved SQL Document . . . . . . . . . . 2-21
2-2 Using the SQL Editor
T his chapter explains how to use the SQL Editor to manage SQL
documents and provides information about the SQL Editor interface such as
the window, toolbar, and menu bar.

Understanding the SQL Editor Window


The SQL Editor window is used to create, edit, and execute SQL statements.
You can also use this editor to query a database and manipulate data, as well
as save SQL statements and returned data.

Once you launch the SQL Editor, the SQL Editor window appears, as shown
in Figure 2-1. An SQL document is displayed within the window. The
following sections describe the different elements of the SQL Editor window.

Tip: If you want to view more than one document simultaneously, launch another
instance of the SQL Editor.

Using SQL Documents 2-3


Using the SQL Statements Text Box

Figure 2-1
SQL Editor - Untitled.sql
File Edit SQL View Help
A menu bar and toolbar
provide access to all
tasks performed in this
SQL editor.
Server/Database: mars_us Server/Database
list box

SQL Statements
text box

SQL Result
History text box

The status bar displays contextual information.

Using the SQL Statements Text Box


For additional Use the SQL Statements text box to type SQL statements; cut, copy, paste, and
information about select text; create, open, and save text files and data; and locate and replace
returned data, text. If you execute a SELECT statement, or a routine that contains a RETURN
refer to “Using statement, the returned data is displayed in sequentially numbered output
the Returned
Rows Grid.”
pages for each set of returned data typed in the SQL Statements text box. For
additional information about output pages, refer to “Viewing Returned
Database Data.”

2-4 Using the SQL Editor


Using the Server/Database List Box

Using the Server/Database List Box


For additional The Server/Database list box enables you to establish a connection by
information about selecting a database server or a database. When you execute SQL statements
establishing a that are typed in the SQL statements text box, the statements are submitted
connection, refer to the database server to which you are connected.
to “Connecting to
a Database Server
or Database.”
Using the SQL Result History Text Box
The SQL Result History text box displays summary information and error
messages that result from executed SQL statements. When SQL statements are
executed, Executing all SQL Statements in filename is displayed. If
you have not saved the SQL document that contains the statements, the
filename is displayed as Untitled.

Using the SQL Editor Menu Bar


The menu bar in the SQL Editor provides the following options:

■ File menu commands allow you to create, open, and save text files
and data. You can view and open the last four files that were opened
using the SQL Editor. You can also exit the SQL Editor from the File
menu.
■ Edit menu commands enable you to select text; locate and replace
text; and cut, copy, and paste text in the SQL Statements text box of
the SQL page. These commands also allow you to copy and select
text in the output pages of the Returned Rows grid. You can also
reverse the last editing operation that you performed.
■ SQL menu commands allow you to check selected SQL statements or
check all SQL statements for errors, execute selected SQL statements
or execute all SQL statements, produce a file that provides infor-
mation about how a query is performed, and interrupt execution of
SQL statements that return data.

Using SQL Documents 2-5


Using the SQL Editor Toolbar

■ View menu commands enable you to show or hide the toolbar, status
bar, and the SQL Result History text box. You can also toggle the
display of the Cell Viewer window.
■ Help menu commands enable you to access on-line help for the SQL
Editor.

Using the SQL Editor Toolbar


The toolbar contains 15 toolbar buttons. Click a toolbar button to perform the
tasks described in the following table.

Toolbar Button Description

Click the New toolbar button to display a new SQL document.

Click the Open toolbar button to display an existing text file in the
SQL document window.

Click the Save toolbar button to save the contents of the SQL
Statements text box.

Click the Undo button to reverse the last editing action.

Click the Cut toolbar button to remove the selected text and place
it on the clipboard.

Click the Copy toolbar button to copy the selected text to the
clipboard.

Click the Paste toolbar button to retrieve the contents of the


clipboard and paste the contents at the current cursor position.

(1 of 2)

2-6 Using the SQL Editor


Using the SQL Editor Toolbar

Toolbar Button Description

Click the Find/Replace toolbar button to locate and replace text in


the SQL Statements text box.

Click the Find Again toolbar button to search for the next occur-
rence of the last located text in the SQL Statements text box.

Click the Check Selected Syntax toolbar button to check SQL


statements that are selected in the SQL Statements text box.

Click the Check All Syntax toolbar button to check the SQL state-
ments in the SQL Statements text box.

Click the Execute Selected Syntax toolbar button to run only the
selected statements in the SQL Statements text box.

Click the Execute All SQL toolbar button to submit the SQL state-
ments in the SQL Statements text box to the specified database
server.

Click the Stop Execution toolbar button to cancel a SELECT or


EXECUTE routine that is currently returning data.

Click the What’s This? toolbar button to access contextual help for
a screen element that you select in the SQL Editor.

(2 of 2)
You can move the toolbar to another area on your desktop by positioning the
mouse on the toolbar and dragging it to the desired position.

Using SQL Documents 2-7


Creating and Editing an SQL Document

Creating and Editing an SQL Document


You can use the SQL Editor to create and edit SQL documents, check the state-
ments for execution, and submit the statements to a database server.

To create a document

1. Choose File➞New to display a new document.


2. Type the SQL statements in the SQL Statements text box of the SQL
page.
Use a semicolon to separate SQL statements. To mark comment lines
as executable text, enclose the entire text in braces or precede each
comment line with two hyphens.

To edit an existing document

1. Choose File➞Open and use the resulting Open dialog box to display
a text file in the SQL Statements text box of the SQL page.
You can open any text file in the SQL Editor. However, if the file
contains unexecutable text that is not enclosed in braces or preceded
by two hyphens, syntax errors will occur when you attempt to
execute the contents of the SQL Statements text box.
2. Make the necessary changes to the statements.

Undoing Editing Actions


Undo reverses the previous editing action. To reverse an editing action, click
the Undo toolbar button.
Undo button

2-8 Using the SQL Editor


Locating and Replacing Text in a Document

Locating and Replacing Text in a Document


Use the SQL Editor to locate and replace text in the SQL Statements text box
of the SQL page.

To locate text

1. Select Edit➞Find/Replace or click the Find/Replace toolbar button


to display the Find/Replace dialog box, as shown in Figure 2-2.
Find/Replace Figure 2-2
button Find/Replace
Locating and
Replacing Text
Find what: Find Next

Replace Use these buttons


Replace with:
to perform the
Match whole word only Replace All search and replace
procedure.
Match case
Cancel

Type the text that you Type the text that replaces
want to locate. the located text.

2. In the Find what text box, type the text that you want to locate.
3. Check the Match whole word only check box to search for the
specified text as an entire word.
Unselect this check box to search for any character string that
contains the text that you specified in the Find What text box.
4. Check the Match case check box to limit the search to the exact case
entered in the Find what text box.
5. Click Find Next.
6. To locate subsequent occurrences of the text that you typed in the
Find what text box, click the Find Again toolbar button.
Find Again
button

Using SQL Documents 2-9


Checking and Executing SQL Statements

To replace located text with new text

1. Perform steps 1 through 4 in the previous section.


2. Type the replacement text in the Replace with text box.
3. Click Find to locate the text, then click Replace to replace it with the
new text.
To replace all occurrences of the located text at once, click Replace
All.

Checking and Executing SQL Statements


After you define the statements that you want to execute, you can submit
them to the database server. To verify that the statements will execute
successfully, make sure to check the statements before you execute them.

Connecting to a Database Server or Database


You can easily connect to a database server or database and disconnect from
a database server or database using the Server/Database list box. Alterna-
tively, type the CONNECT TO statement in the SQL Statements text box.

To connect to a database server or database

1. Click the Server/Database list box.


The Network icon is displayed.

2-10 Using the SQL Editor


Connecting to a Database Server or Database

2. Click the expander buttons, as shown in Figure 2-3, to display the


database servers and associated databases.
Figure 2-3
Network
....... Click this expander button to
Network display database servers.
......

....... mars_us
......
..................................

database1
....... database2
....... database3
....... database4
....... database5
....... database6

Click this expander button to display databases.

3. Select a database server or database from the list box.

When you select or expand a database server, database server access permis-
sions are validated. If your user name or password are not known, the User
Login dialog box is displayed. Enter your user name and password for the
selected database server in the appropriate text boxes.

When you check the Save for Future Sessions check box in the User Login
dialog box, the user name and password you specified are validated and then
saved for future connections to that database server. If the user name or
password cannot be validated, that information is not saved and a connection
error is displayed.
For more infor- If you cannot connect to a database server, use the Setnet32 utility to verify
mation about or specify the appropriate database server settings.
the Setnet32
utility, refer to To disconnect from the database server or database, use the DISCONNECT
Chapter 1, “Intro- CURRENT statement. You can also click on the Server/Database list box and
ducing the SQL select another database or database server, or the Network icon.
Editor.”

Using SQL Documents 2-11


Checking SQL Statements

Checking SQL Statements


To verify that SQL statements execute successfully, make sure to check the
statements before you submit them to the database server. Checking a
statement parses and validates the SQL statements. You can check all the
statements or you can check a set of selected statements. In addition, you can
also produce a file about how a query is performed.

To check SQL statements


1. After connection to the database server is complete, click the Check
Check All Syntax
button All Syntax toolbar button.
The SQL Editor checks the statements in the SQL Statements text box
for errors before submitting them to the database server.
Alternatively, the SQL Editor can check selected syntax in the SQL
Check Selected
Syntax button Statements text box. Select the statements that you want to check
(including the semi-colons), and click the Check Selected Syntax
toolbar button.
For information When the SQL Editor checks statements, they are prepared in the
about the same manner as the PREPARE statement. The SQL Editor checks the
PREPARE statements until an error is located. If an error is located, an error
statement, message is displayed and is recorded in the SQL Result History text
refer to the
Informix Guide to
box.
SQL: Syntax. When an error is located, the text that contains the error is
highlighted. Each time an error is located, the statement-checking
procedure stops.
2. To begin checking the statements again after correcting the error,
click the Check All Syntax toolbar button.

Executing SQL Statements


You can execute a set of selected statements or you can execute all statements.
When you execute statements, they are checked and sent to the database
Execute All SQL server. To submit all the SQL statements in the SQL Statements text box to the
button database server, click the Execute All SQL toolbar button.

2-12 Using the SQL Editor


Stopping Execution

Alternatively, to submit a set of selected statements in the SQL Statements


text box to the database server, select the statements that you want to submit.
Then, click the Execute Selected Syntax toolbar button.
Execute Selected
Syntax button

Stopping Execution
You can use the SQL Editor to cancel a SELECT or EXECUTE routine that is
currently retrieving rows. To cancel, click the Stop Execution toolbar button.
Stop Execution
button

Viewing Returned Database Data


If you execute a SELECT statement or a routine that contains a RETURN
statement, the returned data is displayed in the SQL Editor. Sequentially
numbered output pages are displayed for each set of returned data when you
click the Execute All SQL toolbar button or choose SQL➞Execute All SQL.

Figure 2-4 shows an example of an output page for an executed SELECT


statement.
Figure 2-4
SQL Output1

Query
SELECT lname, fname, zipcode
FROM customer The Query text box displays the SQL
statement that produced the output in
the Returned Rows grid.
lname fname zipcode
1 Pauli Ludwig 94086
2 Sadler Carole 94117 The Returned Rows grid displays the
data returned by the SQL statement
3 Currie Phillip 94303
shown in the Query text box.
4 Higgins Anthony 94026
5 Vector Raymond 94022

Using SQL Documents 2-13


Using the Returned Rows Grid

Output pages are Output pages are created each time that data is returned from executed SQL
not created when statements. For example, if the SQL Statements text box contains three
you check SELECT statements that return data, Output1, Output2, and Output3 pages
statements. are created. If you delete one of the SELECT statements from the SQL State-
ments text box and execute the statements again, the original three output
pages are deleted and two new output pages are created.

When you open another document, all existing output pages are deleted.
New output pages are created when you execute the next set of SQL state-
ments that return data.

Using the Returned Rows Grid


The Returned Rows grid allows you to view and copy data defined from
built-in data types and complex data types. Built-in data types represent data
defined from data types such as CHARACTER, INTEGER, TIME, DATETIME,
and BLOB and CLOB. Complex data types are data types that you build from
other data types. Figure 2-5 shows an example of a Returned Rows grid
displaying built-in type data.

lname fname zipcode Click the column headings to Figure 2-5


select the entire column.
1 Pauli Ludwig 94086
2 Sadler Carole 94117
3 Currie Phillip 94303
4 Higgins Anthony 94026
5 Vector Raymond 94022

Use the row headings to select all data in each grid row.

Once data is returned and displayed in the Returned Rows grid, you can
select the data, copy it, and paste the data into a text editor or spreadsheet.

2-14 Using the SQL Editor


Returning Complex Type Data

To select a row of data and copy it

1. Locate the row that you want to select.


2. Click the row heading.
3. Click the Copy toolbar button.

You can also resize and hide columns in the Returned Rows grid. Resizing
and hiding columns allows you to customize your view of the returned data.
For additional To resize columns
information about
column headings, 1. Position the mouse on the right edge of the column heading for the
refer to column that you want to resize.
Figure 2-5.
2. Drag to the desired width.
The column width shifts to the left or right to adjust to the resized
column.

To hide columns

1. Position the mouse on the right edge of the column heading for the
column that you want to hide.
2. Drag to the left until the column disappears.

Returning Complex Type Data


Refer to the The Returned Rows grid displays data defined from complex types such as
Informix Guide to row types and collection types. Row types are made up of fields, each of which
SQL: Reference for can be any supported data type except SERIAL, SERIAL8, TEXT, and BYTE.
information about Collection types are made up of elements, each of which is the same data
row type data.
type.

When data defined from a row type is returned, the grid might display
primary headings and secondary headings. Primary headings appear at the top
level when one or more secondary headings are displayed. For example, a
primary heading for address might contain secondary headings for street, city,
state/province, and postal code. Figure 2-6 shows an example of a Returned
Rows grid when row type data is displayed.

Using SQL Documents 2-15


Returning Complex Type Data

Figure 2-6
fname lname birth_date sex address
Primary headings
street city state_prov postal
Secondary headings
1 Pauli Ludwig 11-30-66 F 213 Erstwild Court San Francisco CA 94086
2 Carole Sadler 12-21-65 F 785 Geary St San Francisco CA 94117
3 Philip Currie 09-8-65 M 654 Poplar Palo Alto CA 94303 Row type data

4 George Watson 08-09-63 M 1143 Carver Place Mountain View CA 94063

Row heading Column heading

You can select the rows and columns of data using the mouse. Click primary
headings, secondary headings, or row headings to select data. Generally,
clicking a heading selects any heading or data below the heading that you
clicked. Clicking a row heading selects the entire row. The following list
provides example data selections.

■ In Figure 2-6, click the address primary heading to select the street,
city, state_prov, and postal columns. The associated data is also
selected.
■ In Figure 2-6, click the street secondary heading to select the data in
the street column.
■ In Figure 2-6, click row heading 5 to select the entire row for George
Watson.

Generally, if you click and drag across headings, the area across those
respective headings is selected. Refer to Figure 2-7 and Figure 2-8 for
additional information about using click and drag.
As shown in Figure 2-7, if you click birth_date, and drag to San Francisco, the
birth_date, sex, and address primary headings are selected, as well as the street,
city, state_prov, and postal secondary headings. The data in the associated
columns is also selected.

2-16 Using the SQL Editor


Using the Cell Viewer to View Returned Data

fname lname birth_date sex address


Figure 2-7
Clicking and
street city state_prov postal Dragging Between
1 Pauli Ludwig 11-30-66 F 213 Erstwild Court San Francisco CA 94086 Primary and
Secondary
2 Carole Sadler 12-21-65 F 785 Geary St San Francisco CA 94117 Headings

As shown in Figure 2-8, if you click the empty cell below birth_date and drag
to city, the birth_date, sex, street, and city columns are selected.

Figure 2-8
fname lname birth_date sex address
Clicking and
street city state_prov postal Dragging Between
1 Pauli Ludwig 11-30-66 F 213 Erstwild Court San Francisco CA 94086 Secondary
Headings
2 Carole Sadler 12-21-65 F 785 Geary St San Francisco CA 94117

When data defined from a collection type is returned, the cells in the
Returned Rows grid display the name of the collection type, the number of
entries that it contains, and the data type for which the collection type is
based.

Using the Cell Viewer to View Returned Data


Use the Cell Viewer window to display the contents of a cell when the cell
contains more information than can be displayed in the Returned Rows grid.
The Cell Viewer is especially useful when you are viewing data defined from
a collection type or from a large object. If a cell contains data defined from a
user-defined data type, a textual representation that the user defined is
displayed in the cell. Figure 2-9 shows an example of the Returned Rows
grid when collection type data is defined.

Figure 2-9
fname lname birth_date sex addresses
Double-click this cell
1 Jane Miller 11-30-66 F list(2) of street_addr
to view the collection
2 Carole Sadler 12-21-65 F list(4) of street_addr type data in the Cell
3 Phillip Currie 01-01-52 F list(5) of street_addr Viewer.
4 Fred Jewell 04-28-63 F list(3) of street_addr

Using SQL Documents 2-17


Using the Cell Viewer to View Returned Data

Figure 2-10 shows an example of the Cell Viewer window with the collection
type data displayed.

Cell Viewer - Output1 Figure 2-10

Data Type: LIST(street_addr not null) This identifies the


currently
Cell Contents: displayed cell.
addresses
street city state_prov postal prev_phone_num
Double-click this
1 Mayfair Mart Sunnyvale CA 94086 list(2) of phone_num
cell to view the
2 111 Poplar Palo Alto CA 94303 list(4) of phone_num collection type
3 456 Alvarado Redwood City CA 94063 list(2) of phone_num data.
4 7777 Ross Sunnyvale CA 94086 list(3) of phone_num

For additional You can select data and resize the columns in the Cell Contents grid in the
information about same manner as in the Returned Rows grid. The Cell Viewer window
how to select data contains five toolbar buttons. Click a toolbar button to perform the tasks
and resize rows described in the following table.
and columns,
refer to
“Returning Toolbar Button Description
Complex Type
Data.” Click the Save As Data toolbar button to save the contents of the
Cell Contents grid or the textual data to a file.

Click the Copy toolbar button to copy the selected contents of the
Cell Contents grid or the textual data to the clipboard.

Click the Zoom In toolbar button to display the contents of a cell.

Click the Zoom Out toolbar button to move to the previous grid
in the history list.

Click the What’s This? toolbar button to access contextual help for
a screen element that you select in the Cell Viewer window.

2-18 Using the SQL Editor


Optimizing Query Performance

If a cell is displaying the name of a collection type, the number of entries that
it contains, and the data type for which the collection type is based, you can
zoom in on the cell to view the cell contents.
Click the Zoom To zoom in on a cell
Out toolbar
button to move to 1. Locate the cell that references the collection type data.
the previous grid 2. Double-click the cell.
in the history list.
The Cell Contents grid is refreshed and the data is displayed.

Optimizing Query Performance


For additional Choose SQL➞Set Explain to produce a file that provides information about
information about how a query is performed. When you activate the explain feature, any subse-
the SET EXPLAIN quent connection to the database server causes the SET EXPLAIN ON
output file, refer statement to be executed. As a result, the database server produces a SET
to “Evaluating the
EXPLAIN output file. If this output file currently exists, subsequent output is
Current Optimi-
zation” in appended to the file.
Chapter 3,
“Supported SQL
Statements.”
Saving SQL Documents
Use the SQL Editor to save SQL statements, returned database data, and
summary information about executed statements. When an existing
document is displayed in the SQL Editor and you open another document,
you are prompted to save the current document before the next one is
opened.

Using SQL Documents 2-19


Saving SQL Documents

If you choose to save the current document, the contents of the current
document are saved, the SQL Statements text box is cleared, and all output
pages are deleted. Then, the next document is displayed in the SQL State-
ments text box. If you choose not to save the current document, its contents
are overwritten with the contents of the next document and all output pages
are deleted.

To save SQL statements

1. Click the SQL tab.


2. Choose File➞Save or click the Save toolbar button to display the
Save dialog box.
Save button 3. Enter a directory path followed by a filename.
Use a .sql file extension in the filename to indicate that the file
contains SQL statements. The next time you choose File➞Open in the
SQL Editor, the file is filtered in the Open dialog box using the .sql
extension.
4. Click Save.

To save returned database data

1. Click the Output tab that contains the data that you want to save.
2. Choose File➞Save As Data to display the Save dialog box.
3. Enter a directory path and a filename.
Use a .txt file extension in the filename to indicate that the file
contains unexecutable text.
4. Click Save.

2-20 Using the SQL Editor


Reverting to the Last Saved SQL Document

To save portions of returned database data

1. Click the Output tab that contains the data that you want to save.
2. To select a row of data in the Returned Rows grid, click the row
heading cell of the grid row that you want to save.
To select multiple grid rows, press SHIFT while clicking the grid row
headings.
3. Choose Edit➞Copy to copy the selected text to the clipboard.
4. Open a text editor or spreadsheet and paste the text into that
application.

To save the contents of the SQL Result History text box


1. In the SQL Result History text box, select the text you want to save.
2. Choose Edit➞Copy to copy the selected text to the clipboard.
3. Open a text editor and paste the text into that editor.

Windows 95 If a file is saved using an extension other than the default, the applicable
extension (.txt for output pages or .sql for SQL pages) is appended to the
Windows NT supplied extension. To modify the extension, enclose the entire filename in
4.0 quotation marks. ♦

Reverting to the Last Saved SQL Document


If the changes you made to your document since it was last saved are
unwanted, you can revert to the last saved version of the document.
Reverting to the last saved version discards any changes that you made to the
statements in the SQL Statements text box of the SQL page and deletes all
output pages since the last save.

Using SQL Documents 2-21


Reverting to the Last Saved SQL Document

To revert to the last saved version

1. Choose File➞Revert to Saved to display a dialog box.


You are prompted to confirm that you want to discard the changes
made since your last save.
2. Click OK to discard the changes and display the last saved version of
the SQL document.
Click Cancel to return to the document and keep the changes.

2-22 Using the SQL Editor


Chapter

Supported SQL Statements


3
SQL Statement Categories . . . . . . . . . . . . . . . . 3-3
Client/Server Connectivity Statements . . . . . . . . . . . . 3-4
Data Access Statements . . . . . . . . . . . . . . . . . 3-5
Assigning Privileges to Users . . . . . . . . . . . . . . 3-5
Database Privileges . . . . . . . . . . . . . . . . 3-6
Table Privileges . . . . . . . . . . . . . . . . . 3-7
Type Privileges . . . . . . . . . . . . . . . . . 3-8
Routine Privileges . . . . . . . . . . . . . . . . 3-8
Using Roles to Create User Sets . . . . . . . . . . . . 3-9
Locking Data . . . . . . . . . . . . . . . . . . . 3-10

Data Definition Statements . . . . . . . . . . . . . . . . 3-11


Creating Databases . . . . . . . . . . . . . . . . . 3-11
Creating Database objects . . . . . . . . . . . . . . 3-12
Defining Row Types . . . . . . . . . . . . . . . . 3-13
Creating User-Defined Data Types . . . . . . . . . . . 3-13
Modifying Databases . . . . . . . . . . . . . . . . . 3-14
Creating Schemas . . . . . . . . . . . . . . . . 3-15
Modifying Existing Schemas . . . . . . . . . . . . . 3-15
Data Integrity Statements . . . . . . . . . . . . . . . . 3-16
Enforcing Data Integrity. . . . . . . . . . . . . . . . 3-16
Using Transactions . . . . . . . . . . . . . . . . 3-16
Setting Constraints, Indexes, and Triggers . . . . . . . . 3-17
Using Violations Tables. . . . . . . . . . . . . . . 3-17
Data Manipulation Statements . . . . . . . . . . . . . . . 3-18
Modifying Data. . . . . . . . . . . . . . . . . . . 3-18
Retrieving Data. . . . . . . . . . . . . . . . . . . 3-18
Query Optimization Statements . . . . . . . . . . . . . . 3-19
Evaluating the Current Optimization . . . . . . . . . . . 3-19
Setting the Optimization Level . . . . . . . . . . . . 3-20
Setting the Query Priority Level . . . . . . . . . . . . 3-20
Updating Query Optimization . . . . . . . . . . . . 3-21
Routine Statements . . . . . . . . . . . . . . . . . . . 3-21
Creating Procedures . . . . . . . . . . . . . . . . . 3-22
Creating Functions. . . . . . . . . . . . . . . . . . 3-23
Executing, Modifying, and Removing Routines . . . . . . . . 3-24
Using Aggregates . . . . . . . . . . . . . . . . . . 3-24
Using Access Methods . . . . . . . . . . . . . . . . 3-25
Creating Primary Access Methods . . . . . . . . . . . 3-25
Creating Secondary Access Methods . . . . . . . . . . 3-25
Modifying and Removing Access Methods . . . . . . . . 3-26

3-2 Using the SQL Editor


T his chapter groups the supported SQL statements into logical
categories. These categories enable you to quickly locate a statement by refer-
encing the action you want to perform. For example, if you want to know
which database objects can be created, refer to the section “Data Definition
Statements.”

SQL Statement Categories


SQL statements can be logically grouped by the actions performed by the
statements. The following table shows the logical categories that are
supported by the SQL Editor.

Statement Type Actions Performed

Client/server Determines the database server to which SQL statements are


connection submitted. This type of statement enables a direct
connection to and disconnection from a database server.

Data access Enables you to control access to databases and database


objects. This type of statement grants or revokes privileges,
sets and defines roles, locks or unlocks access to tables, and
isolates rows from one user when the rows are being
updated by another user.

Data definition Defines the data in the database. This type of statement
alters, creates, drops, or renames database objects.
(1 of 2)

Supported SQL Statements 3-3


Client/Server Connectivity Statements

Statement Type Actions Performed

Data integrity Ensures the integrity of database data. This type of


statement determines when and how transactions are
performed in a database.

Data manipulation Manipulates the data in the database. This type of statement
deletes, inserts, selects, or updates database data.

Routines Groups statements into blocks that can automate frequently


repeated tasks. There are two basic types of routines: proce-
dures and functions. Access methods also appear in this
category.

Query optimization Determines optimal query performance. This type of


statement configures optimization settings and provides
information about a query.
(2 of 2)
This chapter provides a brief overview of the SQL statements that are recog-
nized in the SQL Editor. For detailed information about the syntax for these
statements, refer to Informix Guide to SQL: Syntax.

Client/Server Connectivity Statements


The client/server connectivity statements enable a direct connection to and
disconnection from a database.

Client/Server Connection Statements


CLOSE DATABASE DATABASE
CONNECT TO DISCONNECT CURRENT

The CONNECT TO statement enables you to connect to the database server.


When this statement successfully executes, the connection it establishes
becomes the current connection. You must have a current connection
between the SQL Editor and the database server before you can execute any
SQL statements.

3-4 Using the SQL Editor


Data Access Statements

If you cannot connect to the database server using this statement, verify the
settings in your connectivity product. For more information about your
connectivity product, refer to the section “Defining a Connection to a
Database Server” in Chapter 1, “Introducing the SQL Editor.”

Use the DATABASE statement to select any database on your database server.
To close the current database, execute CLOSE DATABASE.

Use the DISCONNECT CURRENT statement to terminate the database server


connection.

Data Access Statements


The data access statements enable you to control access to databases and
tables. You can also use these statements to ensure data integrity by isolating
rows from one user when the rows are being updated by another user.

Data Access Statements


CREATE ROLE SET ISOLATION
DROP ROLE SET LOCK MODE
GRANT SET ROLE
GRANT FRAGMENT SET SESSION AUTHORIZATION
LOCK TABLE SET TRANSACTION
REVOKE UNLOCK TABLE
REVOKE FRAGMENT

Assigning Privileges to Users


For detailed Privileges allow a user to access, alter, or delete a database object. There are
information three main categories of privileges: database, table (including views and
about privileges, synonyms), routines, and types. Use the GRANT statement to assign privi-
refer to the leges on an object to a user. Use the REVOKE statement to delete user
Informix Guide to
SQL: Syntax.
privileges.

Supported SQL Statements 3-5


Assigning Privileges to Users

Use the SET SESSION AUTHORIZATION statement to change the user name for
the current session. When you execute this statement, the new user assumes
the privileges of the previously specified user.

Database Privileges
There are three types of database privileges that control who can access a
database: Connect, Resource, and Database Administrator (DBA).

Connect privileges allow a user to perform basic queries on a database table.


A user who is granted Connect privileges can perform the following
functions:
■ execute the SELECT, INSERT, UPDATE, and DELETE statements,
provided the user has the necessary table privileges.
■ execute a routine, provided the user has Execute privileges on that
routine.
■ create views, provided the user has permission to query the tables on
which the views are based.

Resource privileges carry the same authorization as Connect privileges. In


addition, a user who is granted Resource privileges can create tables, indexes,
and routines.

The highest database privilege is DBA privilege. A user who is granted this
privilege can perform the following functions:

■ delete any object, regardless of who owns it.


■ create tables, views, and indexes to be owned by other users.
■ grant database privileges, including the DBA privilege, to another
user.

3-6 Using the SQL Editor


Assigning Privileges to Users

Table Privileges
Table privileges apply to views, synonyms, and tables. The owner of a table
can grant or revoke the following privileges independently.

Table Privilege Access Provided by the Privilege

Select To retrieve data from any column in a table.

Insert To add new rows.

Update To modify existing rows.

Delete To delete rows.

Index To create and alter indexes on a table. The user must also
have Resource privileges at the database level.

Alter To execute the ALTER TABLE statement on a table. This


privilege includes the permission to add and delete table
columns.

References To create constraints on a table. Constraints define the


relationship between columns within a table or the
relationship between tables.

Under To create a sub-table based upon a supertable.

You can further restrict access to tables by specifying column names in the
GRANT statement. These privileges permit a user to view and update
columns and create constraints on the columns.

Supported SQL Statements 3-7


Assigning Privileges to Users

Partition Privileges
You can grant Insert, Update, and Delete privileges on individual partitions
of a partitioned table, using the GRANT FRAGMENT statement. The privileges
you grant can apply to one or more users. This statement is only available for
tables that are partitioned based on an expression.

Use the REVOKE FRAGMENT statement to remove privileges granted on


individual partitions within a partitioned table.

Type Privileges
When a user-defined data type is created, only the owner and users with DBA
privileges can reference the user-defined data type. You can provide further
access to the user-defined data type using the Usage privilege. This privilege
enables a user or role to reference your user-defined data type.

Routine Privileges
You grant Execute privileges on a routine to permit a user to execute that
routine. If you create a routine using the DBA option in the CREATE
PROCEDURE or CREATE FUNCTION statement, it is known as a DBA-privi-
leged routine. If you create a routine without the DBA option, it is known as
an owner-privileged routine.

A DBA-privileged routine can be created by any user who has DBA privileges.
The database server implicitly grants Execute privileges to all users who
have DBA privileges. Use the GRANT statement to explicitly permit a specific
user to execute the routine.

A user who executes a DBA-privileged routine assumes the privileges of a


DBA for the duration of the routine. In addition, the user owns any objects
created during the duration of the routine, unless a data definition statement
in the routine explicitly names someone else as the owner.

3-8 Using the SQL Editor


Assigning Privileges to Users

An owner-privileged routine can be created by any user who has Resource


privileges. The database server grants Execute privileges to the owner of the
routine and to users who have DBA privileges. Use the GRANT statement to
explicitly permit users to execute the routine. Users who execute an owner-
privileged routine must also have the appropriate privileges for objects refer-
enced by that routine.

Using Roles to Create User Sets


A role is a group of privileges defined for a specific set of users. A role allows
the database administrator to change the privileges of several users at once,
rather than change privileges for each individual user.

Use the CREATE ROLE statement to specify the role name. The role name acts
as an alias for a group of users. Then use the GRANT statement to:

■ specify the users to include in the role.


■ specify the privileges on the objects that the users in a role can
exercise.
■ grant a role to another role.
■ grant one or more users in a role the permission to grant that role to
another user.

Important: Database privileges cannot be granted to a role.


Use the REVOKE statement to modify any of the assignments made with the
GRANT statement.

Each user in a role can exercise the privileges assigned to that role by
executing the SET ROLE statement. The role that the user specifies in the SET
ROLE statement is the one that is enabled. Only one role can be enabled at a
time. If a user executes a SET ROLE statement after a role is already enabled,
the new role replaces the existing role.

Supported SQL Statements 3-9


Locking Data

Locking Data
You can control the locks the server places on data. When data is locked, data
corruption cannot occur if multiple users simultaneously access the same
data. The following table lists the statements that control data locking.

Statement Description

LOCK TABLE Locks a table against access by other processes.

SET ISOLATION Defines the degree of concurrence between the processes


that are attempting to access the same rows at the same
time.

SET LOCK MODE Determines what happens when an attempted access on a


locked row or table occurs.

SET TRANSACTION Defines the isolation levels and the access mode of the
transaction. The isolation levels can be read uncommitted,
read committed, repeatable read, and serializable. The
access modes can be either read-only or read-write.

UNLOCK TABLE Unlocks a table for access by other processes.

Use a combination of these statements to set the level of locking required for
your data.

3-10 Using the SQL Editor


Data Definition Statements

Data Definition Statements


The data definition statements are used to create various aspects of the
database by defining the structure of new database objects, modifying
existing database objects, and removing database objects when they are no
longer needed.

Data Definition Statements


ALTER FRAGMENT DROP CAST
ALTER INDEX DROP DATABASE
ALTER TABLE DROP DISTINCT TYPE
CREATE CAST DROP DOMAIN
CREATE DATABASE DROP INDEX
CREATE DISTINCT TYPE DROP OPAQUE TYPE
CREATE DOMAIN DROP ROW TYPE
CREATE INDEX DROP SYNONYM
CREATE OPAQUE TYPE DROP TABLE
CREATE ROW TYPE DROP TRIGGER
CREATE SCHEMA DROP TYPE
CREATE SYNONYM DROP VIEW
CREATE TABLE RENAME COLUMN
CREATE TRIGGER RENAME DATABASE
CREATE VIEW RENAME TABLE

Creating Databases
For additional Before you execute the CREATE DATABASE statement, make sure that you
information select the correct database server in the Server/Database list box. When you
about the enter the CREATE DATABASE statement, you create a database on the current
Server/Database database server.
list box, refer
to the section The database you create becomes the current database. Once you create a
“Using the
database, you can define database objects, such as tables, indexes, synonyms,
Server/Database
List Box” in triggers, views, casts, and domains.
Chapter 2, “Using
Note that the new database is inaccessible to others until you grant database
SQL Documents.”
privileges. For information about granting privileges, refer to the section
“Database Privileges.”

Supported SQL Statements 3-11


Creating Databases

Creating Database objects


You can create new database objects using the CREATE keyword. The
following table describes the database objects that you can create.

Statement Description

CREATE TABLE Creates the tables in a database. This statement defines the
columns of a table and places data integrity constraints on
the columns in a table.
You must have Resource privileges for a database before
you can create a table. For more information about privi-
leges, refer to the section “Assigning Privileges to Users.”

CREATE INDEX Creates an index for a table. An index is used to quickly


locate a row in a table based on the value of a column or
group of columns.

CREATE VIEW Creates a view based on an existing table or view in a


database. This statement contains a SELECT statement that
produces the view itself. A view consists of a set of rows
and columns returned by the SELECT statement.
Before you can create a view, you must have Select privi-
leges on all columns from which the view is derived.

CREATE SYNONYM Provides an alternative name for a table or view. Synonyms


let you reference a table or view that is not in the current
database. The synonym is then available to any query
made to the database in which the synonym resides.

CREATE TRIGGER Defines a series of table modification statements. A trigger


is a set of INSERT, DELETE, UPDATE, and EXECUTE
PROCEDURE statements that is executed when a
particular action occurs on a specific table (such as an
attempted deletion of data). You can use a trigger to
improve performance when executing frequently repeated
tasks.
Before you can create a trigger, you must be the owner of
the table for which the trigger is defined or have DBA
privileges.

3-12 Using the SQL Editor


Creating Databases

Defining Row Types


For additional A row type is a user-defined group of typed fields that are created from the
information about most basic form of data (a base type) or complex data types, like collections.
row types, refer to Use the CREATE ROW TYPE statement to create a named row type.
“Using the
Returned Rows To remove a named row type from the database, use the DROP ROW TYPE
Grid” in statement. Note that you cannot drop a row type that is used by an existing
Chapter 2.
table or column.

Creating User-Defined Data Types


You can create or define a data type that is unique or based on an existing
data type. Use the statements described in the following table to create user-
defined data types.

Statement Description

CREATE TYPE Creates a user-defined data type for the database.

CREATE DISTINCT TYPE Creates a new data type based on a built-in type, an
existing OPAQUE type, or a complex type.
Data of the new DISTINCT type is stored on disk in the
same way as data of the source type.
The data cannot be compared to data of the source type
unless you explicitly cast from one type to another.

CREATE OPAQUE TYPE Creates a user-defined data type that can be used in the
same way as built-in data types.

Use the DROP statement to remove the user-defined type, DISTINCT type, or
OPAQUE type. Do not remove built-in or predefined types.

Supported SQL Statements 3-13


Modifying Databases

Defining Domains
Use the CREATE DOMAIN statement to define a new domain in the current
database. A domain is a data type alias. Domains enable you to easily share
a data type among many columns.

You can supply domains in column definitions, collections, or row types.


Users who have Connect privileges to a database can use any domain in the
database.

To change a domain definition, you must drop the existing domain and re-
create the domain with the CREATE DOMAIN statement.
To remove a domain from the database, use the DROP DOMAIN statement.
When you drop a domain, the database server replaces every reference of the
domain in any column definition. Note that you must own the domain or
have DBA privileges to drop the domain.

Converting Data Between Data Types


Use the CREATE CAST statement to register a cast that may be used to convert
data from one type to another. You can create a cast to or from an OPAQUE,
DISTINCT, or row data type. To use this statement, all users must have
permission to use the built-in data types. To remove a cast from the database,
use the DROP CAST statement.

Modifying Databases
You can modify existing tables, indexes, and partitions using the ALTER
keyword. For example, use ALTER FRAGMENT to dynamically alter or create
an existing table or index partition.

However, existing views and synonyms cannot be modified. To change these


database objects, use the DROP statement to delete the trigger and then re-
create it using CREATE statement.

Use the RENAME keyword to rename existing columns, tables, and local
databases. You can remove any existing database, table, index, view, or
synonym using the DROP keyword.

3-14 Using the SQL Editor


Modifying Databases

Creating Schemas
Use the CREATE SCHEMA statement to issue a block of CREATE and GRANT
statements as a group. This statement enables you to specify the owner of all
the objects created in the block of statements.

Modifying Existing Schemas


For more infor- If you need to modify an existing database schema, use the dbschema utility
mation about to convert the existing schema to SQL statements. After the conversion
dbschema, refer occurs, you can easily change the statements that require modification and
to the Informix execute the statements to re-create the schema.
Migration Guide.
The dbschema utility enables you to return the following information:

■ the SQL statements required to replicate the schema of a database or


a specific table, view, or routine.
■ the schema for the Information Schema views.
■ the distribution information stored for one or more tables in the
database.
Important: You must be the DBA, or have Connect or Resource privileges to the
database before you can run dbschema.

To execute the dbschema utility

1. Go to the command line utility or operating prompt appropriate for


your environment.
For example, in Windows 95, the command line utility is available
when you select Run in the taskbar.
2. Enter the following command on the command line.
dbschema -d database_name
The dbschema command uses the -d parameter to display the
schema for the synonyms, privileges, tables, views, and routines of
the supplied database (database_name).
3. Execute the command line as appropriate for your environment.

Supported SQL Statements 3-15


Data Integrity Statements

Data Integrity Statements


Data integrity statements direct the transactions within a database. These
statements perform validity checks to verify the accuracy of the data in the
database.

Data Integrity Statements


BEGIN WORK SET DATASKIP
COMMIT WORK SET LOG
ROLLBACK WORK START VIOLATIONS TABLE
SET STOP VIOLATIONS TABLE

Enforcing Data Integrity


Use data integrity statements to verify that a column contains the right kind
of information, that values entered into the column contain the correct
values, and that data constraints are working properly. Perform data
integrity checks when data is added, updated, or deleted.

Another type of data integrity checking actually locks data to restrict access.
For more information about this type of data integrity, refer to the section
“Locking Data.”

Using Transactions
A transaction is a sequence of statements that is guaranteed to either be
completely and perfectly performed or not performed at all. If there is any
reason why the sequence of statements cannot be performed completely and
perfectly, the database is restored to the state it was in before the transaction
began. Thus, transactions protect you against possible failures by preventing
a partial acceptance of the sequence of statements.

3-16 Using the SQL Editor


Enforcing Data Integrity

The transaction statements are described in the following table.

Statement Action

BEGIN WORK This statement starts the transaction.

COMMIT WORK This statement implements all modifications to the


database from the beginning of the transaction.

ROLLBACK WORK If transaction logging is enabled, this statement cancels a


transaction and reverses any changes that occurred in the
database since the beginning of the transaction.

SET DATASKIP This statement enables you to control whether an


unavailable dbspace is skipped during a transaction.

SET LOG This statement changes the logging method for transactions.
The logging method determines how each change is made
within a transaction. Without transaction logging, you
cannot roll back transactions.

Setting Constraints, Indexes, and Triggers


Use the SET statement to change the object mode of constraints, triggers, or
indexes to enabled, disabled, or filtering. You can also use SET to specify
whether constraints are set at the statement level or at the transaction level.

Using Violations Tables


Use the START VIOLATIONS TABLE statement to create two new tables
associated with the specified target table. The new tables are called violations
and diagnostics. The violations table holds rows that do not meet the estab-
lished constraints and unique indexes during an insert, update, or delete on
the specified table. The diagnostics table contains information about the
integrity violations caused by rows that appear in the violations table.

You can execute the STOP VIOLATIONS TABLE statement to cancel the
recording of the violation and diagnostic table information. Although the
violations and diagnostics tables remain intact, they will no longer receive
information from the associated table.

Supported SQL Statements 3-17


Data Manipulation Statements

Data Manipulation Statements


The data manipulation statements enable you to update, add, remove, and
retrieve data from a database.

Data Manipulation Statements


DELETE SELECT
INSERT UPDATE

Modifying Data
When data in a database is modified, the contents of the tables in the database
are changed. Use the DELETE, INSERT, and UPDATE statements to modify the
data in tables. The following table describes the statements that modify data.

Statement Description

DELETE Delete any row or combination of rows from a table.

INSERT Adds new rows to a table. Use this statement to create a


single new row using the column values you supply, or
create a group of new rows using data from other tables.

UPDATE Changes the contents of columns in one or more existing


rows of a table. Use this statement to either assign specific
values to columns by name or assign a list of values
(returned by a SELECT statement) to a list of columns.

Retrieving Data
Use the SELECT statement to retrieve data from the current database. You can
retrieve all data in the database or a subset of the data that meets a specific
criteria. This statement enables you to set the conditions that the selected
rows must meet and specify a sort order. You can also combine groups of
rows into summary rows and set conditions on the summary rows.

3-18 Using the SQL Editor


Query Optimization Statements

When you execute a SELECT statement, the returned data is displayed on an


output page in the SQL Editor. You can execute selected statements by
clicking the Execute Selected SQL toolbar button or choosing SQL➞Execute
Selected SQL.

You can also execute all the SQL statements by clicking the Execute All SQL
toolbar button or choosing SQL➞Execute All SQL. For more information
about the data returned in the output pages, refer to “Viewing Returned
Database Data” in Chapter 2.

Query Optimization Statements


The query optimization statements configure optimization settings and
provide information about a query.

Query Optimization Statements


SET EXPLAIN SET PDQPRIORITY
SET OPTIMIZATION UPDATE STATISTICS

Evaluating the Current Optimization


You can also When you execute the SET EXPLAIN statement, you create an output file that
enable this provides information about how a query is performed. Use the output file to
statement by review and evaluate ways of optimizing the query.
choosing SQL➞
SETEXPLAIN. When this statement is executed, any subsequent connection to the database
server causes the SET EXPLAIN ON statement to be executed. As a result, the
database server produces a SET EXPLAIN output file. If this output file
currently exists, subsequent output is appended to the file.

Supported SQL Statements 3-19


Evaluating the Current Optimization

The SET EXPLAIN output file contains the following query performance
information:

■ a copy of the SELECT statement.


■ a value that represents the estimated resource cost of the query
(determined by the method used to read the tables in the query).
Generally, the higher the estimated value, the longer a query takes to
execute.
■ the order in which tables are accessed during execution.
■ how the WHERE clause in the SELECT statement filters rows, and
whether the filtering is performed through an index.
■ the method that is used to most efficiently read the table, including
the type of join method.

For detailed information about the SET EXPLAIN statement and the output
file, refer to the Informix Guide to SQL: Syntax.

Setting the Optimization Level


The SET OPTIMIZATION statement enables you to vary the amount of time
and resources used to find the optimal way to perform database actions.

You can set the optimization level to HIGH, which uses a sophisticated, cost-
based strategy that examines all reasonable choices and selects the best
overall alternative. However, this evaluation process can be time-consuming.
You invoke a less sophisticated, but faster, optimization algorithm when you
set the optimization level to LOW.

Setting the Query Priority Level


Use the SET PDQPRIORITY statement to set the query priority. The priority of
a query is the amount of resources designated to perform the query. You can
change the priority to LOW (1), OFF (0), HIGH (the database server determines
the priority value), DEFAULT (-1), or a number between -1 and 100.

3-20 Using the SQL Editor


Routine Statements

Updating Query Optimization


When you execute the UPDATE STATISTICS statement, the database server
recalculates the data in your system catalog tables, updates information if
any referenced objects have changed, and finds the best optimization for
queries. This statement also forces routines to be re-optimized.

Routine Statements
A routine is a named block of statements that can optionally accept
arguments. You can use a routine to improve performance when executing
frequently repeated tasks. Executing a routine, rather than repeatedly
executing the same set of SQL statements, saves time and resources by
bypassing redundant parsing, validity checking, and query optimization.

Routine Statements
ALTER FUNCTION DROP ACCESS_METHOD
AL TER PROCEDURE DROP AGGREGATE
ALTER ROUTINE DROP FUNCTION
ALTER ACCESS_METHOD DROP PROCEDURE
CREATE ACCESS_METHOD DROP OPCLASS
CREATE AGGREGATE DROP ROUTINE
CREATE FUNCTION EXECUTE FUNCTION
CREATE PROCEDURE EXECUTE PROCEDURE
CREATE OPCLASS SET DEBUG

There are two types of routines. Routines that can accept arguments, but do
not return information are called procedures. Routines that can accept
arguments and return values are called functions.

You can write routines using the Stored Procedure Language (SPL) or an
external programming language (like C) that is supported by the database
server.

Important: You must have Resource privileges on a database to create a routine


within that database. The owner of a routine must grant usage permissions to the
routine.

Supported SQL Statements 3-21


Creating Procedures

Creating Procedures
Procedures can be categorized into two types. Stored procedures are written
using the Stored Procedure Language (SPL). External procedures are written in
an external programming language (like C) that is supported by the database
server.

To create a stored procedure

1. Use the CREATE PROCEDURE statement to name and define a stored


procedure.
2. Supply the SPL procedure statements you need to define the flow of
operation for the procedure.
For example, you can define and assign values to variables to use as
counters, define controlled loops for repetitive actions, and specify
error-trapping for data recovery.

To change anything about the definition of a stored procedure, use the DROP
PROCEDURE statement to delete the stored procedure and then re-create it
using the CREATE PROCEDURE statement.

To create an external procedure

1. Write the routine in an external programming language, like C.


2. Compile the routine in the compiler provided with the external
language.
3. Store the compiled code in a shared library.
4. Register the routine with the database server using the CREATE
PROCEDURE statement.

The compiled code is used when the external routine is executed.

3-22 Using the SQL Editor


Creating Functions

Creating Functions
Write a user-defined function when you want to create a routine that returns
one or more values and can be used in an expression.

There are two types of user-defined functions. Stored functions are written
using the Stored Procedure Language (SPL). These functions can return one
or more values. External functions are written in an external programming
language (like C) that is supported by the database server. These functions
can only return a single value.

To create a stored function


1. Use the CREATE FUNCTION statement to name and define a stored
function.
2. Supply the SPL statements you need to define the flow of operation
for the function.

To change anything about the definition of a stored function, use the DROP
FUNCTION statement to delete the stored function and then re-create it using
the CREATE FUNCTION statement.

To create an external function

1. Write the routine in an external programming language, like C.


2. Compile the routine in the compiler provided with the external
language.
3. Store the compiled code in a shared library.
4. Register the routine with the database server using the CREATE
FUNCTION statement.

The compiled code is used when the external routine is executed. Note that
the database server does not store the external code directly in the database,
as it does for stored routines. Instead, only the pathname to the compiled file
containing the routine is stored.

Supported SQL Statements 3-23


Executing, Modifying, and Removing Routines

Executing, Modifying, and Removing Routines


Routine maintenance statements enable you to execute a routine, modify a
routine, and remove a routine.

To execute a routine, use the appropriate EXECUTE PROCEDURE or EXECUTE


FUNCTION statement. These statements execute the routine, regardless of the
routine type (stored or external).

After the routine is defined, you can change the attributes of the routine but
not the definition of the routine. Use the ALTER statement to change the
attributes of a routine. The only way to simulate changing the definition of a
routine is to remove the routine using the appropriate DROP statement and
re-create the routine with the CREATE statement.

Since you cannot change a procedure or function, you must drop it using the
DROP statement and then re-create it using the CREATE statement.

To remove a routine, use the appropriate DROP PROCEDURE or DROP


FUNCTION statement. This statement enables you to remove a procedure or
function by specifying the routine type, name parameters, parameter type,
and order of the parameters.

You can also remove the routine by executing the DROP SPECIFIC
PROCEDURE or DROP SPECIFIC FUNCTION statement using its specific
identifier. A specific identifier for a routine is a unique name (unique within
the database) that identifies this particular routine.

The DROP statement removes the text and executable versions of a routine.

Using Aggregates
You can create an aggregate that performs calculations over sets of rows. The
aggregate is based on a built-in or complex data type. Use the CREATE
AGGREGATE statement to create the aggregate. This statement requires you
to specify the functions that set the initial conditions, combine the data you
want to aggregate, and optionally perform actions required after the data is
combined. Use DROP AGGREGATE to remove the aggregate.

3-24 Using the SQL Editor


Using Access Methods

Using Access Methods


For more infor- An access method is a set of user-defined functions that the database server can
mation about invoke to perform tasks that would otherwise be done by the internal storage
access methods, manager. There are two types of access methods: the primary and the
refer to the Virtual secondary access method. The primary access method is used for creating and
Table Interface
Guide.
manipulating tables and the secondary access method is used for creating
and manipulating indexes.

Creating Primary Access Methods


Use the CREATE PRIMARY ACCESS_METHOD statement to create one set of
routines that performs the operations necessary to make a table available to
a database server. These table operations include the ability to create, drop,
insert, delete, update, and scan. When you use your primary access method
to access a table, access method routines are used instead of built-in table
routines.

Creating Secondary Access Methods


Use the CREATE SECONDARY ACCESS_METHOD to create a set of routines
that performs the operations necessary to make an index available to a
database server. These index operations include the ability to create, drop,
insert, delete, update, and scan. When you use your secondary access
method to access an index, access method routines are used instead of built-
in index routines.

Unlike a standard index, an index associated with a secondary access method


cannot be attached.

Optimizing Queries in the Secondary Access Method


An operator class is a set of operators that is associated with an access method.
Use CREATE OPCLASS to create an operator class that associates operators
with a defined secondary access method. When an operator class is defined,
the query optimizer uses the operator class to determine the fastest index to
use in processing a query. Use DROP OPCLASS to remove an existing operator
class from the database.

Supported SQL Statements 3-25


Using Access Methods

Modifying and Removing Access Methods


You can change or drop an access method. Each routine within an access
method specifies a particular purpose, shown as an argument. You can use
the ALTER ACCESS_METHOD statement to add, modify, and delete the
purposes of a user-defined access method.

Use the DROP ACCESS_METHOD statement to remove a primary or


secondary access method from the database.

3-26 Using the SQL Editor


Appendix

Supporting Global
Languages A
For more infor- This appendix introduces you to Global Language Support
mation about the (GLS). The GLS feature allows the SQL Editor to easily handle
GLS feature, refer different languages, cultural conventions, and code sets for
to the Guide to Asian, European, and Latin American countries.
GLS Functionality.
Important: When a character length limit is stated in this manual, the
term character actually refers to the number of bytes. In some
languages, a character might require two or more bytes of storage.

Using the Client Locale


The CLIENT_LOCALE environment variable identifies the code
set, the collation sequence, character classification (for comparisons),
and end-user formats of monetary, numeric, date, and time data.
The following table defines these GLS terms.
Setting the Client Locale

Term Definition

Code set Code sets are encodings of character sets, that is, the
one-to-one relationship between the characters and the
bit patterns that the system uses to identify characters.

Collation sequence Determines the sorting of character data that is either


stored in a database or manipulated in a client
application.

Character classification The classification of the characters of the code set that
the locale uses. For example, specifications for which
characters the locale classifies as spaces, blanks, control
characters, digits, uppercase letters, lowercase letters,
and punctuation.

End-user formats The format in which data appears within a client appli-
cation when it is in literal strings or character variables.

Informix products use U.S. English as the default locale; therefore, if you are
creating or accessing a database that uses U.S. English only, you do not have
to set GLS-related environment variables.

Setting the Client Locale


Windows You set environment variables in the Windows Registry using the Setnet32
utility. For more information about using the Setnet32 utility to set
environment variables, refer to the section “Defining a Connection to a
Database Server” in Chapter 1, “Introducing the SQL Editor.” ♦

A-2 Using the SQL Editor


Understanding Cross-Locale Issues

Finding the Correct Locale Setting


Refer to the Guide In order to set the CLIENT_LOCALE environment variable, you must know
to GLS Functional- the proper locale name for your language and cultural conventions. You can
ity for additional use the glfiles utility to create a file that lists the available GLS locales on your
information about system. It lists the locale file name, language, territory, code set, and locale
the glfiles utility.
name.

UNIX The glfiles utility is located on the UNIX database server. ♦

Understanding Cross-Locale Issues


When you enter SQL statements using the SQL Editor, there is a possibility
that character loss could occur when a string is converted from the client
locale to the database locale. This is possible if one or more character symbols
is unknown to the database locale.

Character loss may also occur in data that is returned from the database
server. If the CLIENT_LOCALE cannot interpret a character, the character is
displayed as a symbol that represents character loss. The actual symbol that
is displayed is defined by the locale.

If character loss occurs, a warning is displayed in the SQL Result History text
box which is located in the SQL Editor window. To correct this problem,
change the characters used in the string to valid characters for the locale of
the database.

Supporting Global Languages A-3


Appendix

Error Messages
B
This appendix presents information about error messages that
are displayed by the database server and the SQL Editor. This
information is described in the following sections:

■ SQL Error Messages. Use the Informix Find Error


utility to display a description for a database server SQL
error message.
■ SQL Editor Error Messages. This section presents the
SQL Editor error messages in an alphabetical list.

Refer to these sections when you need more information about a


particular error message.

SQL Error Messages


SQL error messages display a prefix that identifies the source of
the error message. The prefixed messages use the following
format:
[Informix] [database_server] [database] SQL Error (number): text

The brackets are included in the error message. The following


table defines the italicized error message elements from the
previous example.
Using the Find Error Utility

Element Definition

database_server Identifies the database server that is reporting the error.

database Identifies the database.

number Lists the SQL error message number. Supply this number
in the Informix Find Error utility.

text Lists the error message text.

The following error message is displayed if a syntax error occurs while in the
stores9 database.
[Informix] [Universal Server] [stores9] SQL Error (-201):A syntax error has
occurred.

Using the Find Error Utility


To access information about an SQL error message, use the Informix Find
Error utility. This section describes how to run this utility in the Windows
environment.

To display information about an error number

1. Launch the Informix Find Error application. This application is


located in the Informix program group.
2. Click Search to display the Help Topics: Informix Error Messages
window.
3. Type an error message number in the first list box or select the error
number from the list box.
4. Click Display to display information about the error message.

For written information about errors returned by the database server, refer to
your Informix Error Messages manual.

B-2 Using the SQL Editor


SQL Editor Error Messages

SQL Editor Error Messages


This section presents the SQL Editor error messages in an alphabetical list.
SQL Editor error messages are displayed on your screen without prefix infor-
mation. The error messages are shown in boldface type. Descriptions of the
error messages and possible solutions are provided below each message.

Administration of the Enterprise Gateway and DRDA Gateway is not supported by


the SQL Editor.

The selected gateway is not supported by the SQL Editor at this time.

An unknown format or incorrect version was detected for the locale or conversion
file filename. Check the appropriate gls subdirectory to ensure that it contains the
correct files.

A locale or conversion file is not in the expected format. The file could be
corrupt or compiled incorrectly. Re-install SQL Editor to copy new versions of
these files.

Cannot prepare SQL statement because a connection to a database server has not
been established.

An SQL statement that first requires a connection to a database server cannot


be prepared. Before proceeding, connect to a database server. Then prepare
the SQL statements in the SQL Statement text box.

Please enter the text to find.

Specify the text you want to locate before you click Find. If this error occurs,
type the text you want to locate, and then click Find Next.

The stmtname statement is not supported by the SQL Editor.


The SQL statement is not currently supported by the SQL Editor.

Error Messages B-3


SQL Editor Error Messages

The invalid environment setting string was detected during processing. Ensure
that all Global Language Support (GLS)-related environment settings are valid.

A GLS-related environment variable setting is invalid. To see a list of valid


locale settings, refer to the LcX.txt file in each LcX subdirectory in INFOR-
MIXDIR/gls, where X is the version number of the locale object-file format.
The LcX.txt file lists the locales in alphabetical order, sorted by the name of
the GLS locale object file.

This database server is not supported by the SQL Editor.

The selected or specified database server is not supported by the SQL Editor
at this time. Before proceeding, select or specify a different database server.

Unable to locate the locale or conversion file filename. Check the file system to
ensure that the locale or conversion file resides in the appropriate gls
subdirectory.

The necessary locale or conversion GLS file needed to perform the character
conversion procedure could not be read from the file system. The file may
have been moved, renamed, corrupted, or otherwise altered. You may need
to reinstall SQL Editor to ensure that the appropriate files reside in the gls
directory.

Use the /s option to specify the database server for the database dbname.

This error occurs when a database name is supplied without a database


server name. Whenever you specify a database name, also supply the
database server that contains the database.

B-4 Using the SQL Editor


Index

Index

COMMIT WORK 3-19


A Connect privilege 3-8
Access methods, using 3-27 CONNECT TO 3-6
Aggregates, creating 3-26 Connecting to database
ALTER ACCESS_METHOD 3-23, servers 1-3 to 1-6, 1-11, 2-10, 3-6
3-28 Constraints, setting 3-19
ALTER FRAGMENT 3-13, 3-16 Context-sensitive Help,
ALTER FUNCTION 3-23 viewing Intro-11, 1-12
ALTER INDEX 3-13 Conventions,
Alter privilege 3-9 documentation Intro-4 to Intro-
ALTER PROCEDURE 3-23 9
ALTER ROUTINE 3-23 command-line Intro-6 to Intro-9
ALTER TABLE 3-9, 3-13 icon Intro-6
Assigning privileges to screen illustration Intro-9
users 3-7 to 3-11 typographical Intro-5
Authorizing object Copy toolbar button 2-6, 2-18
access 3-7 to 3-11 CREATE ACCESS METHOD 3-23
CREATE AGGREGATE 3-23, 3-26
CREATE CAST 3-13, 3-16
B CREATE DATABASE 3-13
CREATE DISTINCT TYPE 3-13,
BEGIN WORK 3-19 3-15
CREATE DOMAIN 3-13, 3-16
CREATE FUNCTION 3-10, 3-23,
C 3-25
Cell Viewer, using 2-17 to 2-19 CREATE INDEX 3-14
Check All Syntax toolbar CREATE OPAQUE TYPE 3-13,
button 2-7 3-15
Check Selected Syntax toolbar CREATE OPCLASS 3-23, 3-27
button 2-7 CREATE PRIMARY
Checking for SQL errors 2-7, 2-12 ACCESS_METHOD 3-27
Client/server connection CREATE PROCEDURE 3-10, 3-24
statements 3-6 CREATE ROLE 3-7, 3-11
CLOSE DATABASE 3-7 CREATE ROW TYPE 3-13, 3-15
Closing a database 3-7 CREATE SCHEMA 3-13, 3-17
Command-line option, CREATE SECONDARY
sqleditor 1-9 to 1-11 ACCESS_METHOD 3-27
CREATE SYNONYM 3-13 selecting 3-7 DROP SPECIFIC
CREATE TABLE 3-14 viewing data returned PROCEDURE 3-26
CREATE TRIGGER 3-13 from 2-13 to 2-19 DROP SYNONYM 3-13
CREATE TYPE 3-15 DBA privilege 3-8 DROP TABLE 3-13
CREATE VIEW 3-13 dbschema utility 3-17 DROP TRIGGER 3-13
Creating Defining DROP TYPE 3-13
databases 3-13 column indexes 3-14 DROP VIEW 3-13
indexes for tables 3-14 databases 3-13
roles 3-11 domains 3-16
routines 3-24 roles 3-11 E
table synonyms 3-14 row types 3-15
Edit menu 2-5
tables 3-14 tables 3-14
Editing
triggers 3-14 views 3-14
schema in SQL Editor 3-17
user-defined data types 3-15 DELETE 3-8, 3-20
text in SQL Editor 2-6, 2-9
view synonyms 3-14 Delete privilege 3-9
Environment variables
views 3-14 DISCONNECT CURRENT 3-7
CLIENT_LOCALE A-1
Cut toolbar button 2-6 Disconnecting from a database
setting 1-7
server 3-7
Error messages
Documentation
accessing information about B-2
D additional Intro-9
text B-3
documentation notes Intro-11
Data Errors, checking in SQL 2-7, 2-12
machine notes Intro-11
converting between types 3-16 Execute All SQL toolbar button 2-7
on-line Intro-10
locking 3-12 EXECUTE FUNCTION 3-23, 3-26
printed Intro-10
modifying 3-20 Execute privilege 3-10
release notes Intro-11
retrieving 3-20 EXECUTE PROCEDURE 3-23, 3-26
sending comments Intro-12
returned from a Execute Selected SQL toolbar
Documentation notes Intro-11
database 2-13 to 2-19 button 2-7
Documents
Data access statements 3-5, Executing
creating in SQL Editor 2-8
3-7 to 3-12 routines 3-10
opening in SQL Editor 1-10, 2-8
Data definition statements 3-5, 3-13 SQL 1-10, 2-7
saving 2-19 to 2-22
Data integrity Exiting the SQL Editor 1-10
Domains, defining 3-16
enforcing in database 3-18
DROP ACCESS_METHOD 3-23,
statements 3-6, 3-18
3-28
Data manipulation statements 3-6,
DROP AGGREGATE 3-23, 3-26
F
3-20
DROP CAST 3-13, 3-16 File menu 2-5
Data types
DROP DATABASE 3-13 Files
granting privileges for 3-10
DROP DISTINCT TYPE 3-13 directing SQL output from 1-10
user-defined 3-15
DROP DOMAIN 3-13, 3-16 opening in SQL Editor 1-10, 2-6
DATABASE 3-7
DROP FUNCTION 3-23, 3-26 Find Again toolbar button 2-7
Database objects, providing access
DROP INDEX 3-13 Find Error utility B-2
to 3-7
DROP OPAQUE TYPE 3-13 Finding text in SQL Editor 2-7
Database server, connecting
DROP OPCLASS 3-23, 3-27 Find/Replace dialog box 2-9
to 1-3 to 1-6, 1-11, 2-10, 3-6
DROP PROCEDURE 3-24, 3-26 Find/Replace toolbar button 2-7
Databases
DROP ROLE 3-7 Functions, creating 3-25
closing 3-7
DROP ROUTINE 3-23
creating 3-13
DROP ROW TYPE 3-13, 3-15
granting privileges for 3-8
DROP SPECIFIC FUNCTION 3-26
modifying data in 3-20

2 Using the SQL Editor


G N R
Global Language Support 1-3, New toolbar button 2-6 Reference privilege 3-9
A-1 to A-3 Release notes Intro-11
character loss A-3 RENAME COLUMN 3-13
finding locale settings A-3 O RENAME DATABASE 3-13
GRANT 3-7, 3-9 to 3-11 RENAME TABLE 3-13
Obtaining Help 1-11
GRANT FRAGMENT 3-7, 3-10 Resource privilege 3-8
Open toolbar button 2-6
Granting privileges Returned database data
Opening SQL documents 1-10, 2-6
at database level 3-8 sending to output file 1-10
Optimizing query
at table level 3-9 viewing 2-13 to 2-19
performance 2-19, 3-21
for data types 3-10 Returned Rows grid 2-14 to 2-17
Output pages, displaying 2-13
for routines 3-10 copying data from 2-15
to roles 3-11 hiding columns in 2-15
resizing columns in 2-15
P returning collection type
H Password, using to access database data 2-17
servers 1-10 returning row type data 2-15
Help menu 2-6
Paste toolbar button 2-6 REVOKE 3-7, 3-11
Help, obtaining 1-11
Performance, optimizing in REVOKE FRAGMENT 3-7, 3-10
Hiding
queries 2-19, 3-21 Roles, defining 3-11
splash box 1-10
Permission to access ROLLBACK WORK 3-19
status bar 2-6
objects 3-7 to 3-11 Routine statements 3-6, 3-23 to 3-28
toolbar 2-6
Privileges Routines
Alter 3-9 aggregate 3-26
Connect 3-8 altering 3-26
I DBA 3-8 creating 3-24
Index privilege 3-9 Delete 3-9 executing 3-10
Indexes Execute 3-10 granting privileges for
creating for tables 3-14 granting executing 3-10
setting modes of 3-19 at database level 3-8 Row types, defining 3-15
INSERT 3-8, 3-20 at table level 3-9
Insert privilege 3-9 for routines 3-10
Inserting database data 3-20 to users 3-7 to 3-11 S
in roles 3-11
Save for Future Sessions check
Index 3-9
box 2-11
L Insert 3-9
Save toolbar button 2-6, 2-18
Reference 3-9
Launching Saving
Resource 3-8
from the command result history 2-21
Select 3-9
line 1-9 to 1-11 returned data 2-20
Update 3-9
the SQL Editor 1-8 reverting to last saved 2-21
Procedures, creating 3-24
Locating text in SQL Editor 2-7, 2-9 SQL documents 2-19 to 2-21
LOCK TABLE 3-7, 3-12 SQL statements 2-6, 2-18, 2-20
Schema
Q editing in SQL Editor 3-17
M Query optimization statements 3-6, replicating 3-17
3-21 SELECT 3-8, 3-20
Machine notes Intro-11
Select privilege 3-9
Modifying routines 3-26

Index 3
Selecting the current database 3-7 START VIOLATIONS TABLE 3-19 Undoing last editing action 2-6
Server/Database list box, using 2-5 Stop execution 2-7, 2-13 UNLOCK TABLE 3-7, 3-12
SET 3-19 Stop Execution toolbar button 2-7 UPDATE 3-8, 3-20
SET DATASKIP 3-19 STOP VIOLATIONS TABLE 3-19 Update privilege 3-9
SET DEBUG 3-23 Syntax checking 2-7, 2-12 UPDATE STATISTICS 3-23
SET EXPLAIN 3-21 User-defined data types,
Set Explain feature 2-19, 3-21 creating 3-15
SET ISOLATION 3-7, 3-12 T Users
SET LOCK MODE 3-7, 3-12 assigning privileges to 3-7 to 3-11
Table synonyms
SET LOG 3-19 connecting to servers 1-5, 1-11,
creating 3-14
SET OPTIMIZATION 3-22 2-11
granting privileges for 3-9
SET PDQPRIORITY 3-22 defining roles for 3-11
Tables
SET ROLE 3-7, 3-11 permitting object access for 3-7
creating 3-14
SET SESSION
creating triggers for 3-14
AUTHORIZATION 3-8
granting privileges for 3-9
SET TRANSACTION 3-7, 3-12
synonyms for 3-14
V
Setnet32 utility, using 1-3 to 1-8
Text View menu 2-6
Showing
editing in SQL Editor 2-6, 2-9 View synonyms
status bar 2-6
locating in SQL Editor 2-7 creating 3-14
toolbar 2-6
replacing in SQL Editor 2-7 granting privileges for 3-9
Splash box, hiding the 1-10
Text files, opening in SQL Viewing returned data 2-13 to 2-19
SQL
Editor 2-6 Views
directing output from files 1-10
Toolbar button creating 3-14
executing 1-10, 2-7
Check All Syntax 2-7 granting privileges for 3-9
statements
Check Selected Syntax 2-7 synonyms for 3-14
checking for errors in 2-12
Copy 2-6, 2-18 Violations tables, using 3-19
executing 2-12
Cut 2-6
summary of executed 2-5
Execute All SQL 2-7
supported 3-5
SQL Editor
Execute Selected SQL 2-7 W
Find Again 2-7
exiting 1-10 What’s This? toolbar button 1-12,
Find/Replace 2-7
launching 1-8 2-7, 2-18
New 2-6
locating text in 2-9 Window, minimizing 1-10
Open 2-6
menu bar 2-5
Paste 2-6
toolbar 2-6
Save 2-6, 2-18
window 2-3 to 2-5
Stop Execution 2-7
Z
SQL menu 2-5
Undo 2-6 Zoom In toolbar button 2-18
SQL Result History text box,
What’s This? 1-12, 2-7, 2-18 Zoom Out toolbar button 2-18
using 2-5
Zoom In 2-18
SQL statement categories
Zoom Out 2-18
client/server connection 3-6
Transactions, using 3-18
data access 3-5, 3-7 to 3-12
Triggers
data definition 3-5, 3-13
creating 3-14
data integrity 3-6, 3-18
setting modes of 3-19
data manipulation 3-6, 3-20
query optimization 3-6, 3-21
routines 3-6, 3-23 to 3-28
SQL Statements text box, using 2-4
U
sqleditor command 1-9 to 1-11 Undo toolbar button 2-6

4 Using the SQL Editor

You might also like