BSQL can be run from a batch job or from a terminal. Operation from a terminal can be used to execute statements entered directly or written in sequential files.
It is only possible to specify up to 80 characters on the command line in BSQL. Input lines taken from a sequential file can be longer than 80 characters.
About Complex SQL Statements - @
Use the @ character to delimit a complex SQL statement where the normal end-of-statement character ';' appears before the end of the statement (e.g. CREATE FUNCTION, CREATE PROCEDURE, and CREATE TRIGGER).
It is also useful to use @ in conjunction with large statements, e.g. CREATE SCHEMA, in which case the error reporting in BSQL will give more information about where the error occurred.
The use of @ cannot be used for grouping a number of simple SQL statements so that they execute as one single statement, but it is provided to give the SQL interpreter advance warning that a complex SQL statement appears between the @ characters which contains end-of-statement markers occurring before the true end of construct.
Running BSQL from a Batch Job
To run BSQL unattended from a batch job, create a batch file with the following contents:
- the command to start BSQL
- the user name
- the password
- the SQL statements and BSQL commands
- the EXIT command (or end of file).
Windows Example of a Batch File
The following is an example of the contents of a BAT file you could schedule to run on your Windows system:(echo your_name & echo your_password & echo read 'SomeFile.sql'; & echo exit;) | "c:\Program Files\MIMER91 NT\BSQL.exe" -m %your_DB_name%
The user name to log on with. The user password to log on with. The name of the file containing input or SQL commands. Runs BSQL in multi user mode. The alternative is -s for single user mode. The name of the database to work on.
Security and Batch Jobs
For unattended operation, a batch file must either include the Mimer SQL ident user name and password in explicit form or connect as OS_USER.
For security reasons, make sure that your batch files are well protected and/or remove your password from the file after execution.
Alternatively, SQL statements and BSQL commands may be written in a sequential file without user name and password, and executed with the READ command from a BSQL terminal session.
Running BSQL via a Terminal
How you start BSQL depends on your operating system.
BSQL Command-line Arguments
Connects to the database in multi-user mode. Connects to the database in single-user mode. Specifies the name of the database to access.
If a database name is not specified, the default database will be accessed.
If neither -s nor -m is specified for the optional mode flag, the way the database is accessed will be determined by the setting of the MIMER_MODE variable, see the Mimer SQL System Management Handbook.
If this is not set, it will be accessed in multi-user mode.
Running BSQL in UNIX
To start BSQL in UNIX, enter:bsql [-m | -s] [database_name]
Running BSQL in OpenVMS
To start BSQL in OpenVMS, enter:bsql [/MULTI | /SINGLE] [database_name]
Note: You can also use the UNIX-style syntax in OpenVMS.
Running BSQL in Windows
To start BSQL in a Windows command prompt window, enter:bsql [-m | -s] [database_name]
To start Mimer SQL from the Windows Start button:
Click Start, navigate to your Mimer SQL program group and select Batch SQL.
Starting BSQL displays the following screen:$ bsql MMMMM MMMMM MMMMM MMMMM MMMMM MMMMMMMMMM MMMMMMMM MMMMMM MMMMMM MMMMM MMMMMM MMMMMM MMMMMMMMMM MMMMMMMMM MMMMMM MMMMMM MMM MMMMMM MMMMMM MMM MMM MMM MMM MMMMMMMMMMMMM MMM MMMMMMMMMMMMM MMMMM MMMMMMM MMM MMMMM MMM MMM MMM MMMMM MMM MMM MMM MMM MMM MMMM MMM MMMM MMMMM MMMM MMM MMMM MMMMMMMMMM MMMM MMMM MMMM M MMMM MMMMM MMMM M MMMM MMMMMMMMMM MMMM MMMM (C) Copyright Upright Database Technology AB. All rights reserved. M I M E R / B S Q L Version 8.3.0 Username:
After you have entered a user name and correct password, the BSQL prompt is displayed:SQL>
You can now enter BSQL commands and SQL statements. Output will be echoed on the terminal.
BSQL Command Line Editing - UNIX
Command line editing is available in the BSQL program, which uses a line-oriented interface.
The following functions are available:
Move to beginning of command Move backwards in command Delete current character Move to end of command Move forwards in command Delete previous character Delete after current position in command Next command Execute retrieved command and get next from history list Previous command Retrieve command by search condition Change place for the previous two characters Delete command Delete before current position in command Set mark in command (or 'esc <space>') Go to mark set by 'ctrl <space>' Show the history list Retrieve command by history list number Delete previous word Delete next word Move to previous word Move to next word
You can use the arrow keys for command retrieval and for positioning the cursor within a line, i.e. the same function as for ctrl-b, ctrl-f, ctrl-n and ctrl-p.
To change the number of commands that can be held in the history list, the environment variable MIMER_HISTLINES can be used (the default is 23).
Note: The operating system may have control sequences set for the terminal that, if they overlap, override those described above. The terminal settings can be listed using the UNIX stty -a command.
Upright Database Technology AB
Voice: +46 18 780 92 00
Fax: +46 18 780 92 40