|
SQL | Control Commands |
CALL [database.] [family.] member [(parameter, ...)]
CALL
executes a
procedure from a SIR/XS procedure file.
The procedure file must be connected.
A procedure (or member) may be edited, amended and added to the procedure file
from the SQL menus.A procedure that is called in SQL should only contain SQL commands.
Procedures can be created which have parameters to specify particular conditions. Parameters are positional; that is, the stored procedure references parameters by number and these numbers are assigned in the order they are specified. A procedure parameter can be any sequence of text. Parameters are enclosed in parentheses and separated by commas. Null parameters are specified by a comma immediately following the previous comma.
REP1
:SELECT ID NAME <1> <2> FROM EMPLOYEE <3>Call this procedure with:
CALL REP1 ( SALARY , GENDER , WHERE ( SALARY GT 2250 ) )which results in the full command:
SELECT ID NAME SALARY GENDER FROM EMPLOYEE - WHERE ( SALARY GT 2250 )
CONNECT DATABASE database_name [ PASSWORD database_password ] [ PREFIX 'file_prefix' ] [ SECURITY read_security,write_security ] [ SUPPRESS PATH ] [ SUPPRESS QPROFILE]Abbreviation:
CON DB
Connects the named database. Supply the appropriate password and security
passwords. If the database is not in the default
directory, supply a prefix. Enclose the prefix in single quotes.
This database is made the default database. If
other databases are connected, the SET DATABASE
command
alters the default. When using multiple databases, prefix non-unique record
names with the database name. For example, in a database called
COMPANY
with a record named EMPLOYEE
:
SELECT .... FROM COMPANY.EMPLOYEE
PASSWORD
PW
PREFIX
P
PREFIX 'C:\MYFILES\'
SUPPRESS PATH
CLEAR PATH
command. Disconnect and reconnect without
suppressing paths to generate the paths.SUPPRESS QPROFILE
SYSTEM.QPROFILE
.
When a database is connected, SQL automatically executes this procedure
on that database. The procedure can contain any SQL commands
executed each time this database is connected. If the procedure
does not exist, no member is executed.SECURITY
CONNECT DATABASE ...... SECURITY HIGH,HIGH
CONNECT TABFILE name [ AUTO | READ | WRITE ] [ FILENAME filename ] [ IDENT BY grpname/grppass.username/userpass ]Abbreviation:
CON TF
Connects the named, existing tabfile. The name used must be the name specified when the tabfile was created. This is an internal name and is independent of, and unaffected by, the operating system filename. All references to the tabfile are by this name. Tabfiles with the same name cannot be connected at the same time.
SELECT
, is executed. This locks the
tabfile for exclusive write for the minimum period of time.
AUTO
is the default. Specify WRITE
for
exclusive updating or READ
if only doing queries.READ
DISCONNECT
ed.
WRITE
DISCONNECT
ed.
FILENAME
IDENT BY
CREATE ATTRIBUTE name FILENAME 'external filename'Abbreviation:
CRE ATTRIB
Associates an SQL internal name with an operating system filename specified in quotes. The SQL name can be used in subsequent commands wherever you need to specify a filename.
CREATE SYNONYM name textAbbreviation :
CRE SYN
Creates a synonym. A synonym is a text replacement mechanism, typically used for
long, repeated sets of names. Create the synonym and then use it wherever
applicable. A synonym can be used at any point in any SQL command.Do not enclose the text in quotes. The synonym name is a standard SQL name up to 32 characters. Do not use reserved words as synonym names.
CREATE SYNONYM MYSELECT SELECT ID NAME SALARY FROM EMPLOYEE
DISCONNECT DATABASE database_name DISCONNECT TABFILE tablefile_nameAbbreviation:
DISCON DB, DIS DB, DISCON TF, DIS TF
Disconnects a database or tabfile. The database or tabfile is closed and all
schema information is released.
DROP ATTRIB attribute_name DROP INDEX index_name DROP JOURNAL file_name DROP PATH path_name DROP SYNONYM synonym_name DROP TABFILE tabfile_name DROP TABLE table_name DROP VIEW view_nameDeletes the named entity. The entity no longer exists and must be re-created if required again.
END [ CLEAR | SAVE [ workspace_filename ] ] Synonyms: BYE, EXIT, QUIT, STOP, .Terminates the SQL session from SQL.
If the workspace has been modified, you are prompted to
save it. It will be saved as the default workspace file which is either the
workspace file that has been restored (with a GET
, the workspace file most recently saved or
the default SirSQL.wsp
. If the file is new, you are prompted for a password.
If you specify a password, a user must specify the password when restoring the workspace.
If you do not specify a password, you will not be prompted for it again.
GET [ filename ] [ PASSWORD password ]Restores a workspace from the specified file name. When starting an SQL session, the default workspace (SirSQL.wsp) is loaded unless the
WORK
=
execution parameter is specified.
Use GET
to load a previously saved workspace. The default
workspace (set by SET WORK
name), is loaded if a name is not
specified on the GET
command.
Specify the keyword PASSWORD
and the required password if one
is needed. If the password is not specified and one is required, you are
prompted for it.
SAVE
SAVE workspace_filename [ PASSWORD workspace_password ]
SAVE
saves the current workspace on the specified file. If
the file name is omitted, the workspace is saved on the default workspace file.
The default for this is SirSQL.wsp.
Batch Mode
ABORT BA IN = filename OUT = filenameUse these to run SQL in batch mode.
ABORT
ABORT
is not specified, processing continues after an error.
Specify ABORT
if commands in the input file depend on the
results of an earlier command.BA
IN
parameter.IN
SELECT
does not
automatically cause a display. To display the output, include a
DISPLAY
statement and an END
command.OUT
sirsql.fmt
. This is
a machine readable file produced by a batch run of SQL. This reads a text input file of messages and either
creates a new format file or adds messages to a pre-existing file. This facility might be used to produce
messages in a different language. Please contact SIR support if you require this facility.
PREPARE FMT = format filename (output) IN = input format text filename OUT = output filename (messages)
PREPARE
FMT
IN
OUT
DB = database P = 'prefix' PW = password RS = password WS = password EX = membername SUPQSpecify the following parameters to connect a default database.
DB
P
P='C:\MYFILES\'
PW
RS
WS
EX
SYSTEM
. If this member does
not exist, no member is executed. If this is not specified, the member
QPROFILE
(if it exists) is executed.SUPQ
QPROFILE
is not executed when the
database is connected.TBL (or TFL) = name TBFN (or TFFN) = filename GRP = name GPW = password USER = name UPW = passwordSpecify the following parameters to connect a default tabfile.
TFL
TBFN
TBL
parameter. If this is not specified, the filename is
assumed to be the same as the tabfile name plus a prefix of .tbf
.GRP
GPW
USER
UPW
CENY = nnnn WORK = workspace WORKPW = passwordSpecify the following parameters as necessary to alter the default environment settings:
CENY
[NO]WORK
Specifies the name of the workspace file automatically loaded when SQL starts.
If a workspace is not specified on
the execution parameter, if
SirSQL.wsp
exists, it is automatically
loaded unless NOWORK
is specified. For example:
SQL/WORK='SQLMYWS.wsp'
WORKPW
Specifies the password for the workspace