|
|
BSQL Commands
Command
Function
CLOSE Closes active log files, see CLOSE. DESCRIBE Describes a specified object, see DESCRIBE. EXIT Leaves BSQL, see EXIT. LIST Lists information on a specified object, see LIST. LOG Logs input, output or both on a sequential file, see LOG. READ INPUT Reads commands from a sequential file, see READ INPUT. SET ECHO Specifies whether lines are echoed to the terminal during READ INPUT, see SET ECHO. SET LINECOUNT Sets the terminal page size, see SET LINECOUNT. SET LINESPACE Sets the number of blank lines between each output record, see SET LINESPACE. SET LINEWIDTH Sets the terminal page width, see SET LINEWIDTH. SET LOG Stops or resumes logging input, output or both, see SET LOG. SET MAX_BINARY_LENGTH Specifies the maximum display length for binary columns, see SET MAX_BINARY_LENGTH. SET MAX_CHARACTER_LENGTH Specifies the maximum display length for character columns, see SET MAX_CHARACTER_LENGTH. SET MESSAGE Specifies whether messages are displayed on the terminal, see SET MESSAGE. SET OUTPUT Specifies whether output should be written to the terminal, see SET OUTPUT. SET PAGELENGTH Defines the page length of output file, see SET PAGELENGTH. SET PAGEWIDTH Defines the page width of output file, see SET PAGEWIDTH. SHOW SETTINGS Displays current values of all set options, SHOW SETTINGS. TRANSACTIONS Displays the menu for administrating distributed transactions, see TRANSACTIONS. WHENEVER Sets action to be taken in response to an error or warning, see WHENEVER.BSQL commands are not case sensitive.
About BSQL Syntax Descriptions
For information on how to read the syntax diagrams that follow, please refer to Mimer SQL Reference Manual, Chapter 2, Reading SQL Syntax Diagrams.
CLOSE
Syntax
Description
The command closes the specified log file. If no log file is specified, all active log files are closed.
DESCRIBE
Syntax
Description
The DESCRIBE command presents the following menu:
Menu for describe 1. Databank 6. Table 11. Trigger 2. Domain 7. View 12. Sequence 3. Ident 8. Module 13. Schema 4. Index 9. Procedure 14. Shadow 5. Synonym 10. Function 0. ExitChoosing an item presents a submenu for choosing between different DESCRIBE functions - see the table that follows for details.
Entering an exclamation mark (!) in the Select field returns to the previous menu level. Entering a double exclamation mark (!!) terminates the DESCRIBE session.
Specifying an object type and name in the command executes the first menu choice for that object. If no object name is given, the user is prompted for a name.
Selection numbers can be provided in a batch file for unattended operation. However, DESCRIBE is most useful in interactive mode from a terminal.
DESCRIBE DATABANK Options
DESCRIBE IDENT Options
DESCRIBE INDEX Options
DESCRIBE INDEXResult
BRIEF Lists the following information on the specified index:table name and columns on which the index is defined
sort order
uniqueness
comment
creation date.DESCRIBE SYNONYM Options
DESCRIBE SYNONYMResult
BRIEF Lists the following information on the specified synonym:schema and name of referenced table/view
comment
creation dateDESCRIBE TABLE Options
DESCRIBE VIEW Options
DESCRIBE VIEWResult
BRIEF Lists the following information on the specified view:view definition
comment
creation date.DESCRIBE MODULE Options
DESCRIBE MODULEResult
BRIEF List the following information on the specified module:module definition
comment
creation date.DESCRIBE PROCEDURE Options
DESCRIBE FUNCTION Options
DESCRIBE TRIGGER Options
DESCRIBE SEQUENCE Options
DESCRIBE SCHEMA Options
DESCRIBE SCHEMAResult
BRIEF List the following information about the specified schema:schema owner
contained objects
comment
creation date.DESCRIBE SHADOW
DESCRIBE SHADOWResult
BRIEF List the following information on the specified shadow:shadow creator
databank name
file nameEXIT
Syntax
Description
LIST
Lists information on a specified object.
Syntax
Description
The LIST command presents the following menu:
Menu for List 1. Databanks 6. Synonyms 11. Functions 2. Domains 7. Tables 12. Triggers 3. Idents 8. Views 13. Sequences 4. Indexes 9. Modules 14. Schemata 5. Objects 10. Procedures 15. Shadows 0. ExitChoosing an item presents a submenu for choosing between different LIST functions - see the table that follows for details.
Entering an exclamation mark (!) in the Select field returns to the previous menu level. Entering a double exclamation mark (!!) returns two levels.
Giving an object type in the command executes the first menu choice for that type.
Selection numbers can be provided in a batch file for unattended operation. However, LIST is most useful in interactive mode from a terminal.
LIST DATABANK Options
LIST DATABANKResult
ALL Lists all databanks in the database. CREATED BY Lists databanks created by a specified ident. ALL SHADOWS Lists all shadows in the database.LIST DOMAINS Options
LIST DOMAINSResult
ALL Lists all domains in the database. CREATED BY Lists domains created by a specified ident.LIST IDENTS Options
LIST IDENTSResult
ALL Lists all idents in the database. CREATED BY Lists idents created by a specified ident.LIST INDEXES Options
LIST INDEXESResult
ALL Lists the secondary indexes in the database. CREATED BY Lists secondary indexes created by a specified ident.LIST OBJECTS Options
LIST OBJECTSResult
ALL Lists objects in the database. CREATED BY Lists objects created by a specified ident. BY TYPE Lists objects of a specified type.LIST SYNONYMS Options
LIST SYNONYMSResult
ALL Lists synonyms in the database. CREATED BY Lists synonyms created by a specified ident.LIST TABLES Options
LIST TABLESResult
ALL Lists tables in the database. CREATED BY Lists tables created by a specified ident.LIST VIEWS Options
LIST VIEWSResult
ALL Lists views in the database. BY CREATOR Lists views created by a specified ident.LIST MODULES Options
LIST MODULESResult
ALL Lists all the modules in the database that are visible to (i.e. created by) the current ident.LIST PROCEDURES Options
LIST PROCEDURESResult
ALL Lists all the procedures the current ident has execute privilege on. CREATED BY Lists procedures created by the specified ident.LIST FUNCTIONS Options
LIST FUNCTIONSResult
ALL Lists all the functions the current ident has execute privilege on. CREATED BY Lists functions created by the specified ident.LIST TRIGGER Options
LIST TRIGGERResult
ALL List triggers defined on tables accessible to current user. CREATED BY Lists triggers created by the specified ident.LIST SEQUENCES Options
LIST SEQUENCESResult
ALL Lists all the sequences the current ident has usage privilege on. CREATED BY Lists sequences created by the specified ident.LIST SCHEMATA Options
LIST SCHEMATAResult
ALL Lists schemata created by the current ident.LIST SHADOW Options
LIST SHADOWResult
ALL List shadows created on databanks created by the current ident or all shadows if the current ident has shadow privilege.LOG
Logs input, output or both to a specified sequential file.
Syntax
Description
All input, output or both will be logged in the specified sequential file.
If ON is specified a new file will always be created, otherwise the log data is appended to the file.
Logging is stopped with the SET LOG OFF command and is resumed with the SET LOG ON command.
Using the AS option, you can set the file format to UTF8, UTF16, UTF16BE, UTF16LE, UTF32, UTF32BE or UTF32LE.
READ INPUT
Reads commands from a sequential file.
Syntax
Description
Commands and SQL statements are read from the specified file.
When READ COMMAND INPUT is specified, commands are read from the file while prompt answers are taken from the terminal (batch job, command procedure).
When READ ALL INPUT or READ INPUT is specified, both commands and prompt answers are read from the sequential file.
Using the AS option, you can set the file format to UTF8, UTF16, UTF16BE, UTF16LE, UTF32, UTF32BE or UTF32LE.
SET ECHO
Controls whether or not lines read during READ INPUT are echoed.
Syntax
Description
When echo is set to ON, lines read during READ INPUT are echoed to the terminal or batch log file. When echo is set to OFF, these lines are not echoed. The default value is ON.
The setting has no effect on the output of responses to BSQL commands and statements.
SET LINECOUNT
Sets the length of the terminal page.
Syntax
Description
The LINECOUNT value defines the length of the terminal page.
If LINECOUNT has a value greater than zero, terminal output will temporarily be stopped after the number of lines defined for the value.
After the Continue-prompt, the user will have the choice of either continuing with the display or terminating the output.
Answering 'Y' (default) implies that the output will continue until the number of lines is reached again.
Answering 'N' terminates the output. Answering 'G' will ignore the line count and the output will continue until all data are displayed.
If LINECOUNT is zero, the output will continue until all data is displayed.
The value of LINECOUNT must either be zero or >= 10.
Default
If BSQL is run from a batch job, LINECOUNT is zero by default. For interactive operation, the default value is machine- and terminal-dependent.
SET LINESPACE
Sets the number of blank lines between each output record.
Syntax
Description
The LINESPACE value defines the number of blank lines to be written between each output record. This value is only used when printing the result of a SELECT statement.
The maximum value for LINESPACE is 9. The default value is 0.
SET LINEWIDTH
Specifies the width of the output.
Syntax
Description
The LINEWIDTH value defines the maximum line width for output to the terminal or batch log file.
The value for LINEWIDTH cannot be set to a value less than 20.
SET LOG
Stops or resumes logging input, output or both.
Syntax
Description
When SET LOG is set to OFF, logging of input, output or both in a sequential file is temporarily stopped.
Resume logging with the SET LOG ON command.
If no input/output log is specified, all active logs are stopped or resumed.
SET MAX_BINARY_LENGTH
Specifies the maximum display length for binary columns.
Syntax
Description
The MAX_BINARY_LENGTH value defines the number of elements that are displayed when selecting data that is defined as binary, binary varying or binary large object.
The default value is 15 000 and the value must be between 1 and 15 000.
As a binary string is shown as a hexadecimal string with two characters for each element the display length will be twice the value of MAX_BINARY_LENGTH.
SET MAX_CHARACTER_LENGTH
Specifies the maximum display length for character columns.
Syntax
Description:
The MAX_CHARACTER_LENGTH value defines the number of characters that are displayed when selecting data that is defined as CHARACTER, VARCHAR or CLOB.
The default value is 15 000 and the value must be between 1 and 15 000.
SET MESSAGE
Specifies whether or not messages should be displayed.
Syntax
Description
Specifies whether or not result messages such as One row found etc. are written to the terminal screen or batch log file.
SET OUTPUT
Specifies whether or not output should be displayed.
Syntax
Description
When OUTPUT is set to ON, the output from BSQL is written to the terminal or batch log file. When it is set to OFF, the output does not appear.
SET PAGELENGTH
Specifies the page size of the output log file.
Syntax
Description
The PAGELENGTH value defines the page size of the file on which output is logged, i.e. at what interval a page break will be performed. A value of zero will result in no page breaks.
The PAGELENGTH value can either be set to zero or >= 10. The default value is machine-dependent.
SET PAGEWIDTH
Specifies the page width of the output log file.
Syntax
Description
The PAGEWIDTH value defines the page width of the output file. The value should be greater than 20. The default value is machine-dependent.
SHOW SETTINGS
Displays the current values of all set options.
Syntax
Description
Displays the current values for all set options, i.e.
ECHO LINEWIDTH OUTPUT TRANSACTION START LINECOUNT LOG PAGELENGTH TRANSACTION ISOLATION LEVEL LINESPACE MESSAGE PAGEWIDTH TRANSACTION MODE (read only or read write)Current server and connection names are also displayed.
TRANSACTIONS
Displays the menu for administrating distributed transactions.
Syntax
Description
You can use the TRANSACTIONS command to monitor distributed transactions that are in a prepared or heuristically completed state.
Note: The TRANSACTIONS command should only be used in exceptional circumstances, such as when a transaction monitor has crashed or a network failure has occurred making it is impossible to establish contact with a transaction monitor.
The command will present the following menu:
Menu for handling distributed transactions 1. List transactions 2. Heuristic commit 3. Heuristic rollback 0. ExitThe List transactions option displays a list of all distributed transactions that are either in a prepared ore heuristically completed state. For example:
NUMBER STATUS XID ====== ========== =============================================================== 1 Prepared 34C6F6E675849446E616D6520 === 2 Prepared C6F6E675849446E616D6520 === 2 transactions foundTo heuristically commit or rollback a distributed transaction, you can choose option 2 or 3 in the menu. This will prompt for a transaction number which should correspond to a number in the listing. It is not possible to heuristically commit or rollback a distributed transaction without a prior listing.
When a distributed transaction is heuristically committed or rolled back it will remain in the list until it has been forgotten by the transaction monitor.
If transaction number 1 was heuristically committed a subsequent listing would look like this:
NUMBER STATUS XID ====== ========== =============================================================== 1 Prepared C6F6E675849446E616D6520 === 2 Committed 44C6F6E675849446E616D6520 === 2 transactions foundMore information on distributed transactions in general, can be found in the Mimer SQL Programmer's Manual, chapter 10, Distributed Transactions.
WHENEVER
Determines which actions should be taken in the event of an error or warning.
Syntax
Description
If an error or warning should occur in a file being run in batch, there are several action options that may be chosen to determine what should happen.
The actions can be broken down into two groups:
Execution Flow
|
Upright Database Technology AB Voice: +46 18 780 92 00 Fax: +46 18 780 92 40 dbtechnology@upright.se |
|
|