Procedure documentationExecuting a Single Database Statement Locate this document in the navigation structure

 

You can use the DBM command db_execute to execute a database statement.

The Database Manager implicitly opens and then closes the required database session during execution of the database statement. The Database Manager uses the data for the first DBM operator to open a database session implicitly. Only those database statements for which the first DBM operator is authorized can therefore be executed in this way.

The database session is always opened in AUTOCOMMIT mode. This means that executed SQL statements are automatically closed with a COMMIT statement and therefore cannot be rolled back with a ROLLBACK statement.

If you use db_execute, the result set may exceed the size of the reply package (approx. 16 KB). In this case, the keyword CONTINUE at the end of the output indicates that there are more data records. To display all records of the result set, perform the steps described in Executing a Succession of Database Statements, You will have to execute several database statements within the same database session.

You can also display the result set record-by-record. As this option also requires that you execute several database statements within the same database session, also perform the steps described in Executing a Succession of Database Statements here.

Scenario

You want to execute the SQL statement for displaying the contents of the table users and you want to display the largest-possible number of data records in the reply.

Prerequisites

You can find the prerequisites under Database Manager CLI, db_execute.

Procedure

Log on to Database Manager CLI as operator OLEG with password MONDAY, connect to database DEMODB, and execute the SQL statement for displaying the contents of table users (here: the contents of columns user name, connection mode, and user ID):

>dbmcli -u OLEG,MONDAY -d DEMODB db_execute SELECT username,connectmode,user_id from users

OK

END

'DBM';'MULTIPLE';22

'OLEG';'MULTIPLE';0

'DBADMIN';'MULTIPLE';10

'MONA';'MULTIPLE';24

More Information

Glossary, AUTOCOMMIT Mode, ROLLBACK