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
The '@' character should be used 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, 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:
- command to start BSQL
- user name
- SQL statements and BSQL commands
- EXIT command (or end of file)
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:
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.
Installing the Example Database
If, during the Mimer SQL installation, you chose to install the development and sample files, you have access to the script crehotdb.sql.
When run, the script creates a sample Mimer SQL environment containing databank files owned by the HOTELADM. The examples used in this manual are based on this environment.
To run the script, perform the following steps:
- Start BSQL.
- Log on as SYSADM.
- At the SQL-prompt, enter the command: READ 'crehotdb.sql';
- Exit from BSQL by entering: EXIT;
- To access the tables, logon with user name: HOTELADM and password: HOTELADM.
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