SQL Talk
SQL Talk
Copyright
Copyright 1997 by Centura Software Corporation. All rights reserved.
SQLTalk Command Reference
20-2108-1003
November 1997
SQLTalk Command Reference
Contents
Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . vii
1 Introduction to SQLTalk . . . . . . . . . . . . . . . . 1-1
What is SQLTalk? . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-2
SQLTalk command categories . . . . . . . . . . . . . . . . . . 1-2
Session control . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-3
Database administration . . . . . . . . . . . . . . . . . . . . 1-3
Report writing . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-3
Stored commands and procedures. . . . . . . . . . . . 1-3
Command files . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-4
Precompiled commands . . . . . . . . . . . . . . . . . . . . 1-4
Environment control . . . . . . . . . . . . . . . . . . . . . . . 1-4
Editing commands . . . . . . . . . . . . . . . . . . . . . . . . 1-4
SQL commands . . . . . . . . . . . . . . . . . . . . . . . . . . 1-5
Starting the SQLTalk program . . . . . . . . . . . . . . . . . . 1-6
From Windows 3.x . . . . . . . . . . . . . . . . . . . . . . . . 1-6
From Windows 95 and Windows NT . . . . . . . . . . 1-7
Running SQLTalk . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-7
Database name, user name, and password. . . . 1-10
Entering SQLTalk commands. . . . . . . . . . . . . . . 1-10
SQLTalk run options . . . . . . . . . . . . . . . . . . . . . . . . . 1-11
Initialization file . . . . . . . . . . . . . . . . . . . . . . . . . . 1-11
NOCONNECT option . . . . . . . . . . . . . . . . . . . . . 1-11
Batch option (BAT) . . . . . . . . . . . . . . . . . . . . . . . 1-11
Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-13
Result set mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-13
Glossary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Glossary-1
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Index - 1
Preface
This is a reference manual for SQLTalk, an interactive user interface that allows you
to enter SQL commands. SQLTalk can be used as an interface for other databases
besides SQLBase, such as DB2.
Summary of chapters
This manual is organized in the chapters in the table below.
1 Introduction to SQLTalk Provides an overview of SQLTalk.
2 SQLTalk Command Describes each SQLTalk command. Arranged alphabetically.
Reference
3 SQLTalk Reserved Words This chapter lists SQLTalk reserved words.
Syntax diagrams
This manual uses syntax diagrams to show how to enter commands. The syntax for
the RESTORE command is used here as an example.
TO database name
ON CLIENT
SERVER
Symbol Description
Symbol Description
Notation conventions
The table below show the notation conventions that this manual uses.
Notation Explanation
bold type Menu items, push buttons, and field names. Things that you select.
Keyboard keys that you press.
Precaution Warning:
Vital Important:
information
Supplemental Note:
information
Alt+1 A plus sign between key names means to press and hold down the first
key while you press the second key
Chapter 1
Introduction to SQLTalk
This chapter provides an overview of SQLTalk and includes the following
information:
• The purpose of SQLTalk
• The SQLTalk command categories
• How to start SQLTalk from each platform
• SQLTalk run options
• How to use result set mode to browse
• How bind variables can supply new or changed data
• Error handling in SQLTalk
What is SQLTalk?
SQLTalk is an interactive user interface for SQLBase. SQLBase is a relational
database management system (RDBMS), providing complete implementation of
Structured Query Language (SQL) as well as its own control language. It is designed
and built specifically for PC networks supporting various LAN/WAN configurations.
Besides accessing SQLTalk through its user interface, you can also access SQLTalk as
a custom control available through Centura’s SQLConsole or Team Builder.
With SQLTalk, you can perform these tasks:
• Define the structure of a database
• Add, delete, and change data in a database
• Query a database
• Execute batch and interactive SQLTalk scripts
• Edit SQLTalk scripts
• Control security and access for a database
• Generate reports
• Test SQL commands before they are embedded in an application program
• Perform DBA functions
SQLTalk can also be used as an interface for other databases besides SQLBase, such
as DB2.
Session control
These commands connect or disconnect cursors, databases, and connection handles.
BEGIN CONNECTION
CONNECT
DISCONNECT
END CONNECTION
EXIT
USE
Database administration
These commands perform database administration functions such as backup and
restore.
BACKUP
COPY
FETCH
RELEASE LOG
REORGANIZE
RESTORE
ROLLFORWARD
SET SERVER
SHUTDOWN
Report writing
These commands format, display, and print the results of a SQL query in a complex
multi-page report.
BREAK
BTITLE
COLUMN
COMPUTE
LEFT
PRINT
RIGHT
TTITLE
EXECUTE
RETRIEVE
STORE
These SQL commands grant and revoke privileges to users on stored procedures.
GRANT EXECUTE ON
REVOKE EXECUTE ON
Command files
These commands let you store often-used commands in a file that can be executed.
PAUSE
REMARK
RUN
SAVE
Precompiled commands
These commands compile and execute SQL commands:
PREPARE
PERFORM
Environment control
The SET command lets you control the environment for the SQLTalk session. The
SHOW command displays the current settings of the environment. The DBERROR
command displays the message text, reason, and remedy for a specific error.
SET
SET SPOOL
SHOW
SHOW CONNECTION
SHOW DATABASES
DBERROR
Editing commands
These commands let you edit command input.
EDIT
LIST
UNDO
SQL commands
These SQL commands can be executed from the SQLTalk command prompt.
ALTER DATABASE
ALTER DBAREA
ALTER EXTERNAL FUNCTION
ALTER PASSWORD
ALTER STOGROUP
ALTER TABLE
ALTER TABLE (error messages)
ALTER TABLE (referential integrity)
ALTER TRIGGER
AUDIT MESSAGE
CHECK DATABASE
CHECK INDEX
CHECK TABLE
COMMENT ON
COMMIT
CREATE DATABASE
CREATE DBAREA
CREATE EVENT
CREATE EXTERNAL FUNCTION
CREATE INDEX
CREATE STOGROUP
CREATE SYNONYM
CREATE TABLE
CREATE TRIGGER
CREATE VIEW
DBATTRIBUTE
DEINSTALL DATABASE
DELETE
DROP DATABASE
DROP DBAREA
DROP EVENT
DROP EXTERNAL FUNCTION
DROP INDEX
DROP STOGROUP
DROP SYNONYM
DROP TABLE
DROP TRIGGER
DROP VIEW
GRANT (database authority)
GRANT (table privileges)
GRANT EXECUTE ON
INSERT
INSTALL DATABASE
LABEL
LOAD
LOCK DATABASE
PROCEDURE
REVOKE (database authority)
REVOKE (table privileges)
REVOKE EXECUTE ON
ROLLBACK
ROWCOUNT
SAVEPOINT
SELECT
SET DEFAULT STOGROUP
START AUDIT
STOP AUDIT
UNLOAD
UNION
UNLOCK DATABASE
UPDATE
UPDATE STATISTICS
Running SQLTalk
This section describes how to run SQLTalk.
• In the dialog box, enter ISLAND for the database and click Connect.
The Current Connections box displays ISLAND as the database name, which
confirms your connection to this database.
Note: The username and password defaults to SYSADM for all new databases until you
define another user name and password from within SQLTalk. Once you have created one or
more additional user names, you can override the default by entering another name.
You can enter SQL and SQLTalk commands as described in the SQL Language
Reference Manual and in this manual. For rules on entering commands, read
Entering SQLTalk commands in this chapter.
Note: You can also connect to a database by entering the following command in SQLTalk’s
window. For example:
CONNECT ISLAND1;
5. End SQLTalk.
When you are ready to end your SQLTalk session, enter this command at the
cursor:
exit;
Command guidelines
• You can have any amount of white space between items.
• A delimiter must mark the end of a command. The delimiters for a command
are:
• A semicolon (;) at the end of the last line.
• A forward slash (/) at the beginning of a new line after the last line.
• If you enter a single command delimiter character (; or /), SQLBase runs the
most recently entered command.
• SQLTalk commands can span multiple lines.
• Commands are case insensitive.
• String constants are case sensitive.
• Delimited identifiers (names) are case sensitive.
• String constants usually must be specified within single quotes (' ').
Initialization file
SQLTalk can read a command file upon startup. To create this file, use the SQLTalk
executable name with the .tlk extension.
Any command in this file is executed upon startup, but no output will be displayed on
the screen. For example, you can create a command file on the Windows 95 and
Windows NT platform called sqlnttlk.tlk that contains SQLTalk page set commands
(SET<option>). Any command in this file is executed upon startup, but no output is
displayed on the screen.
NOCONNECT option
This option is only useful in the batch mode when running SQLTalk under any
Windows platform. You cannot be connected to a database to restore it (read the
explanation for the RESTORE command). If you want to connect to a server without
connecting to a specific database, specify the NOCONNECT option on the command
line. For example, enter this command on the Windows NT platform:
C:\CENTURA> SQLTALK BAT NOCONNECT
If you are using a multi-user server, after SQLTalk starts, issue a SET SERVER
command to connect to a server. Then include any commands that you require in your
batch file.
INPUT = infile
DB = db/auth-ID/password
Clauses
You can specify the command line options in any order.
SQLTalk program BAT
Enter the name of your platform-specific SQLTalk program, followed by BAT.
For example, enter this command on the Windows 95 or Windows NT platform:
C:\CENTURA> SQLTALK BAT
INPUT = runfile
This is a SQLTalk command file to be executed. You create this file with an
online editor. For more information on command files, see the RUN command.
INPUT = infile
All input comes from this file and the SQLTalk command prompt (SQL>) is not
displayed. If this clause is not specified, SQLTalk takes command input from the
keyboard.
OUTPUT=outfile
This specifies a file to write all standard output. If this clause is not specified,
output is written to the standard output device (usually the display screen).
DB=db/auth-ID/password
This is the database name, username, and password used for connecting to
SQLBase. The system uses the default for any of the three that you do not
supply. For example, if you specify only the password, SQLBase uses the default
username and database name.
Examples
The following examples using the Windows NT SQLTalk program get their input
from a command file called sales.rpt.
This example writes output to the screen on the Windows NT platform:
C:\CENTURA> SQLTALK BAT INPUT=SALES.RPT
DB=SALES/WILLIE/XYZ
This example writes output to a file called sales.lst:
C:\CENTURA> SQLTALK BAT INPUT=SALES.RPT
OUTPUT=SALES.LST DB=SALES
EMPL_NUM NAME
Normally, SQLBase displays result table rows, and then rolls them off the screen.
However, in result set mode (also called scroll mode), the rows of the result table are
available for subsequent scrolling and retrieval. This is similar to the SCROLL
CURSOR capability in the ANSI SQL standard.
While in result set mode, you can:
• Starting at any row position, scroll through the result table.
• INSERT, UPDATE, or DELETE rows in the result table.
Result set mode is useful for a browsing application where you need to examine data
before deciding what to do with it.
Turn on result set mode with the SET SCROLL ON command. Result set mode is
disabled by default.
After a query, the database is positioned at the first row of the result set. When you
issue a FETCH command, the database returns the number of rows specified starting
at the first row. Each subsequent FETCH command retrieves the next row, until the
end of the result set.
Before running FETCH, you can set the starting position within the result set with the
SET SCROLLROW command.
This section shows how to use result set mode. It also introduces the concept of
cursors and restriction modes, which are described in more detail in the sections
Cursors and Restriction mode on page 1-16.
Cursors
SQLBase uses cursors to mark the row position in a result set. Once a result set has
been created, an application can position the cursor on any row in the result set. Once
the cursor is positioned, subsequent fetches start from that position.
Modifying data
While in result set mode, you can change or add data with the following commands:
• An UPDATE or DELETE command with the WHERE CURRENT OF
clause.
• An INSERT command with the ADJUSTING clause.
These are called cursor-controlled operations because they rely on the cursor
specified in the WHERE CURRENT OF or ADJUSTING clause.
Restriction mode
While in result set mode, restriction mode can filter a query’s result set to form the
basis for successive queries from that table or tables. Each query restricts the result
set further, until you obtain the desired result. This is useful for browsing applications
because you can continue to narrow the focus of a query.
Use SET RESTRICTION ON to turn on restriction mode. You must precede this
command with a SET SCROLL ON command.
You can revert to the most recent result set with the UNDO command.
This example uses the data from the ENGINEERS table:
SELECT * FROM ENGINEERS;
EMPL_NUM NAME REP_OFFICE TITLE HIRE_DATE MANAGER
4. The next query refines the query to employees whose office number is less than
40:
SELECT * FROM ENGINEERS WHERE REP_OFFICE <40;
EMPL_NUM NAME REP_OFFICE TITLE HIRE_DATE MANAGER
5. Now, the original unrestricted SELECT statement returns the same result set as
the previous SELECT in step 4.
SELECT * FROM ENGINEERS;
EMPL_NUM NAME REP_OFFICE TITLE HIRE_DATE MANAGER
7. Now, when you rerun the SELECT command against the ENGINEERS table, the
original result set from step 1 is returned.
SELECT * FROM ENGINEERS;
EMPL_NUM NAME REP_OFFICE TITLE HIRE_DATE MANAGER
Limitations
You cannot use the following features while in restriction mode:
GROUP BY HAVING
UNION ORDER BY
Bind variables
A bind variable, also called a program variable, refers to a data value associated with
a SQL command. Bind variables associate (bind) a syntactic location in a SQL
command with a data value that is to be used in that command.
Bind variables can be used wherever a data value is allowed:
• WHERE clause.
• VALUES clause in an INSERT command.
• SET clause of in UPDATE command.
Bind variables let you type a command once, replacing variable slots with the data
that is to be executed with the command.
Bind variables in SQLTalk conform to the following guidelines:
• A bind variable name starts with a colon (:) and is followed by a number that
refers to the relative position among the data items associated with the SQL
command
(such as :1, :2, :3).
• The data for each execution of a command can be on as many lines as is
needed. SQLTalk reads an item of data for each bind variable in the SQL
command.
• If there are more items of data on a line than there are bind variables,
SQLTalk stops reading the line when it has read enough data.
• If the number of items on a line is less than the number of bind variables,
SQLTalk continues reading on the next line until it has read enough data.
• Use commas to separate data items. You can indicate null values by two
successive commas.
• SQLTalk strips leading and trailing blanks within a data field.
A_STRING A_NUMBER
-------------------
El Cid 15000
El Cid 15000
EL CID
SELECT * FROM X;
Entering RUN long.cmd performs the following:
A
==========
1
B
=
one
C
=
ONE
2
B
=
two
C
=
TWO
2 ROWS SELECTED
Error messages
This section describes the following information:
• The common message files called error.sql and message.sql that are shared
by SQLBase client and server programs.
• The SQLBase error window.
About error.sql
All SQLBase error messages are stored in a common error message file called
error.sql. This file must be present on all client and server computers that run
SQLBase software.
As the diagram below shows, each error message has message text, a reason, and a
remedy.
The error message text line contains an error code (in this case, 00353), a mnemonic
(EXE NSY), and a message text (Not a synonym). When a program detects an error
condition, it uses the error code to look up the error message.
About message.sql
The message.sql file contains prompts, confirmations, and non-error messages. This
file must be present on all client and server computers that run SQLBase software.
You can specify a directory in the SQLBASE environment variable where SQLBase
can find message and error files. Otherwise, SQLBase uses this search order to find
message.sql and error.sql (described in the previous section) on a client or server:
1. Current directory.
2. \SQLBASE directory on the current drive.
Displaying errors
SQLBase provides a window that displays the message text, reason, and remedy for a
given error code. The program looks up this information in error.sql.
The error window program is installed on the client machine when you install
SQLBase client software, and is assigned an icon in the client program group or
folder.
To access the error window, click on the DBEerror icon.
Chapter 2
SQLTalk Command
Reference
This chapter contains the syntax, description, and examples of each SQLTalk
command. It is organized alphabetically by command name.
Command Function
ALTER COMMAND
Clauses
SET AUTORECOMPILE
If this setting is ON and the stored command later becomes invalid, SQLBase
automatically recompiles the stored command the next time it is executed, either
by the SQLTalk EXECUTE command or by the SQL/API sqlret function.
When you create a stored command, the default AUTORECOMPILE setting is
ON.
Example
ALTER COMMAND ADDNAMES SET AUTORECOMPILE ON;
See also
STORE
EXECUTE
BACKUP
BACKUP DATABASE
LOGS FROM database name
SNAPSHOT
TO directory name
ON CLIENT
SERVER
Clauses
DATABASE
Copies the database (.dbs) file from its current directory to the specified backup
directory.
LOGBACKUP must be ON to perform BACKUP DATABASE. You should
never back up a database without also backing up the log files with it.
LOGS
Copies unpinned log files from the current log directory (by default, the database
directory) to the specified backup directory. Once this completes successfully,
SQLBase deletes the log files that were backed up from the current log directory.
You should back up log files from different databases to different directories
since their file names could conflict.
LOGBACKUP must be ON to perform BACKUP LOGS.
SNAPSHOT
Copies the database and the associated log files from their current directory to the
specified backup directory. Since BACKUP SNAPSHOT backs up a single
recoverable database, it is suggested that you perform this function into an empty
directory.
BACKUP SNAPSHOT is the recommended way to backup a database and its log
files. There is only one step (RESTORE SNAPSHOT) needed to bring a database
and its log files to a consistent state.
Alternatively, the files produced by BACKUP SNAPSHOT can be restored and
recovered with the individual commands RESTORE DATABASE,
ROLLFORWARD, and RESTORE LOGS.
The SNAPSHOT option does not require the SYSADM logon and password.
This means that other users besides SYSADM can backup the MAIN database by
using BACKUP SNAPSHOT.
This command causes a log rollover which closes the current log file so that it
can be backed up. This means that a RELEASE LOG command is not necessary.
If LOGBACKUP mode is turned on, the log file is pinned until it is backed up
using BACKUP LOGS. The backup command unpins the log, not BACKUP
SNAPSHOT.
You cannot perform a BACKUP SNAPSHOT while in Read-Only (RO) isolation
level.
Note that BACKUP SNAPSHOT does not backup a single file; you must provide
directory name, not a file name.
FROM database name
This clause specifies the name of the database.
If the FROM clause is omitted, the database is assumed to be the one currently
connected to the active cursor.
TO directory name
This specifies the destination directory for the backed up files.
This backup directory pathname can refer to the client or the server computer.
You can specify the pathname with the ON SERVER or ON CLIENT clauses.
If you omit the TO clause, the current directory on the client computer is used as
the backup directory.
If the destination files of the backup already exist (and the PAUSE option is
turned ON), you are prompted with the following message before the files are
overwritten:
Backup file already exists.
Overwrite it (Y/N)?
It is a good idea to place the backup on a different drive or device to isolate it
from failure of the drive on which the database is located.
ON CLIENT or ON SERVER
This specifies whether the destination directory for the backed up files is on the
client or the server. The default is ON CLIENT.
Example
The following example assumes that you have already entered a SET SERVER
command.
BACKUP DATABASE TO \DEMOBKUP;
DATABASE BACKED UP
RELEASE LOG;
RELEASE LOG COMPLETED
BACKUP LOGS TO \DEMOBKUP;
2 LOGS BACKED UP
See also
RELEASE LOG
RESTORE
SET SERVER
BEGIN CONNECTION
databasename/username/password
can create cursors to perform specific SQL commands within the connection handle.
A connection handle represents a single database connection and transaction.
If the databasename, username, and password are not specified, SQLTalk uses the
databasename, username, and password of the current cursor connection.
The beginning of a new connection does not modify the current cursor. SQLTalk
always maintains what it considers to be the current cursor, which is the cursor used
for any SQL command execution. For details, read Chapter 3, Connection Handles of
the SQL/API Programming Language Reference.
Clauses
connection name
Specify the connection name, which can be no more than eight characters in
length.
databasename/username/password
This specifies the database to connect to.
Regardless of how many database connections have been established, there is
only one current database and one current cursor at any given moment. The
current database and cursor is the one to which a connection was established at
sign-on or by the last CONNECT or USE command. If the database name is not
specified in a BEGIN CONNECTION command, it is assumed that the current
database will remain unchanged.
If you are connecting to the MAIN database, specify the name of the server
where the MAIN database is instead of the database name itself.
username/password
Each valid user of the database is assigned a username (authorization ID) and
password.
The BEGIN CONNECTION command can establish only one connection to the
database through a username.
If you do not specify a username/password, the connection takes place with the same
username/password as the current cursor. The current cursor is the one that was
established at sign-on or with the last CONNECT or USE command.
Example
The following example creates a new connection:
BEGIN CONNECTION CH1 ISLAND/SYSADM/SYSADM;
See also
END CONNECTION
SHOW CONNECTION
BREAK
BREAK OFF
ON column list
REPORT
This command suppresses repeating values for a specified column within a group. It
inserts a blank line when the column changes value or after the last row of a report
has been displayed.
If you entered the COMPUTE command, appropriate totals and subtotals are
computed and printed for each group of rows separated by blank lines.
Once you enter the BREAK ON command, all subsequent SQL queries are displayed
with the specified breaks. To add or remove a break specification, you must enter a
new BREAK OFF command.
Unlike the COMPUTE and COLUMN commands, the BREAK command is not
cumulative.
To turn off breaks, enter the BREAK OFF command. The BREAK OFF command
also removes all specified COMPUTEs.
Clauses
ON/OFF
Turns BREAK capability on or off.
REPORT
This specifies that a break occurs after the last row of the report. This is usually
specified when an aggregate for the entire report needs to be computed (such as a
grand total).
column list
The column list contains column-IDs separated by one or more blanks.
Column-ids can be either:
• Position number of the column in a subsequent SELECT command.
• An alias specified with the COLUMN command.
The breaks occur in the same order as specified in the column list.
SQLTalk does not check to see if a SQL query results in a sorted order that is the
same as the specified break order. You must ensure that a subsequent SELECT
command contains an appropriate ORDER BY clause.
Examples
The following command requests a break on the column DEPTNO.
BREAK ON 1;
SELECT DEPTNO, PROJNO, SUM(SAL) FROM EMP ORDER BY
DEPTNO, PROJNO;
The following command requests a break on the columns DEPTNO and PROJNO,
and on the last page of the report.
BREAK ON REPORT 1 2;
SELECT DEPTNO, PROJNO, SUM(SAL) FROM EMP ORDER BY
DEPTNO, PROJNO;
See also
COLUMN
COMPUTE
SHOW REPORT
BTITLE
This command displays a title on the bottom of each page of a report. Once you have
entered this command, the results of all subsequent SELECT commands are
displayed with this bottom title.
You can change the bottom title by giving another BTITLE command or it can be
turned off by giving the BTITLE OFF command. You can turn on BTITLE again with
the BTITLE ON command.
This command is cumulative, meaning that once the title has been turned on, portions
of it can be changed (such as adding a date or a page number).
Clauses
'footer string'
You must enclose the footer string in single quotes.
The string can consist of up to three separate substrings, each delimited by the
vertical bar ( | ) character. The | causes the substring that follows it to be
displayed on a new line (multi-line footer).
All the lines of the footer are automatically centered within the display width of
the page. The display width of the page is specified by the SET LINESIZE
command.
DATE
If this is ON, the current date appears on the bottom left hand corner of each page
of the report. The date is displayed in Mon dd, yyyy format (such as April 25,
1996). The date is always displayed on the last line of the page, regardless of the
number of lines in the bottom title.
PAGE
If this is ON, the current page number is displayed on the bottom right hand
corner of each page of the report as 'Page n', where n is the page number. The
page number is always displayed on the last line of the page, regardless of the
number of lines in the bottom title.
Example
Shown below is a BTITLE command and the resulting title.
BTITLE 'COMPANY CONFIDENTIAL|***' DATE ON
PAGE ON;
COMPANY CONFIDENTIAL
See also
SET LINESIZE
SHOW REPORT
TTITLE
COLUMN
WIDTH OFF
data width
PICTURE ‘picture string’
NULLS ‘replacement string’
ADJUST OFF
LEFT
RIGHT
CENTER
DUP OFF
ON
WRAP OFF
ON
PRINT OFF
ON
SUBTITLE OFF
ON
NEWPAGE OFF
ON
This command sets attributes that control the display format and break processing for
a column in a report.
After you have entered this command, the results of all subsequent SELECT
commands reflect the attributes that you specified.
You can specify more than one COLUMN command for a single column. The effect
of this is cumulative, except that a new COLUMN command overrides an attribute
that you specified in a previous COLUMN command.
An empty string specified as a pair of single quotes (' ') removes a previously-defined
attribute for a column.
Clauses
column ID
This specifies the column ID. Column IDs can be one of the following values:
• Position number of the column in a subsequent SELECT command.
• An alias specified with the COLUMN command.
ALIAS OFF or ALIAS alias name
This specifies an alias name for a column. The alias is used as a column-ID.
The rules for naming an alias are the same as for SQL columns. An alias name
must begin with a letter (A through Z and the special characters #, @, and $) and
must not exceed 18 characters. The alias name must not be enclosed in quotes.
HEADING ‘column title’
This specifies the heading for a given column.
The heading can consist of up to three separate substrings, each delimited by the
vertical bar ( | ) character. The | is a delimiter that causes the following substring
to be displayed on a new line.
The width of a column heading cannot be greater than the line size (specified by
the SET LINESIZE command). If any of the substrings in the column title are
wider than line size, the extra characters are truncated at display time.
The heading string must be enclosed in single quotes ('').
To remove a previously-defined column heading and return to the default
heading, define column-title-string to be two single quotes ('').
WIDTH OFF or WIDTH data width
Each column can have a width specified for the data. This is a number from 1 to
line size.
If the data width is less than the specified or default width of the column heading,
the display width of the column is the greater of the data width or the column-
heading width.
If the column has a PICTURE specified for it, the data width is ignored.
If the data width is not specified, or if it is turned OFF, the display width is equal
to the size of the data as stored in the database.
Picture
Description
Character
Picture
Description
Character
Input Output
.85 $ .85
3.49 $ 3.49
Input Output
33.99 0034
1111 1111
Date/Time Pictures
The standard output of a date/time value in SQLTalk is illustrated in the
following diagram.
dd-mon-yy hh:mi:ss AM
PM
You can substitute slashes or spaces for the hyphens in the diagram above.
For a DATE data type, the time portion is omitted and for a TIME data type,
the date portion is omitted.
For example, January 12, 1996, 3:15 PM would be output as
12jan1996 03:15:00 PM.
Date and time format strings must be enclosed in single quotes.
Note that the time can be added to any of the date pictures to give date and
time, or the time picture can be used alone.
The following table explains the picture characters that can be used for a date/
time column.
Characters Replaced By
A backslash prevents substitution and forces the next character into the
output from the picture. For example, the following picture:
Mo\mmy was born in YYYY
produces the output string of "Mommy was born in 1950" instead of "Mo04y
was born in 1950."
Character LEFT
Integer RIGHT
Decimal CENTER
Date/Time CENTER
DUP OFF/ON
This attribute applies only to columns specified in the BREAK command. If this
is ON, the data in this column is displayed for each row, regardless of value.
The default is OFF, which means that the data in the column is displayed only
when its value changes (when a break occurs on the column).
WRAP OFF/ON
If this is ON, column data is wrapped for up to five successive lines. No attempt
is made to wrap at word boundaries.
This option is only valid for character columns.
PRINT OFF/ON
If this is OFF, the column results are not displayed even if the query returned the
results successfully.
All columns to the right of the column are adjusted leftward on the display
screen.
Turning PRINT ON or OFF does not change the column-IDs of the displayed
columns.
SUBTITLE OFF/ON
This attribute applies only to columns specified in the BREAK command. If this
is ON, the data in the column specified by the BREAK is not displayed in rows
and columns, but instead on a separate subtitle line when its value changes (when
a break occurs on the column). The subtitle line includes the column heading on
the left of the data.
This attribute can be ON for more than one column, in which case the column
data is printed on the subtitle line in the order the columns are specified in the
select list of the query.
The default is OFF which means that the data is not printed on a subtitle line.
NEWPAGE OFF/ON
This attribute applies only to columns specified in the BREAK command. If this
is ON, the report skips to a new page after a break occurs for this column. If a
COMPUTE command was given, the new page occurs after the computations
have been displayed.
The default is OFF, which means that a break does not cause the report to start on
a new page.
Examples
These commands format the first column in the select list to be displayed with a
heading of Employee Name with a width of 20 characters.
COLUMN 1 ALIAS EMPNAME;
COLUMN EMPNAME HEADING
'EMPLOYEE|NAME' WIDTH 20;
See also
BREAK
COMPUTE
SET LINESIZE
SET NULLS
SHOW REPORT
COMPUTE
,
COMPUTE MAX OF column id ON break list
OFF MIN
SUM
AVG
COUNT
This command performs aggregate computations at breakpoints and prints the results.
The computations are:
• SUM (totals, subtotals)
• AVG
• MIN
• MAX
• COUNT
These computations should not be confused with the SQL functions that have similar
names. The SQL functions calculate and display rows of summary information for
groupings without displaying detail data. The COMPUTE functions calculate and
display summary rows of data along with detail data.
Before running this command, you must first issue a BREAK command. If a
COMPUTE is given without a BREAK command, an error message is displayed.
Each aggregate function requires a separate COMPUTE command.
COMPUTE commands are cumulative. This permits multiple calculations for a
single column. For example, if a COMPUTE specifies MIN of a column, and a
subsequent COMPUTE specifies MAX for the same column, then both the minimum
and maximum for that column are calculated and printed.
Clauses
OFF
Specify OFF to turn off a specific COMPUTE option. To turn on the function
again, the COMPUTE command must be given again for that function.
MAX
This function calculates the maximum value of the items in the compute list for
each group of rows specified in the break list.
The computed values are printed at each break point on one or more lines with a
blank line separating the summary calculations from the detail rows.
MIN
This function calculates the minimum value of the items in the compute list for
each group of rows specified in the break list.
The computed values are printed at each break point on one or more lines with a
blank line separating the summary calculations from the detail rows.
SUM
This function calculates the total value of the items in the compute list for each
group of rows specified in the break list.
The computed values are printed at each break point on one or more lines with a
blank line separating the summary calculations from the detail rows.
AVG
This function calculates the average value of the items in the compute list to be
calculated for each group of rows specified in the break list.
The computed values are printed at each break point on one or more lines with a
blank line separating the summary calculations from the detail rows.
Null values are not included in the calculation.
COUNT
This function calculates the number of the items in the compute list for each
group of rows specified in the break list.
The computed values are printed at each break point on one or more lines with a
blank line separating the summary calculations from the detail rows.
Null values are not included in the count calculations.
OF column ID
The column-ID can be:
• The position number of the column in a subsequent SELECT command.
• An alias specified with the COLUMN command.
The calculations are performed for each of the column-IDs in the compute-list.
ON break list
This contains column IDs separated by blanks and/or the keyword REPORT. All
items in the break list must also have been specified as break points in the
BREAK command (but the reverse is not true). No computations are performed
for break points that are specified in the COMPUTE command but not in the
BREAK command. If the break order is different in the two commands, the order
specified in the BREAK command takes precedence.
Examples
The example below shows a sequence of commands that assigns aliases with the
COLUMN command, sets BREAK fields, and finally specifies three calculations
using the COMPUTE command.
CREATE TABLE X (DEPTNO INT, LNAME CHAR(10), PROJNO INT,
SAL INT);
INSERT INTO X VALUES (1, 'Wayne', 200, 1000);
COLUMN 1 ALIAS DEPTNO;
COLUMN 2 ALIAS LNAME;
COLUMN 3 ALIAS PROJNO;
See also
BREAK
SHOW REPORT
CONNECT
cursor number
database name auth id/password
You can use this command to perform one of the following functions:
• Establish a cursor that is part of an implicit connection.
When you connect a database to a specified cursor, SQLBase automatically
assigns an implicit connection handle to the cursor. All cursors connecting to
the same database, regardless of the username and authorization ID, are part
of the same transaction.
• Establish a cursor that is part of an explicit connection.
When you specify a cursor as part of an explicit connection, you must specify
the connection name which identifies a connection handle. Each connection
handle represents a specified database connection and a separate, independent
transaction in the server. For details, read BEGIN CONNECTION on page
2-8.
Generally, cursors established implicitly apply to applications in which you are
connecting cursors to a specific database that belong to a single transaction.
To create multiple, independent connections, SQLBase allows you to explicitly create
multiple connection handles. You can use the CONNECT command to connect
cursors to specific connection handles. Using explicit connection handles allow you to
implement multiple transactions to the same database within an application. If you are
using a connection handle and associating a cursor with the specified connection
handle, you can only have one user per transaction.
Note: You can use both implicit and explicit connections within an application.
executing the current SQL command and the current connection is the one to which
the current cursor belong.
The current cursor and subsequently the current connection is the cursor established
by the last CONNECT or USE command, or the cursor most recently established at
SQLTalk start up time (if no cursor is specified at start up time, cursor 1 is the
default). Cursors are associated with an implicit or explicit connection handle that
identifies a connection to a specific database.
Clauses
database name
Specify a database name only if you are establishing an implicit database or
cursor connection and want to specify a database to connect to.
If the database name is not specified in a CONNECT command, it is assumed
that the current database will remain unchanged.
If you are connecting to the MAIN database, specify the name of the server
where the MAIN database is instead of the database name itself.
cursor number
A cursor number is required whether you are establishing an implicit or explicit
connection.
This is a unique number that identifies a single connection between SQLTalk and
SQLBase. You can establish multiple cursors within an implicit or explicit
database connection by giving each cursor in a connection a new cursor number.
If you are establishing an implicit connection to a database, you assign the cursor
connection a specified database name. If you are connecting a cursor to an
explicit database connection issued through a connection handle created with the
BEGIN CONNECTION command, you assign the cursor connection a specified
connection name. By connecting more than one cursor to the same database or
connection, each cursor represents a SQL command or activity that is part of a
single transaction.
If you use the CONNECT command to specify an existing cursor number, the
old cursor is removed, and a new cursor is established with the specified
parameters.
connection name
Specify a valid connection name only if you are connecting a cursor to an
explicit connection. An explicit connection is created with the BEGIN
CONNECTION command, which issues a connection handle associated with a
Examples
Implicit connections
Connect a second cursor to the database TESTDB with John's authorization ID and
password.
CONNECT TESTDB 2 JOHN/280Z;
Connect to a second cursor within the same database.
CONNECT 2;
Explicit connections
Connect a second cursor to the connection named CH2.
CONNECT 2 TO CONNECTION CH2;
Connect to a third cursor within the same connection.
CONNECT 3 to CONNECTION CH2;
See also
BEGIN CONNECTION
GRANT (SQL command)
SET CURSORNAME
USE
SHOW CONNECTION
COPY
TO destination table
cursor number
This command copies data from a source table to an existing destination table in the
same or a different database.
COPY puts a shared lock on the source table, which means that other users can read
the table, but are unable to modify it. The new data copied to the destination table
gets an exclusive lock.
Clauses
cursor number
To copy data to a destination table on another database, prefix the destination and
source table name with the cursor number that identifies a connection to the
database.
If the cursor number is omitted, the system assumes that the source table and
destination table exist on the current database. The current database is the one to
which connection was established at sign-on or with the last CONNECT or USE
command.
The default connection is with cursor 1.
source table
The name of the table from which data is copied.
destination table
The name of the table to which data is copied. This table must exist. The COPY
command does not create the destination table. The columns of the destination
table must be compatible in length and data type with the columns of the source
table.
Examples
Copy the employee data from the current database to the TEST database. The TEST
database is connected by cursor 2.
COPY EMPLOYEES TO 2.EMPLOYEES;
Copy the employee data to another table, EMPLOYEE_LIST, which is on the current
database.
COPY EMPLOYEES TO EMPLOYEE_LIST;
This example illustrates connecting to another database and copying from another
table.
CONNECT PERSONEL 2 JENNY/BEAR;
CREATE TABLE CODES (CODE CHAR(3),DESCRIPTION CHAR(50));
COPY 1.CODES TO CODES;
See also
CONNECT
USE
DBERROR
DBERROR
error code
This command displays the message text, reason, and remedy code for an error code.
Clauses
error code
To display information about a specific error code, enter the error’s associated
numeric error code contained in the error.sql file.
If you do not enter a specific error code, the command displays information about
the last error code accessed.
Example
The following example displays the message text, reason, and remedy for SQLBase
error 1805.
DBERROR 1805;
01805 LKM TMO Time out
Reason: The transaction is waiting for a resource currently
locked by another transaction. The transaction will wait by
default 275 seconds unless specified otherwise.
Remedy: Determine what transaction is locking the resources and
attempt to make changes so that the wait situation does not
occur frequently. A COMMIT as often as possible often helps to
avoid these time out condition. To reduce the time wait period
you can use the set timeout function call (sqltio) or in SQLTalk
you can SET TIMEOUT n where n is the number of seconds. The
number of seconds can range from 1 to 1800 seconds (30 minutes).
DISCONNECT
cursor number
database name
Clauses
cursor number
A cursor number is required whether you are disconnecting a cursor that was
connected implicitly or explicitly.
Specify the cursor from which you are disconnecting. You cannot disconnect
from the current cursor (the cursor that is currently being used).
database name
If you are disconnecting an implicit connection, you can specify the name of the
database for the specified cursor you are disconnecting. If you commit the
database name, the specified cursor for the current database is disconnected. The
current database is the database to which you are connected a sign-on or with the
most recent CONNECT or USE command.
Examples
Disconnect cursor 2. Note that this example can apply to either a cursor that was
connected implicitly or explicitly.
DISCONNECT 2;
Disconnect DATABASE TESTDB that was implicitly connected to cursor 2.
DISCONNECT TESTDB 2;
See also
BEGIN CONNECTION
CONNECT
END CONNECTION
USE
END CONNECTION
This command terminates a specified connection that you created explicitly with the
BEGIN CONNECTION command. You supply the name of the connection that you
want to terminate. This closes the corresponding connection handle that is associated
with the database, thereby terminating the connection.
Note that you cannot terminate the connection of the current cursor. SQLTalk always
maintains what it considers to be the current cursor. The current cursor is the cursor
used for any SQL command execution.
By default, the END CONNECTION command causes an implicit commit for a
SQLBase database associated with the connection. Use the SHOW
CLOSETRANSMETHOD to display whether a COMMIT or ROLLBACK will be
issued before the connection handle is terminated. To change the setting to
ROLLBACK for SQLBase databases, use the SET CLOSETRANSMETHOD
command. For details, read the CLOSETRANSMETHOD option described in the
SET command in this chapter.
Note: You can disconnect an implicit connection to a database or cursor using the
DISCONNECT command. For details, read DISCONNECT on page 2-30.
Clauses
connection name
Specify the connection name, which can be no more than eight characters in
length.
Example
The following example terminates a specified connection:
END CONNECTION CH2;
See also
BEGIN CONNECTION
CONNECT
USE
SHOW CONNECTION
ERASE
Clauses
auth ID.
If you are not the creator of the command or procedure, specify the authorization
ID of the owner.
stored command/procedure name
The name of the previously compiled and stored command or procedure to
delete.
Examples
The following commands store a query and then erase it.
STORE myquery SELECT * FROM BIRTHDAYS;
ERASE myquery;
The following command erases the strdproc_pres stored procedure.
ERASE strdproc_pres;
See also
EXECUTE
STORE
EXECUTE
Clauses
auth ID.
If you are not the creator of the command or procedure, specify the authorization
ID of the owner. For example, assume that SYSADM created a stored command.
To execute it, enter this command:
EXECUTE SYSADM.command-name
stored command/procedure name
The name of the stored command or procedure to execute.
If the SQL command contains bind variables, the EXECUTE command must be
followed by the input data. The delimiter for the EXECUTE command must be a
line containing a backslash (\). This notifies SQLTalk that input data comes from
the keyboard. The end of the input data is marked with a forward slash (/) on a
new line.
Examples
This example compiles and stores a command ADDNAMES. The EXECUTE
command contains bind variables, so you must enter data.
STORE ADDNAMES
INSERT INTO FRIENDS (NAME) VALUES (:1);
EXECUTE ADDNAMES
\
PROCESSING DATA
LEN
MARGE
BETTY
/
3 Rows Inserted
The following commands store and execute the pr_pres procedure.
STORE strdproc_pres
PROCEDURE pr_pres
Local Variables
Sql Handle Cur1
Actions
Call SqlConnect (Cur1)
Call SqlStore (Cur1, ‘presname’, \
‘SELECT pres_name FROM sysadm.president’)
Call SqlDisconnect (Cur1);
EXECUTE strdproc_pres;
The following example recompiles all of SYSADM’s stored commands, both valid
and invalid.
EXECUTE RECOMPILE
\
‘SYSADM’,%,_,0,0,0
/
See also
ALTER COMMAND
ERASE
PREPARE
STORE
EXIT
EXIT
This command exits SQLTalk and returns to the native operating system. It
disconnects all cursors and causes an implicit COMMIT for all cursors and all
databases.
Example
EXIT;
FETCH
Clauses
integer constant
This specifies the number of rows to retrieve, starting with the row pointed to by
the last SET SCROLLROW command.
Example
The example below uses an ADJUSTING clause and a result set.
SET CURSORNAME MYCUR;
SET SCROLL ON;
SELECT * FROM PRESIDENT;
SET SCROLLROW 3;
FETCH 10;
A different cursor is used to INSERT, preserving the result set.
CONNECT DEMO 2;
INSERT into result set.
INSERT INTO PRESIDENT (PRES_NAME)
VALUES ('George Bush') ADJUSTING MYCUR;
Return to the result set cursor.
USE 1;
The result set is unaffected, so you can execute a FETCH without executing the
SELECT again.
FETCH 5;
See also
PERFORM
PREPARE
SET SCROLL
SET SCROLLROW
LEFT
This command shifts the displayed output of a SELECT command to begin with a
column to the left of the current first column of the output.
This command enables you to view a wide report on a device whose LINESIZE is
smaller than the DEVICESIZE.
This command does not affect the column-IDs of the columns in the select list.
Clauses
number of columns
This indicates how many columns to the left of the currently displayed first
column to shift the report.
If the specified number is greater than the number of columns existing to the left,
then the report begins at the first column. Columns that you specified as PRINT
OFF in the COLUMN command are ignored.
Example
SELECT ITEMNO, ITEM, COST FROM INVENTORY;
ITEMNO ITEM COST
====== ========= ====
1 CHOCOLATE 1.59
2 COCOA 2.48
3 COLA 1.46
ITEM COST
========= ====
CHOCOLATE 1.59
COCOA 2.48
COLA 1.46
See also
COLUMN
RIGHT
SET DEVICESIZE
SET LINESIZE
LIST
LIST
line number
This command displays the most recently-entered command. This command lets you
view the input before editing it with the EDIT command.
Clauses
line number
This indicates the line of the command to list. If you did not specify a line, the
entire command is displayed.
Examples
SELECT A, B, C FROM TAB1
WHERE A = 'N';
LIST;
SELECT A, B, C FROM TAB1
WHERE A = 'N'
LIST 1;
SELECT A, B, C FROM TAB1
See also
EDIT
PAUSE
PAUSE
This command suspends the SQLTalk session until you press the enter key.
This command can be used in a SQLTalk command file to cause a pause between
groups of commands or to mark a transition point.
Example
PAUSE;
See also
REMARK
PERFORM
PERFORM
This command runs a PREPAREd (compiled) SQL command or procedure. You must
execute the PERFORM command immediately after a PREPARE command.
Example
PREPARE PROCEDURE pr_pres
Local Variables
Sql Handle Cur1
Actions
Call SqlConnect (Cur1)
Call SqlStore (Cur1, 'presname', 'Select pres_name from \
sysadm.president')
Call SqlDisconnect (Cur 1);
PERFORM;
See also
FETCH
PREPARE
SET SCROLL
SET SCROLLROW
PREPARE
This command compiles a SQL command or procedure that is not stored, but does not
execute it.
Four things happen when SQLBase compiles a SQL command or procedure:
1. The command itself or the SQL commands in the procedure are parsed. SQLBase
detects syntax errors and verifies the existence of database objects.
2. SQLBase performs a security check.
3. SQLBase determines the execution plan, finding the optimal access path to the
data.
4. SQLBase translates the command or commands into a series of executable
modules.
If you do not precompile commands with PREPARE, you must compile them at run
time. In a production application, precompilation makes complex SQL operations
perform better.
Clauses
SQL command/procedure
Specify the command or procedure to compile. You cannot prepare a stored
command or stored procedure.
Example
The following example prepares a SQL command:
PREPARE SELECT * FROM CUST WHERE CUST_NAME = 'jones';
The following example prepares a procedure:
PREPARE
PROCEDURE WithDraw
Parameters
NUMBER: nAccount
NUMBER: nAmount
RECEIVE NUMBER:nNewBalance
Local Variables
STRING sUpdate
STRINGsSelect
Actions
SET sUpdate = 'UPDATE Checking SET \
Balance = Balance - :nAmount '|| 'WHERE \
AccountNum = :nAccount'
CALL SQLImmediate(sUpdate)
SET sSelect ='SELECT Balance FROM Checking ' || \
'WHERE AccountNum = :nAccount ' || \
'INTO :nNewBalance'
CALL SQLImmediate(sSelect);
PERFORM
\
100, 200, 0
/
See also
EXECUTE
FETCH
PERFORM
SET SCROLL
SET SCROLLROW
PRINT
command file TO output file
This command prints a report on a printer or writes a report to an external file. When
you enter the PRINT command, it causes the specified command file to be run (see
the RUN command) and the results are printed or written to a specified file.
Clauses
command file
This file contains SQLTalk report formatting commands and one SELECT
command. The file can be produced with the SAVE REPORT command. You can
also produce a command file manually.
If any of the commands result in an error, an error message is displayed on the
screen and the report is not produced.
All commands after the first SELECT are ignored.
If the command file name is omitted, the most recent SQL command is executed
and the results printed.
TO output file
This names the file where the report lines are written. If the TO clause is omitted,
report lines are sent to the system printer.
Examples
This command prints the results of the most recently-executed command on the
system printer.
PRINT;
This command prints the results of the command file MYREPORT on the system
printer.
PRINT MYREPORT;
This command writes the results of the command file MYREPORT to the file
MYREPORT.RPT.
PRINT MYREPORT TO MYREPORT.RPT;
See also
RUN
SAVE REPORT
RELEASE LOG
RELEASE LOG
A new log file is created automatically when the current active log file becomes full
(this is referred to as log rollover). RELEASE LOG forces a log rollover and so is
useful when executed just before a BACKUP command. In releasing the current
active log file, you can back it up (if LOGBACKUP is enabled) and SQLBase can
then delete it. In doing so, the most up-to-date backup is created.
You must issue a SET SERVER command before this command.
RELEASE LOG is not needed if the BACKUP SNAPSHOT command is used.
BACKUP SNAPSHOT automatically forces a log rollover.
Example
BACKUP DATABASE TO \DEMOBKUP;
DATABASE BACKED UP
RELEASE LOG;
RELEASE LOG COMPLETED
BACKUP LOGS TO \DEMOBKUP;
2 LOGS BACKED UP
See also
BACKUP
SET LOGBACKUP
SET SERVER
REMARK
REMARK
This command is used in command files to display explanatory text. The text is
displayed exactly as entered.
The REMARK command is echoed to the screen regardless of whether ECHO is ON
or OFF.
Example
REMARK
\
This is a comment. The comment starts with a backslash
signalling data input. The comment ends with a forward slash
and a new line.
/
See also
PAUSE
REORGANIZE
REORGANIZE
This command reorganizes the current database using the following steps:
1. Unloads the database into a file.
2. Initializes the database.
3. Reloads the database.
Example
REORGANIZE;
See also
CHECK DATABASE
RESTORE
TO database name
ON CLIENT
SERVER
This command restores a database, one or more transaction logs, or both. The
database is always restored from the following file:
database-name.BKP
A RESTORE cannot be performed while users are connected to the database
(including the DBA doing the RESTORE). To handle this, execute a SET SERVER
command to switch your connection to the server rather than the database.
Note if you are using batch mode, you need to first specify NOCONNECT in the
SQLTalk command line to prevent connecting to the database:
C:\CENTURA> SQLTALK BAT NOCONNECT
Then after SQLTalk starts, you enter a SET SERVER command to connect to the
server.
You can restore and recover backups made with BACKUP SNAPSHOT in one of two
ways:
• A RESTORE SNAPSHOT command (the easiest way).
• A RESTORE DATABASE command followed by a subsequent
ROLLFORWARD command.
You can restore a non-partitioned database to a partitioned database, and vice versa.
Note that a non-partitioned database cannot exceed 2 gigabytes. This limit applies to
all other files manipulated by SQLBase. For example, you cannot create a partition
(dbarea) greater than 2 gigabytes.
If you do have a non-partitioned database greater than 2 gigabytes, you must perform
the restore operation from backup segments. Each segment must be 2 gigabytes or
less in size.
To perform the restore operation from segmented backups, you must specify a control
file databasename.BCF (created from a successful segmented database backup). This
control file describes the location and size of the segments to which you want to
restore your database.
If the restore control file is present in the directory specified in the TO and FROM
clause of the RESTORE command, the restore operation is performed from the
backup segments specified in the control file. Otherwise, the RESTORE command
expects to find the restore file databasename.BKP to restore the database.
Note that SQLBase issues an error if you try to restore databases in segments larger
than 2 gigabytes.
Clauses
DATABASE
Copies the database backup to the current database directory.
LOGS
Copies the transaction log files associated with a database to the current log
directory and applies them to the restored database. This command continues
restoring logs until all the logs in the backup directory that need to be applied
have been exhausted.
After each execution of RESTORE LOGS, a message showing the next log file
to be restored is displayed. If there are more logs to be processed than can fit on
disk at one time, you can use the RESTORE LOGS command repeatedly to
process all the necessary logs.
If a log file with the same name already exists in the current directory, you are
prompted with this message:
Log file already exists. Overwrite it (Y/N)?
If the log file requested is not available, you can use the ROLLFORWARD
database END command to terminate media recovery and recover the database
using the information obtained up to that point (if possible).
SNAPSHOT
This option restores the database and the associated log files that were created
with a BACKUP SNAPSHOT command. The log files, if there are any, are
automatically applied to the database. Therefore, a subsequent
ROLLFORWARD command should never follow a RESTORE SNAPSHOT.
FROM directory name
This specifies the directory name where the files to be restored are located.
ON CLIENT or ON SERVER
This specifies the directory name where the backup files to be restored are
located. This directory can be on the client or server. The default is ON CLIENT.
TO database
This specifies the name of the database that is to be restored.
If a database file with the same name already exists, you are prompted with this
message:
Database file already exists. Overwrite it (Y/N)?
Example
RESTORE DATABASE FROM \DEMOBKUP TO DEMO;
DATABASE RESTORED
ROLLFORWARD DEMO;
ROLLFORWARD STARTED
The log file 1.LOG could not be found. Use the RESTORE LOGS
command to restore this log and continue the rollforward
process. If this log is not available, use the ROLLFORWARD
database END command to complete the recovery process.
RESTORE LOGS FROM \DEMOBKUP TO DEMO;
4 LOGS RESTORED
The log file 5.LOG could not be found. Use the RESTORE LOGS
command to restore this log and continue the rollforward
process. If this log is not available, use the ROLLFORWARD
database END command to complete the recovery process.
ROLLFORWARD DEMO END;
ROLLFORWARD COMPLETED
See also
BACKUP
RELEASE LOG
ROLLFORWARD
SET SERVER
RETRIEVE
stored command
This command retrieves a stored SQL command or stored procedure, but does not
execute it. Once a command or procedure has been retrieved, data can be bound if
needed and the command/procedure can be executed.
Once a command or procedure is retrieved, it cannot be destroyed by a commit or
rollback.
If another transaction changes the system catalog items that the retrieved command or
procedure depends on between the commit and the execute, the execute fails.
You cannot use stored commands/procedures while in restriction mode.
Clauses
stored command/procedure
Specify the command or procedure to retrieve. You can only retrieve one stored
procedure at a time. You can retrieve multiple stored commands, but the last
command in the series must be a SELECT command.
Example
The following example stores, retrieves, and performs a SQL command. Since the
stored command contains a SELECT statement, you must issue a FETCH command
after the PERFORM to retrieve the output rows.
STORE sceng SELECT * FROM ENGINEERS;
RETRIEVE sceng;
PERFORM;
FETCH 10;
EMPL_NUM NAME REP_OFFICE TITLE HIRE_DATE
========= ======= =========== ==== ===========
100 Paul Atkins 10 Manager 12-FEB-1988
10 Bob Smith 20 Sen.Engineer 05-SEP-1992
107 Murray Roch 30 Sen.Engineer 25-JAN-1991
102 Larry Sanchez 10 Sen.Engineer 12-JUN-1989
101 Sheila Brown 10 Engineer 10-OCT-1990
06 Sam Valdez 30 Manager 20-APR-1990
105 Rob Jones 20 Engineer 08-SEP-1991
103 Anna Rice 20 Manager 10-JUL-1985
108 Mary Adams 40 Manager 10-AUG-1988
109 Nancy Bonet 40 Sen.Engineer 12-NOV-1989
10 ROWS SELECTED
The following example stores, retrieves, and performs a stored procedure:
STORE procwd
PROCEDURE WithDraw
Parameters
NUMBER: nAccount
NUMBER: nAmount
RECEIVE NUMBER:nNewBalance
Local Variables
STRING sUpdate
STRING sSelect
Actions
SET sUpdate = 'UPDATE Checking SET \
Balance = Balance - :nAmount '|| 'WHERE \
AccountNum = :nAccount'
CALL SQLImmediate(sUpdate)
SET sSelect ='SELECT Balance FROM Checking ' || \
'WHERE AccountNum = :nAccount ' || \
'INTO :nNewBalance'
CALL SQLImmediate(sSelect);
RETRIEVE procwd;
PERFORM
\
100, 200, 0
/
See also
EXECUTE
FETCH
PERFORM
PREPARE
SET SCROLL
SET SCROLLROW
RIGHT
This command shifts the displayed output of a SELECT command to the right of the
first column.
This command enables you to view a wide report on a device whose LINESIZE is
smaller than the DEVICESIZE.
This command does not affect the column-IDs of the columns in the select list.
Clauses
number of columns
This indicates how many columns to the right of the currently displayed first
column the report must begin. If the specified number is greater than the number
of columns existing to the right, no columns are displayed. Columns that are
specified as PRINT OFF (see COLUMN command) are ignored for purposes of
this command.
Example
SELECT ITEMNO, ITEM, COST FROM INVENTORY;
ITEMNO ITEM COST
====== ========= ====
1 CHOCOLATE 1.59
2 COCOA 2.48
3 COLA 1.46
First, the RIGHT command displays the rightmost column first.
RIGHT 2;
SELECT ITEMNO, ITEM, COST FROM INVENTORY;
COST
====
1.59
2.48
1.46
The LEFT command shifts the column, making the column to the left of the current
first column the leftmost column.
LEFT 1;
SELECT ITEMNO, ITEM, COST FROM INVENTORY;
ITEM COST
========= ====
CHOCOLATE 1.59
COCOA 2.48
COLA 1.46
See also
COLUMN
LEFT
SET DEVICESIZE
SET LINESIZE
ROLLFORWARD
Clauses
TO END
This option rolls forward through all log files available. This option is the default
because users normally want to recover as much of their work as possible.
TO BACKUP
This option rolls forward to the end of the backup restored. This recovers all
committed work up to the point of the last database backup.
TO TIME
This option rolls forward to a specified date and time. The date and time are
specified in the format "mm/dd/yy hh:mi:ss".
This allows you to recover a database up to a specific point in time, and in effect
rolls back large "chunks" of committed and logged work that you no longer want
applied to the database. For example, if data is erroneously entered into the
database, you would want to restore the database to the state it was in before the
bad data was entered.
END
If a log file requested is not available, you can enter a ROLLFORWARD
database END command to complete recovery with only the information
obtained up to that point.
CONTINUE
Use this option when restoring logs manually with a mechanism other than
RESTORE LOGS (such as with a tape drive that is directly attached to the server
that is used for restoring logs).
You should also use this option when the rollforward operation stops because
SQLBase cannot find a log file that it needs. Use the RESTORE LOGS command
(or sqlrlf SQL/API function) to copy the log files needed from the backup
directory to the current log directory. Then enter a ROLLFORWARD database
CONTINUE command (or sqlcrf SQL/API function) to resume the rollforward
operation.
Example
RESTORE FROM \DEMOBKUP TO DEMO;
DATABASE RESTORED
ROLLFORWARD DEMO;
ROLLFORWARD STARTED
The log file 1.LOG could not be found. Use the RESTORE LOGS
command to restore this log and continue the rollforward
process. If this log is not available, use the ROLLFORWARD
database END command to complete the recovery process.
RESTORE LOGS FROM \DEMOBKUP TO DEMO;
4 LOGS RESTORED
The log file 5.LOG could not be found. Use the RESTORE LOGS
command to restore this log and continue the rollforward
process. If this log is not available, use the ROLLFORWARD
database END command to complete the recovery process.
ROLLFORWARD DEMO END;
ROLLFORWARD COMPLETED
See also
BACKUP
RESTORE
SET SERVER
RUN
RUN
command file DETECT ERRORS
Clauses
command file
This is the name of the command file that is executed. If the command file name
is omitted, the RUN command executes the most recent SQL command.
If the command file contains SQLTalk report formatting commands, the
environment created by the command file remains for successive SQL
commands entered at the keyboard until changed by other environment
commands.
The backslash (\) character marks the start of input data. The end of the data is
marked with a forward slash (/) character on a new line followed by a carriage
return.
The file can contain nested RUN commands. RUN commands can be nested
within command files up to ten levels deep.
If the command file contains SQL commands that use bind variables, the input
data can come from:
• The command file
• The keyboard
• A separate data file
$DATA Keyword
If the data is not included in the command file, the keyword $DATA can be used
to signal input from another source. This source is always a previous file, which
can be a text file or the keyboard. When this keyword is encountered, SQLTalk
looks for a backslash, followed by data lines, in the previous file.
DETECT ERRORS
An error during command file processing causes execution to be interrupted.
Otherwise, the error message is displayed and the next command in the command
file is executed.
Examples
Data and commands in one file
The following command file (named myproc1.cmd) contains a SQL command and
data:
UPDATE ITEMS SET PRICE =:1 WHERE ITEM_NAME = :2
\
.89,rice
.85,spaghetti
.83,rigatoni
/
This command executes the myproc1.cmd command file:
RUN MYPROC1.CMD;
PROCESSING DATA
.89,rice
.85,spaghetti
.83,rigatoni
3 ROWS UPDATED
At this point, SQLTalk has read the $DATA keyword variable from the command file
and is looking for a backslash from the keyboard to signal the beginning of input data.
The backslash and data are entered. You can enter a forward slash to signal the end of
input data:
\
1.50,tortellini
.89,macaroni
.99,linguine
/
3 ROWS UPDATED
PROCESSING DATA
1.85,tortellini
.69,macaroni
.85,linguine
3 ROWS UPDATED
PROCESSING DATA
1.00,bread
.75,tuna
.97,cheese
3 ROWS INSERTED
UPDATE ITEMS SET PRICE =:1 WHERE ITEM_NAME =:2
PROCESSING DATA
2.25,tortellini
1 ROW UPDATED
See also
SAVE
SET PAUSE
SAVE
This command writes the most recently executed SQL command or a series of
SQLTalk commands to a command that can then be RUN. You can save the current
SQL command or the current SQLTalk environment.
Clauses
SQL
If you specified this, the most recent SQL command is saved in the specified file.
REPORT
If you specified this, all the SQLTalk commands making up the current display
environment and report format are saved in the specified file. These include SET,
BTITLE, BREAK, COLUMN, COMPUTE, and TTITLE commands. Not all
SET options are saved (such as TIME, CURSOR, or PAUSE) since they do not
affect report format.
You can save the default SQLTalk environment by entering the SAVE REPORT
command during a session before making any formatting changes.
command file
This is the name of the command file in which to store the commands. If the file
already exists, you are prompted to append to the file, to abort the command, or
to continue (write over the file). You can use the append feature to add a SQL
command to an existing report environment file.
Examples
This command changes the SQLTalk environment and writes the report commands to
a file.
See also
BREAK
BTITLE
COLUMN
COMPUTE
RUN
SET
TTITLE
SET
This command sets environment options for the SQLTalk session. Some options can
be turned ON or OFF; others require a numeric or string constant assignment.
The SHOW command displays the setting of environment options.
Clauses
option name
This is the name of the option that is being set. The options are described below.
AUTOCOMMIT
If this is ON, the database is committed automatically after each SQL command.
Otherwise, the database is committed only when you issue a COMMIT
command. A commit via AUTOCOMMIT is identical to one issued explicitly.
Any operation performed on the cursor causes a commit for all cursors connected
to the database. However, an operation on a cursor where autocommit is not
turned on does not cause an automatic commit.
For a cursor in a distributed transaction, AUTOCOMMIT causes an implicit
coordinated commit.
The AUTOCOMMIT option cannot be turned on at the same time as the BULK
option. Turning on the BULK option automatically disables AUTOCOMMIT.
AUTOCOMMIT only affects the following operations:
• compile and execute
• execute
• store a command
• drop a command
• retrieve a command
• release log
For other types of operations, you should do an explicit commit, even if you have
RL isolation.
There is no specific authority required to run SET AUTOCOMMIT.
The default is OFF.
BELL
If this is ON, the bell sounds when user interaction is desired.
There is no specific authority required to run SET BELL.
The default is OFF.
BM integer constant
This sets the bottom margin of a report (the number of blank lines that are
displayed at the bottom of a page). The value can range from 0 to PAGESIZE.
There is no specific authority required to set this option.
The default is 0.
BULK
If this is ON, operations are buffered in the output message buffer as much as
possible.
The bulk execute feature reduces the network traffic for multi-row inserts,
deletes, and updates, particularly across a network. In bulk execute mode, data
values are buffered so that many rows can be sent to the server in one message.
Increasing the size of the output message buffer with the SET OUTMESSAGE
command increases the number of operations that can be buffered in one message
to the server, which improves performance. The minimum setting for this buffer
is 320 bytes.
The BULK option cannot be turned on at the same time as the AUTOCOMMIT
option. Turning on BULK automatically disables AUTOCOMMIT.
This setting is cursor specific.
You must have CONNECT authority to set this option.
The default is OFF.
CHECKPOINT integer constant
This specifies how often a recovery checkpoint operation is performed. This
operation is required for the automatic crash recovery mechanism.
Depending on the applications running against the server, a checkpoint operation
can affect performance. If this happens, the checkpoint interval can be increased
until the desired performance is attained.
The default checkpoint time interval is very small, yielding a crash recovery time
of less than a minute. If a longer crash recovery time can be tolerated, the interval
can be increased up to 30 minutes.
You must have DBA authority to set this option.
The default is one minute.
CLOSETRANSMETHOD [COMMIT | ROLLBACK | DEFAULT]
This option specifies whether a COMMIT or ROLLBACK is issued before a
connection handle is destroyed. The default is DEFAULT which means that this
DECHO
If this is ON, data accompanying a SQL command in a bind variable is echoed to
the screen.
If this is OFF, the data is not echoed.
This command is useful when INSERTing large amounts of data.
If ECHO is OFF, DECHO cannot be set ON.
There is no specific authority required to set this option.
The default is ON.
DEVICESIZE integer constant
This indicates the width of the output device in number of characters. Typical
screens are 80 characters wide. Printers usually range from 80 to 132 characters.
If the LINESIZE is less than the DEVICESIZE, excess characters to the right are
truncated, unless the LEFT or RIGHT commands are used to position the
displayed columns appropriately.
There is no specific authority required to set this option.
The default DEVICESIZE is 80. The range is 0 to 132.
DISTRANS
This indicates that all subsequent commands will be part of a distributed
transaction, which spans multiple databases. Currently, you cannot include a
BACKUP or RESTORE command in a distributed transaction. You cannot turn
DISTRANS ON if connection handles exist. The default is OFF.
Note: Connection handles are not supported for distributed transactions. Therefore, if you are
using connection handles, distributed transactions cannot be enabled. For details on connection
handles, read the sections in this chapter on the BEGIN CONNECTION and CONNECT
commands.
You can set DISTRANS ON in the same connection in which it was set OFF. All
connects after DISTRANS has been set OFF belong to non-distributed
transactions.
There is no specific authority required to set this option.
ECHO
If this is ON, command text is echoed to the screen when executing a command
file using the RUN command or a precompiled command with the EXECUTE
command.
If this is OFF, the text and any associated data is not echoed.
There is no specific authority required to set this option.
The default is ON.
ERRORLEVEL n
This controls the level of detail in the error messages that SQLTalk displays.
The number that you specify can be from 1 to 3. The table below explains the
meaning of each number.
Error
Explanation
Level
Error
Explanation
Level
Note: For procedures, if you want the On Procedure Fetch section to execute exactly once for
every fetch call from the client (returning one row at a time) set FETCHTHROUGH mode on
at the client (the default is off).
In these cases, rows in the result set cannot be mapped to the rows in the
database. If you UPDATE in this situation and later fetch an UPDATEd row, the
row will not reflect the UPDATE even if FETCHTHROUGH is ON.
HEADING
If this is OFF, default headings are not displayed above each column of data
during query output.
If this is ON, default headings are displayed above columns for which a
COLUMN HEADING has been given.
Column headings specified with the COLUMN command are displayed
regardless of the setting of the HEADING option. Default headings contains
column names (or expressions) as they appear in the select list of a SELECT
command.
There is no specific authority required to set this option.
The default is ON.
HISFILESIZE integer constant
This option requires DBA authority.
If the READONLY option is enabled for a database, this parameter limits the size
of the read-only history file. The size is specified in kilobytes.
The default history file size is one megabyte (1000 kilobytes).
INDENT integer constant
This sets the number of spaces that each wrapped line in a multi-line row is
indented. Usually, one or two spaces are appropriate.
The default is one.
There is no specific authority required to set this option.
If you set this to zero (0), continuation lines are not indented.
INMESSAGE integer constant
This sets the default maximum size (in bytes) for the SQLBase input message
buffer. The input message buffer refers to input to the application (such as the
result of a query).
The INMESSAGE size affects the cursor that is active when the command is
given.
Most query data will not exceed the default input message buffer size, but if it
does, you can use this command to raise the size of the INMESSAGE.
The input message buffer is allocated on both the client computer and on the
database server. The database server builds an input message in this buffer on the
database server computer and sends it across the network to a buffer of the same
size on the client. It is called an input message buffer because it is input from the
client's point of view.
There is one input message buffer per connected cursor on the client computer.
The server maintains one input message buffer that is the size of the largest input
message buffer on the client computer.
The input message buffer can receive a return code indicating that the specified
operation was successful, the data that is being fetched, and other information.
While fetching data from the database, SQLBase compacts as many rows as
possible into one input message buffer.
Each FETCH reads the next row from the input message buffer until they are
exhausted. At this instant, SQLBase transparently fetches the next input buffer of
rows depending on the isolation level.
A large input message buffer can help performance while fetching data from the
database because it reduces the number of network messages. Note that a large
input message buffer can have a diverse effect on the entire system throughput
because of concurrence. Any row currently in the input message buffer can have
a shared lock on it (depending on the isolation level) preventing other users from
changing that row. Therefore, a large input message buffer can cause more
shared locks to remain than are necessary.
Read the explanation of ISOLATION (SET option) for more information about
how each isolation level uses the input message buffer.
SQLBase automatically maintains an input message buffer large enough to hold
at least one row of data. Despite the specified input message size, SQLBase
dynamically allocates more space if necessary.
A large input message buffer helps performance when reading LONG
VARCHAR columns.
You can also improve overall system performance by decreasing the size of the
input message buffer when an application does not need to fetch data.
Each cursor has one input message buffer associated with it on the client.
You must have CONNECT authority to set this option.
ISOLATION level
This sets the isolation level in a multi-user environment. The isolation level
controls the effect that changes made by one user have on another user accessing
the same tables. SQLBase supports these isolation levels:
The table below summarizes how page locking and the input message buffer
are affected by each isolation level.
Release Lock All locks are released by the time SQLBase returns control
to the client.
Read Repeatability (RR). This isolation level means that all pages which you access
stay locked for other users until you COMMIT your transaction. If the same data is
read again during the transaction, those rows would not have changed. This
guarantees that the data accessed is consistent for the life of the transaction. Identical
SELECT commands will return identical rows since data cannot be changed by other
users during the transaction. In this situation, other users may wait for your COMMIT
command.
Read Repeatability is the default isolation level.
The Read Repeatability isolation level fills the input message buffer with rows. All
shared locks remain regardless of the size of the input message buffer until the
application issues COMMIT or ROLLBACK.
Cursor Stability (CS). This isolation level means that only the page you are
processing at the moment is locked to other users. A shared lock is placed on a page
for as long as the cursor is on that page (while the cursor is stable). Exclusive locks
are held until a COMMIT. Shared locks, on the other hand, are only held while the
cursor is stable on a page. When the cursor moves off the page and the page is no
longer in the message buffer, the page’s shared lock is dropped. Other pages you
accessed during the transaction are available to other users and they do not have to
wait for your COMMIT.
Data that has been read during a transaction may be changed by other users when the
cursor moves to a new page.
Only one row is sent in the input message buffer under the Cursor Stability isolation
level despite the size of the input message buffer. In other words, each FETCH causes
the client and server to exchange messages across the network.
Use Cursor Stability when you want to update one row at a time using the CURRENT
OF cursor clause. When the row is fetched to the client input message buffer, its page
will have a shared lock, which means that no other transaction will be able to update
it.
Read Only (RO). This isolation level places no locks on the database and can only be
used for reading data. DML and DDL operations are not allowed while in Read-Only
isolation. This isolation level provides a view of the data as it existed when you gave
the SELECT command. If you request a page that is locked by another concurrent
transaction, SQLBase provides an older copy of the page from the read-only history
file. The read-only history file maintains multiple copies of database pages that have
been changed.
This is an appropriate isolation level if the data wanted must be consistent but not
necessarily current. This isolation level also guarantees maximum concurrence.
Read-only transactions may affect performance, so they are disabled by default.
Read-only transactions can be turned on with the SET READONLY command or by
specifying the readonly keyword in sql.ini.
This isolation level fills the input message buffer with rows.
The Read-Only isolation level is disabled when the READONLYDATABASE
attribute is on.
Release Lock (RL). Under Cursor Stability, when a reader moves off a database page,
the shared lock acquired when the page was read is dropped. However, if a row from
the page is still in the message buffer, the page is still locked.
In contrast, the Release Locks (RL) isolation level increases concurrence by releasing
all shared locks by the time control returns to the client.
When the next message or command is sent to the database, SQLBase acquires share
locks on only those pages that belong the current cursor. The locks are obtained
regardless of the current command type. Just before returning to the user, SQLBase
releases all shared locks. It also internally notes the page numbers of those pages that
had locks on them.
This isolation level fills the input message buffer with rows, which minimizes
network traffic.
Use this isolation level for browsing applications which display a set of rows to a user.
LIMIT integer constant | OFF
This specifies the maximum number of rows that are displayed as a result of a
SELECT command. This is useful when testing queries on a large database or
where displaying a few rows is enough indication of success for that query. The
number must be a positive and greater than zero.
If set to OFF, the default, the previous limit is removed.
If set to 0, the cursor optimizes the time it takes to return the entire result set. If
set to 1, the cursor optimizes the time it takes to fetch the first row of the result
set.
If sql.ini does not have an optimizefirstfetch keyword, the default setting is 0
(optimize the time it takes to return the entire result set).
Note that a command that was earlier stored, retrieved, and executed will
continue to use the execution plan with which it was compiled.
OPTIMIZERLEVEL integer constant
This sets the optimizer techniques that SQLBase uses for the current cursor. This
lets you experiment with beta optimizing techniques in new versions of
SQLBase.
When this option is 1, SQLBase uses current optimizing techniques.
When this option is 2, SQLBase uses new optimizing techniques.
This option overrides the setting of the optimizerlevel keyword in sql.ini. If
sql.ini does not have an optimizerlevel keyword, the default setting is 2 (use new
optimizing techniques).
This setting is cursor specific.
You must have CONNECT authority to set this option.
OUTMESSAGE integer constant
This sets the maximum size (in bytes) for the output message buffer. The output
message buffer refers to the output of a command.
If you are inserting extremely wide table rows or creating large tables, you can
increase the buffer size. Usually the default is sufficient.
The output message buffer is allocated on both the client computer and on the
database server. The client builds an output message in this buffer and sends it to
a buffer of the same size on the database server. It is called an output message
buffer because it is output from the client's point of view.
The most important messages sent from the client to the database server are SQL
commands to compile or a row of data to insert.
A large output message buffer does not necessarily increase performance
because it only needs to be large enough to hold the largest SQL command to
compile or large enough to hold the largest row of data to insert. A large output
message buffer can allocate space unnecessarily on the both the client and the
server. Rows are always inserted and sent one row at a time (except in bulk
execute mode). A larger output message buffer does not reduce network traffic.
EXECUTION PLAN:
OUTER TBL INDEX USED-O INNER TBL INDEX USED-I RESULT TBL JOIN METHOD
========= ============ ========= ============ ========== ==========
ADMINI... TMP1
STATE TMP1 TMP2 NESTED LOOP
TMP2 PRESIDENT RESULT HASH JOIN
The execution plan shows that SQLBase processes this command in the
following sequence.
• The first row of the plan indicates that SQLBase processes the innermost
subquery first, since the table referenced is ADMINISTRATION.
(SELECT MIN(YEAR_INAUGURATED) FROM ADMINISTRATION
WHERE ADMINISTRATION.PRES_NAME = X.PRES_NAME)
TMP1
TMP2
This process uses a nested loop join.
• Finally, the outermost select joins TMP2 with the PRESIDENT table to get
the final query result, which is stored in the RESULT temporary table. This
process uses a hash join.
SELECT PRES_NAME FROM PRESIDENT X
WHERE STATE_BORN IN (TMP2);
RESULT
EXECUTION PLAN:
OUTER TBL INDEX USED-O INNER TBL INDEX USED-I RESULT TBL JOIN METHOD
========= ============ ========= ============ ========== ==========
SYSTABLES RESULT
EXECUTION PLAN:
PLANNO OUTER_TBL INNER_TBL RESULT_TBL COMMENT
========== ============ ========== ============ ==========
1 P TMP1 SQ:2
2 SP TMP3 UNION
4 P TMP4 SQ:5
5 SP TMP3 UNION
This setting is cursor specific. One cursor context can be preserved while others
are destroyed. The preserved context itself can be destroyed in the following
situations:
• A compile request is issued using the cursor.
• A DDL command is issued in the same transaction (which may or may
not be using another cursor) and the transaction is rolled back.
• An isolation level changes, even if you use another cursor to change the
isolation level.
• The transaction rolls back due to an error such as a deadlock.
Only the contexts of cursors with CCP on are maintained.
This feature can be on with or without restriction mode and result set mode.
You must have CONNECT authority to set this option.
The default setting is OFF.
If the result set was created by a SELECT command that contains DISTINCT,
GROUP BY, HAVING, UNION, ORDER BY, an aggregate function, or a
complex view, then SQLBase creates a virtual table. In these cases, rows in the
result set cannot be mapped to the rows in the database. If you UPDATE in this
situation and later fetch an UPDATEd row, the row will not reflect the UPDATE
even if PRESERVECONTEXT is ON.
PRINTLEVEL integer constant
This sets the level of detail for the messages on the process activity server display
(0-4).
The default is 0.
You must have DBA authority to set this option.
READONLY
If this is ON, the read only isolation level can be used. The read-only isolation
level gives a view of the data as it was when the transaction began. If this is ON,
a read-only history file is maintained that contains multiple copies of database
pages that are being modified.
This feature can be set in sql.ini or in a SET command. If specified in sql.ini, the
setting applies to all databases on the server. The SET READONLY command
changes the setting for the current database.
Read-only transactions may negatively affect performance, so they are disabled
by default.
If you give the command SET READONLY DEFAULT, the setting in sql.ini is
used; if not set in sql.ini, then the internal default is used.
You must have DBA authority to set this option.
The default is OFF.
READONLYDATABASE
If this is ON, the database is set to read-only.
If this is OFF, the database is read-write.
Once you set a database to read-only, no update statements are allowed, and log
files are disabled. You must be the only connected user to turn read-only on or
off.
When READONLYDATABASE is on, the Read-Only isolation level is disabled.
You must set tempdir (in sql.ini or autoexec.bat) to tell SQLBase where to store
temporary files. The temporary files are stored in a subdirectory of the directory
pointed to by tempdir. The name of the subdirectory is the same as the database
name.
You must have DBA authority to set this option.
The default setting is OFF.
RECOVERY
In most situations you should leave RECOVERY turned ON. However, when
RECOVERY is turned OFF, there is less file I/O (and a corresponding increase in
performance) and less disk space is used. Therefore, you may want to SET
RECOVERY OFF when loading large amounts of data.
You must have CONNECT authority to set this option.
When RECOVERY is OFF, transaction logging is not performed. Changes to the
database before a COMMIT cannot be rolled back if the transaction fails, and the
database will not be salvageable if the database is damaged by an user error,
media failure, or power failure. Often, your database will corrupt if you run SET
RECOVERY OFF and your application crashes.
For a multi-user database server, recovery can only be established by the first
user connecting to a database, and SET RECOVERY must be the first command
given in the SQLTalk session.
Since RECOVERY is a database-specific option, if that first user sets
RECOVERY ON or OFF, it stays that way for all other users who connect to the
same database. After RECOVERY is set OFF, all users who later try to connect
to the database will get a message saying that recovery is not being performed.
If you turn recovery OFF, the following SET options will be reset to their default
values:
• AUTOCOMMIT
• BULK EXECUTE
• PRESERVECONTEXT
• RESTRICTION
• ROLLBACK
• SCROLL
• ISOLATION
• LOADVERSION
• TIMEOUT
The default is ON.
RESTRICTION
If this is ON, each query is a subquery of the previous result set. Therefore, if you
are in restriction mode and your first query selects everyone living in California,
and a second query selects all people with brown eyes, the second query returns
only people who live in California and who have brown eyes. Input to each select
for the current SELECT is the output of the previous SELECT.
You can only turn on restriction mode after turning on scroll mode (SET
SCROLL ON). Note that restriction mode is not supported for procedures.
This setting is cursor specific.
You must have CONNECT authority to set this option.
The default is OFF.
RM integer constant
This sets the right margin of a report. The value can range from 0 to LINESIZE.
The default is 0.
There is no specific authority required to set this option.
ROLLBACK
If this is ON, the entire transaction is rolled back when there is a lock timeout. If
this is OFF, only the current command is rolled back when there is a lock
timeout.
This setting is cursor specific.
Note: If you do not want to use scrollable cursors, do not turn result set mode on. SQLBase
builds the result set for a procedure if result set mode is turned on; this can result in unnecessary
performance degradation.
TRACEFILE
If you are accessing a multi-user server, this option directs statement trace output
to a file on the server or to the server’s Process Activity screen. If you are
accessing a single-user engine, this option directs statement trace output to the
screen. This option is cursor specific.
If you have one or more TRACE statements embedded in a procedure and
statement tracing is enabled as well, the output of both traces is displayed on the
server’s Process Activity screen. Redirecting statement trace output to a file in
this situation can make it easier to read both traces.
Specify a file name and optionally, a path, to which to direct trace output. Specify
OFF to direct trace output to the server’s Process Activity screen.
Examples
COMMIT after each SQL command.
SET AUTOCOMMIT OFF;
Measure and display elapsed time.
SET ETIME ON;
Suppress default column headings.
SET HEADING OFF;
Change the isolation level to Read Only.
SET ISOLATION RO;
Return only one row after a SELECT.
SET LIMIT 1;
Set the line size to 75.
SET LINESIZE 75;
Wrap wide rows.
SET LINEWRAP ON;
When a NULL is encountered in a column, display 'NA'.
SET NULLS 'NA';
Do not pause for user confirmation of command execution.
SET PAUSE OFF;
See also
SHOW
SET SERVER
DBDIR
Clauses
server ID
The name of the SQLBase server. Database servers are named by the servername
keyword in sql.ini.
server password
If the server password is set (with the password keyword in sql.ini), a case
insensitive comparison is performed between the server password and the
specified password. If a server password has not been set in sql.ini, it does not
need to be specified.
DBDIR
This specifies the drives, paths, and directory names for the home database
directory or directories. If you execute a SET SERVER DBDIR command, it
changes the setting of the dbdir keyword in the sql.ini file.
OFF
A SET SERVER OFF command breaks the server connection.
Example
SET SERVER PROD/SECRET;
SERVER IS SET
...
SET SERVER OFF;
SERVER IS OFF
See also
BACKUP DATABASE
RESTORE DATABASE
SET RECOVERY
These commands are listed in the SQL Language Reference.
CREATE DATABASE
DEINSTALL DATABASE
DROP DATABASE
INSTALL DATABASE
SET SPOOL
This command records the SQLTalk session. A spool file records all screen activity
for the SQLTalk session. Spooling does not affect screen display. This file is
maintained on a per user session basis.
Spooling is turned off by the SET SPOOL OFF command or when you exit from the
SQLTalk session.
Clauses
file name
You can specify the name of the spool file or a default name will be assigned
when you specify ON. You can specify any file name, including a drive and path.
If you start SQLTalk with the NOCONNECT option, the only way that you can
turn on spooling is by executing a SET SPOOL command with a file name. SET
SPOOL ON does not work when you start SQLTalk with the NOCONNECT
option.
If you start spooling to the same file at a later session, you will be asked the
choice of appending to or writing over the existing file.
The default spool file name is:
current directory\database name.spl
If the spool file already exists, you are given a choice to append to the file,
overwrite the file, or abort the command.
Examples
SET SPOOL ON;
SET SPOOL OFF;
SET SPOOL MYFILE;
SHOW
SHOW options
cursor_number | ALL
CLOSETRANSMETHOD
CONNECT
LOG
REPORT
ROWCOUNT
SYSTEM
VERSION
Clauses
options
This is the name of one of the SET options. The current value of the specified
option is displayed. The SHOW command can also display its own options
settings, which are listed below.
cursor-number | ALL
This displays information associated with the specified cursor or all cursors in the
current database. It includes the connection handle associated with each cursor
and augments the information that you can obtain using the CONNECT option
described in this section or SHOW CONNECTION on page 2-97.
CLOSETRANSMETHOD
This displays whether a COMMIT or ROLLBACK is issued before closing a
connection handle or disconnecting a final cursor that was implicitly connected
or connected using the CONNECT command (which specifies the cursor number
along with the following clause options: databasename, username, and
password).
CONNECT
This displays information associated with the current database, including cursor
number, database name, and user name. The current database is that which was
established at sign-on or with the most recent CONNECT or USE command.
LOG
This displays the log parameter information.
REPORT
This displays the current report format options. These include the SET
commands (not all options are included, however), and the BREAK, BTITLE,
COMPUTE and TTITLE commands.
ROWCOUNT
This displays the number of rows in a result set. INSERTs into a result set
increase the ROWCOUNT. However, DELETEs, which show up as blanked-out
rows in result set mode, do not decrease the ROWCOUNT. The deleted rows
disappear on the next SELECT.
SYSTEM
This displays configuration information, such as the heap size and whether a
single-user or a multi-user system of SQLBase is being used.
VERSION
This displays the current release version of the server software.
Examples
Display the size of each display line.
SHOW LINESIZE;
Find out if all rows selected are being displayed.
SHOW LIMIT;
Display cursor, database and user information.
SHOW CONNECT;
Display the status of the activity log.
SHOW ACTIVITYLOG;
Display the status of the activity log timestamp.
SHOW TIMESTAMP;
See also
SET
See also
COLUMN
COMPUTE
SHOW REPORT
SHOW CONNECTION
SHOW CONNECTION
connection_name
Clauses
connection name
If desired, specify the name of the connection. If you omit the connection name,
connection information is displayed for the current cursor.
Example
The following example displays information on connection CH2:
SHOW CONNECTION CH2;
See also
BEGIN CONNECTION
SHOW DATABASES
SHOW DATABASES
LOCALLY
ON SERVER server id
Clauses
LOCALLY
This shows all databases available on the local computer.
ON SERVER
This displays the databases on the specified server. Database servers are named
by the servername keyword in sql.ini.
Example
SHOW DATABASES ON SERVER ACCTPAY;
See also
SET SERVER
SHUTDOWN
SHUTDOWN SERVER ON
OFF
EXIT
DISCONNECT
ON
DATABASE databasename
OFF
Note: Do not use the DISCONNECT command if you are not using transaction logging.
You can change the top title by entering another TTITLE command, or you can
temporarily turn off TTITLE by entering the OFF command. You can turn TTITLE
on again with the ON command.
Clauses
databasename
This specifies the database to connect to.
Example
This following example shuts down the server, disconnecting all active users:
SET SERVER dbname;
SHUTDOWN SERVER EXIT;
SET SERVER OFF;
STORE
Clauses
auth ID.
If you are not the creator of the command or procedure, specify the authorization
ID of the owner.
cmd/procedure name
The name of the command or procedure to store. If you specify a name that
already exists, SQLBase prompts you for confirmation to overwrite it.
cmd/procedure text
The text of the command or procedure to compile and store. You can include
bind variables in the command or procedure, but not input data. You supply input
data at execution time; data binding takes place when SQLBase executes the
command or procedure.
Example
This following example compiles and stores the command MYQUERY:
STORE myquery
SELECT * FROM EMP WHERE DEPTNO = :1;
The next example compiles and stores a command called ADDNAMES. The
EXECUTE command contains bind variables, so you must enter data.
STORE ADDNAMES INSERT INTO FRIENDS (NAME) VALUES (:1);
EXECUTE ADDNAMES
\
PROCESSING DATA
LEN
MARGE
BETTY
/
3 Rows Inserted
The following command stores a procedure.
STORE PRESPROC
Procedure PR_PRES
Local Variables
Sql Handle Cur1
Actions
Call SqlConnect (Cur1)
Call SqlStore (Cur1, 'presname', 'Select pres_name from \
sysadm.president')
Call SqlDisconnect (Cur1);
See also
ERASE
EXECUTE
TTITLE
OFF
This command displays a top title on each page of a report. Once you have entered
this command, the results of all subsequent SELECT commands are displayed with
the top title.
You can change the top title by entering another TTITLE command, or you can
temporarily turn off TTITLE by entering the OFF command. You can turn TTITLE
on again with the ON command.
Clauses
'header-string'
The header string must be enclosed within single quotes.
The string can consist of up to three separate substrings, each delimited by the
vertical bar ( | ) character. The | represents a new-line character that causes the
subsequent substring to be displayed on a new line.
The lines of the title are automatically centered. The display width of the page is
specified by the SET LINESIZE command.
DATE
If this is ON, the current date is displayed in the top left-hand corner of each page
of the report. The date is displayed in Mon dd, yyyy format (such as April 25,
1996). It is always displayed on the first line of the page, regardless of the
number of lines in the title.
PAGE
If this is ON, the current page number is displayed on the top right hand corner of
each page of the report. The display format is Page n (such as Page 11). It is
always displayed on the first line of the page.
Example
Shown below is a TTITLE command and the resulting title.
TTITLE 'EMPLOYEE LIST|as of December 1996'DATE
ON PAGE ON;
EMPLOYEE LIST
April 23, 1996 as of December 1996 Page 1
See also
BTITLE
SET LINESIZE
SHOW REPORT
UNDO
UNDO
This command is used in restriction mode to undo the current result set and return the
result set to the state it was in before the last SELECT.
Example
SET SCROLL ON;
SET RESTRICTION ON;
SELECT PRES_NAME, STATE_BORN, PARTY FROM
PRESIDENT WHERE STATE_BORN = 'VIRGINIA';
PRES_NAME STATE_BORN PARTY
============ ========== ==========
Washington G Virginia Federalist
Jefferson T Virginia Demo-Rep
Madison J Virginia Demo-Rep
Monroe J Virginia Demo-Rep
Harrison W H Virginia Whig
Tyler J Virginia Whig
Taylor Z Virginia Whig
Wilson W Virginia Democratic
8 ROWS SELECTED
8 ROWS SELECTED
See also
SET RESTRICTION
SET SCROLL
USE
This command establishes a new current cursor. You can use this command to switch
from one cursor to another in a multi-cursor transaction after a CONNECT has been
established for each cursor.
Once a CONNECT authorizes a cursor, you can switch to it later without further
authorization.
Clauses
cursor number
This indicates the cursor that will become the current cursor. You must have
previously established a connection to the specified cursor with the CONNECT
command.
Examples
You establish a connection to a second authorization ID, using cursor 2. After you
enter some commands using that cursor, cursor 1 is activated with the USE command.
CONNECT 2 TRUDY/X;
CURSOR 2 CONNECTED TO DEMO
CREATE TABLE X(A INT);
TABLE CREATED
INSERT INTO X VALUES (:1)
\
1
2
/
2 ROWS INSERTED
SELECT * FROM X;
A
===
1
2
2 ROWS SELECTED
USE 1;
SELECT * FROM X;
SELECT * FROM X
^
ERROR: TABLE HAS NOT BEEN CREATED
USE 2;
DROP TABLE X;
TABLE DROPPED
See also
CONNECT
Chapter 3
FILTERROW FOREIGN
FROM GET
GROUPCOMMIT GROUPCOMMITDELAY
HEADING HISFILESIZE
INDENT INMESSAGE
INSTALL ISOLATION
JOURNAL LABEL
LAST LEFT
LIMIT LINESIZE
LINESPACE LINEWRAP
LIST LM
LOADBUFFER LOADVERSION
LOCAL LOCALLY
LOG LOGBACKUP
LOGFILEPREALLOC LOGFILESIZE
LOGOFFSET LOGS
LONGINFERS LONGLENGTH
LONGOFFSET MAPERROR
MAX MIN
NEW NEWDB
NEWPAGE NEXTLOG
NO NODE
NOPREBUILD NULLS
OF OFF
ON OPTIMIZEDBULK
OPTIMIZEFIRSTFETCH OUTMESSAGE
OPTIMIZERLEVEL PAGE
OVER PARTITIONS
PAGESIZE PERFORM
PAUSE PLANONLY
PICTURE PRESERVECONTEXT
PREPARE PRINTLEVEL
PRINT READONLY
PUT RECOVERY
READONLYDATABASE RELEASE
REFINTCHECK REORGANIZE
REMARK RESTORE
REPORT RETRIEVE
RESTRICTION RM
RIGHT ROLLFORWARD
ROLLBACK ROWCOUNT
ROWID RUN
SAVE SCHEMA
SCREEN SCROLL
SCROLLROW SELECTLISTNAME
SERVER SET
SHOW SNAPSHOT
SORTSPACE SPACE
SPANLIMIT SPOOL
SQL SQLBASE
SQLGET SQLGSI
SQLSAB SQLSCL
SQLSET STOGROUP
STORE SUBTITLE
SUM SYSTEM
TCOUNT TIME
TIMEOUT TIMEPICTURE
TIMESTAMP TM
TO TPONE
TTITLE TRACE
TRACEFILE UNDO
USE VERSION
WIDTH WKS
WORK WRAP
Glossary
access path—The path used to get the data specified in a SQL command. An access
path can involve an index or a sequential search (table scan), or a combination of
the two. Alternate paths are judged based on the efficiency of locating the data.
aggregate function—A SQL operation that produces a summary value from a set of
values.
alias—An alternative name used to identify a database object.
API (application programming interface)—A set of functions that a program uses to
access a database.
application—A program written by or for a user that applies to the user's work. A
program or set of programs that perform a task. For example, a payroll system.
argument—A value entered in a command that defines the data to operate on or that
controls execution. Also called parameter or operand.
arithmetic expression—An expression that contains operations and arguments that
can be reduced to a single numeric value.
arithmetic operator—A symbol used to represent an arithmetic operation, such as the
plus sign (+) or the minus sign (-).
attribute—A characteristic or property. For example, the data type or length of a row.
Sometimes, attribute is used as a synonym for column or field.
audit file—A log file that records output from an audit operation.
audit message—A message string that you can include in an audit file
audit operation—A SQLBase operation that logs database activities and
performance, writing output to an audit file. For example, you can monitor who
logs on to a database and what tables they access, or record command execution
time.
authorization—The right granted to a user to access a database.
data type—Any of the standard forms of data that SQLBase can store and
manipulate. An attribute that specifies the representation for a column in a table.
Examples of data types in SQLBase are CHAR (or VARCHAR), LONG
VARCHAR (or LONG), NUMBER, DECIMAL (or DEC), INTEGER (or INT),
SMALLINT, DOUBLE PRECISION, FLOAT, REAL, DATETIME (or
TIMESTAMP), DATE, TIME.
database—A collection of interrelated or independent pieces of information stored
together without unnecessary redundancy. A database can be accessed and
operated upon by client applications such as SQLTalk.
database administrator (DBA)—A person responsible for the design, planning,
installation, configuration, control, management, maintenance, and operation of
a DBMS and its supporting network. A DBA ensures successful use of the
DBMS by users.
A DBA is authorized to grant and revoke other users’ access to a database, modify
database options that affect all users, and perform other administrative functions.
database area—A database area corresponds to a file. These areas can be spread
across multiple disk volumes to take advantage of parallel disk input/output
operations.
database management system (DBMS)—A software system that manages the
creation, organization, and modification of a database and access to data stored
within it. A DBMS provides centralized control, data independence, and
complex physical structures for efficient access, integrity, recovery, concurrency,
and security.
database object—A table, view, index, synonym or other object created and
manipulated through SQL.
database server—A DBMS that a user interacts with through a client application on
the same or a different computer. Also called back-end or engine.
DATE—A column data type in SQL that represents a date value as a three-part value
(day, month, and year).
date/time value—A value of the data type DATE, TIME, or TIMESTAMP.
DCL (Data Control Language)—SQL commands that assign database access
privileges and security such as GRANT and REVOKE.
DDL (Data Definition Language)—SQL commands that create and define database
objects such as CREATE TABLE, ALTER TABLE, and DROP TABLE.
duplicates—An option used when creating an index for a table that specifies whether
duplicate values are allowed for a key.
embedded SQL—SQL commands that are embedded within a program, and are
prepared during precompilation and compilation before the program is executed.
After a SQL command is prepared, the command itself does not change
(although values of host variables specified within the command can change).
Also called static SQL.
engine—See database server.
entity—A person, place, or thing represented by a table. In a table, each row
represents an entity.
equijoin—A join where columns are compared on the basis of equality, and all the
columns in the tables being joined are included in the results.
Ethernet—A LAN with a bus topology (a single cable not connected at the ends).
When a computer wants to transmit, it first checks to see if another computer is
transmitting. After a computer transmits, it can detect if a collision has happened.
Ethernet is a broadcast network and all computers on the network hear all
transmissions. A computer selects only those transmissions addressed to it.
exclusive lock (X-lock)—An exclusive lock allows only one user to have a lock on a
page at a time. An exclusive lock prevents another user from acquiring a lock
until the exclusive lock is released. Exclusive locks are placed when a page is to
be modified (such as for an UPDATE, INSERT, or DELETE).
An exclusive lock differs from a shared lock because it does not permit another
user to place any type of lock on the same data.
expression—An item or a combination of items and operators that yield a single
value. Examples are column names which yield the value of the column in
successive rows, arithmetic expressions built with operators such as + or - that
yield the result of performing the operation, and functions which yield the value
of the function for its argument.
extent page—A database page used when a row is INSERTed that is longer than a
page or when a row is UPDATEd and there is not enough space in the original
page to hold the data.
external function—A user-defined function that resides in an "external" DLL
(Dynamic Link Library) invoked within a SQLBase stored procedure.
event—See timer event.
field—See column.
file server—A computer that allows network users to store and share information.
key—A column or a set of columns in an index used to identify a row. A key value
can be used to locate a row.
keyword—One of the predefined words in a command language.
local area network (LAN)—A collection of connected computers that share data and
resources, and access other networks or remote hosts. Usually, a LAN is
geographically confined and microcomputer-based.
lock—To temporarily restrict other users access to data to maintain consistency.
Locking prevents data from being modified by more than one user at a time and
prevents data from being read while being updated. A lock serializes access to
data and prevents simultaneous updates that might result in inconsistent data. See
shared lock (S-lock) and exclusive lock (X-lock).
logical operator—A symbol for a logical operation that connects expressions in a
WHERE or HAVING clause. Examples are AND, OR, and NOT. An expression
formed with logical operators evaluates to either TRUE or FALSE. Logical
operators define or limit the information sought. Also called Boolean operator.
LONG VARCHAR—In SQL, a column data type where the value can be longer than
254 bytes. The user does not specify a length. SQLBase stores LONG
VARCHAR columns as variable-length strings. Also called LONG.
mathematical function—An operation such as finding the average, minimum, or
maximum value of a set of values.
media recovery—Restoring data from backup after events such as a disk head crash,
operating system crash, or a user accidentally dropping a database object.
message buffer—The input message buffer is allocated on both the client computer
and the database server. The database server builds an input message in this
buffer on the database server and sends it across the network to a buffer on the
client. It is called an input message buffer because it is input from the client’s
point of view.
The out put message buffer is allocated on both the client computer and on the
database server. The client builds an output message in this buffer and sends it to
a buffer on the database server. It is called an output message buffer because it is
output from the client’s point of view.
modulo—An arithmetic operator that returns an integer remainder after a division
operation on two integers.
multi-user—The ability of a computer system to provide its services to more than
one user at a time.
outer join—A join in which both matching and non-matching rows are returned.
Each preserved row is joined to an imaginary row in the other table in which all
the fields are null.
outer query—When a query is nested within another query, the main query is called
the outer query and the inner query is called the subquery. An outer query is
executed once for each row selected by the subquery. A subquery cannot be
evaluated independently but that depends on the outer query for its results. Also
see subquery.
page—The physical unit of disk storage that SQLBase uses to allocate space to tables
and indexes.
parent table—The table containing the primary key.
parse—To examine a command to make sure that it is properly formed and that all
necessary information is supplied.
partitioning—A method of setting up separate user areas to maximize disk space.
Databases can be stretched across several different network partitions.
password—A sequence of characters that must be entered to connect to a database.
Associated to each password is an authorization-id.
picture—A string of characters used to format data for display.
precedence—The default order in which operations are performed in an expression.
precision—The maximum number of digits in a column.
precompilation—Processing of a program containing SQL commands or procedures
that takes place before compilation. SQL commands are replaced with
statements that are recognized by the host language compiler. Output from
precompilation includes source code that can be submitted to the compiler.
predicate—An element in a search condition that expresses a comparison operation
that states a set of criteria for the data to be returned by a query.
primary key—The columns or set of columns that are used to uniquely identify each
row in a table. All values for a key are unique and non-null.
privilege—A capability given to a user to perform an action.
procedure—A named set of SAL or SQL statements that can contain flow control
language. You compile a procedure for immediate and/or later execution.
query—A request for information from a database, optionally based on specific
conditions. For example, a request to list all customers whose balance is greater
than $1000. Queries are issued with the SELECT command.
restriction mode—In restriction mode, the result set of one query is the basis for the
next query. Each query further restricts the result set. This continues for each
subsequent query.
result set mode—Normally, result table rows are displayed and scrolled off the
screen. In result set mode, the rows of the result table are available for
subsequent scrolling and retrieval.
result table—The set of rows retrieved from one or more tables or views during a
query. A cursor allows the rows to be retrieved one by one.
revoke—The act of withdrawing a user's permission to access a database.
rollback—To restore a database to the condition it was in at its last COMMIT. A
ROLLBACK cancels a transaction and undoes any changes that it made to the
database. All locks are freed unless cursor-context preservation is on.
rollforward—Reapplying changes to a database. The transaction log contains the
entries used for rollforward.
router—A client application talks to a SQLBase server through a router program.
The router enables a logical connection between a client and the server. Once this
connection is established on the LAN, the client application uses the router
program to send SQL requests to the server and to receive the results.
row—A set of related columns that describe a specific entity. For example, a row
could contain a name, address, telephone number. Sometimes called record or
tuple.
ROWID—A hidden column associated with each row in a SQLBase table that is an
internal identifier for the row. The ROWID can be retrieved like any other
column.
ROWID validation—A programming technique that ensures that a given row that
was SELECTed has not been changed or deleted by another user during a
session. When a row is updated, the ROWID is changed.
SAP (Service Advertisement Protocol)—A NetWare protocol that resources (such as
database servers) use to publicize their services and addresses on a network.
savepoint—An intermediate point within a transaction to which a user can later
ROLLBACK to cancel any subsequent commands, or COMMIT to complete the
commands.
scale—The number of digits to the right of the decimal point in a number.
search condition—A criterion for selecting rows from a table. A search condition
appears in a WHERE clause and contains one or more predicates.
username—See authorization-id.
value—Data assigned to a column, a constant, a variable, or an argument.
VARCHAR—See CHAR.
variable—A data item that can assume any of a given set of values.
view—A logical representation of data from one or more base tables. A view can
include some or all of the columns in the table or tables on which it is defined. A
view represents a portion of data generated by a query. A view is derived from a
base table or base tables but has no storage of its own. Data for a view can be
updated in the same manner as for a base table. Sometimes called a virtual table.
wildcard—Characters used in the LIKE predicate that can stand for any one character
(the underscore _) or any number of characters (the percent sign %) in pattern-
matching.
Windows—A graphical user interface from Microsoft that runs under DOS.
With Windows, commands are organized in lists called menus. Icons (small
pictures) on the screen represent applications. A user selects a menu item or an
icon by pointing to it with a mouse and clicking.
Applications run in windows that can be resized and relocated. A user can run
two or more applications at the same time and can switch between them. A user
can run multiple copies of the same application at the same time.
write-ahead log (WAL)—A transaction logging technique where transactions are
recorded in a disk-based log before they are recorded in the physical database.
This ensures that active transactions can be rolled back if there is a system crash.
Symbols B
$DATA backslash continuation character ( ) 1-11
RUN 2-56 BACKUP 1-3, 2-2, 2-5
DATABASE 2-6
A FROM database 2-7
access path 2-42 LOGS 2-6
ACTIVITYLOG ON CLIENT 2-8
(reserved word) 3-2 ON SERVER 2-8
ADJUST reserved word 3-2
(reserved word) 3-2 SNAPSHOT 2-7
COLUMN 2-19 TO 2-7
adjust default setting 2-19 BACKWARD
ADJUSTING 1-15 reserved word 3-2
ALIAS BAT (batch option) 1-11
(reserved word) 3-2 BEGEIN
COLUMN 2-15 reserved word 3-2
ALL BEGIN CONNECTION 1-3, 2-2, 2-8
(reserved word) 3-2 command 2-8
ALTER BELL
(reserved word) 3-2 reserved word 3-2
ALTER COMMAND 2-2, 2-4, 2-100 SET 2-62
ALTER DATABASE 1-5 bind
ALTER DBAREA 1-5 data
ALTER EXTERNAL FUNCTION 1-5 procedure 2-41
ALTER PASSWORD 1-5 variables 2-41
ALTER STOGROUP 1-5 bind variable 1-19
ALTER TABLE 1-5 examples 1-20
ALTER TABLE (error messages) 1-5 BM
ALTER TABLE (referential integrity) 1-5 reserved word 3-2
ALTER TRIGGER 1-5 SET 2-63
AM 2-18 BRAND
APPLY reserved word 3-2
(reserved word) 3-2 BREAK 1-3, 2-2, 2-10
ASCII column 2-11
(reserved word) 3-2 ON/OFF 2-10
AUDIT MESSAGE 1-5 REPORT 2-11
auth ID/pwd reserved word 3-2
CONNECT 2-27 BTITLE 1-3, 2-2, 2-12
AUTOCOMMIT DATE 2-12
reserved word 3-2 footer string 2-12
SET 2-62 PAGE 2-13
AUTORECOMPILE 2-2, 2-4 reserved word 3-2
AVG BULK
COMPUTE 2-21, 2-23 reserved word 3-2
reserved word 3-2 SET 2-63
C Prepare 2-41
CACHE repeat 1-10
reserved word 3-2 RUN 2-56
case sensitivity 1-10 stored
CENTER execute 2-34
reserved word 3-2 owner 2-100
character adjust setting 2-19 restriction mode 2-34, 2-50
character string result sets 2-34
with bind variable 1-20 terminating connection to database 2-32
CHECK command categories 1-2
reserved word 3-2 command files 1-4
CHECK DATABASE 1-5 database administration 1-3
CHECK INDEX 1-5 for storing commands/procedures 1-3
CHECK TABLE 1-5 precompiled commands 1-4
CHECKPOINT report writing 1-3
reserved word 3-2 session control 1-3
SET 2-63 command file
CLIENT PRINT 2-43
reserved word 3-2 SQL 2-60
CLOSETRANSMETHOD command files commands 1-4
reserved word 3-2 commands
SET 2-63 stored 1-19
COLUMN 1-3, 2-2, 2-14 COMMANDSIZE
ADJUST 2-19 reserved word 3-2
ALIAS 2-15 COMMENT 2-80
column name 2-15 COMMENT ON 1-5
date/time picture 2-17 COMMIT 1-5
DUP 2-20 connection handles 2-63
HEADING 2-15 reserved word 3-2
NEWPAGE 2-20 compile
NULLS 2-19 command 2-41
numeric picture 2-16 procedure 2-41, 2-100
PICTURE 2-16 SQL command 2-100
picture character 2-16, 2-18 COMPRESSION
PRINT 2-20 reserved word 3-2
reserved word 3-2 COMPUTE 1-3, 2-2, 2-21
SUBTITLE 2-20 AVG 2-21, 2-23
WIDTH 2-15 break list 2-23
WRAP 2-20 COUNT 2-22, 2-23
column MAX 2-22
BREAK 2-11 MIN 2-21, 2-22
column ID OFF 2-22
COLUMN 2-15 reserved word 3-2
COMPUTE 2-23 SUM 2-21, 2-22
command CONNECT 1-3, 1-16, 2-2, 2-25
compile 2-41 auth ID 2-27
connecting to database 2-8 cursor 2-26
parse 2-41 database 2-26
U
UNDO 1-4, 1-16, 2-3, 2-103
reserved word 3-4