You use a DBM command to transfer an SQL statement to the database instance.
Unlike when using the sql_executenice DBM command, you want the reply to display as many data records as possible. The quantity of data transferred is limited by the size of the reply package transferred by the DBM server.
With SELECT statements, the system displays the data records of the reply. If not all the data can be displayed because of the limited reply package size, you can use the sql_fetch DBM command to transfer another reply package containing data records. However, this is only possible if you are still in the same database session.
If you specify other SQL statements, the execution of the statement is confirmed with an OK message.
When you execute this command, it implicitly opens a session with the database instance and then ends the session once the command has been executed. This database session is opened in AUTOCOMMIT mode, in other words, each SQL statement that is specified is automatically completed with a COMMIT statement.
If a series of SQL statements are to be executed and they can only be executed by a particular database user, we recommend first starting an SQL session with the data of this database user (see: sql_connect), executing all SQL statements and then either closing the SQL session (see: sql_release) or the Database Manager CLI.
For more information about SQL statements, see the SQL Reference Manual and SQL Tutorial.
See also:
Database Administration Tutorial, Operating Modes in the Database Manager CLI, Executing Database Statements
Concepts of the Database System, SQL
Prerequisites
● You are working in the session mode of the Database Manager CLI.
● You have the server authorization AccessSQL.
sql_execute [<user_type>] <statement>
<user_type> : = user-type=<value>
Options
Option |
Description |
<statement> |
SQL Statement |
<database_user> |
Name of the database user |
<database_user_password> |
Password of the database user |
user-type=<value> |
User type, possible values are: DBM: first DBM operator DBA: database administrator SAP: special database user in connection with SAP applications |
OK
[END|CONTINUE]
[<record>
<record>
...]
Values for the Reply Fields
Value |
Description |
END |
The complete reply was output. |
CONTINUE |
More data records are available but were not transferred due to the limited size of the reply package. |
<record> |
Result data of the SQL statements The
fields in a data record are separated by semicolons. |
In the event of errors, see Reply Format.
...
Call the Database Manager CLI in session mode, log on as operator OLEG with the password MONDAY, connect to the DEMODB database instance, display the columns of the USERS table with the relevant comments:
>dbmcli -u OLEG,MONDAY -d DEMODB
dbmcli on DEMODB>sql_execute SELECT columnname, comment FROM domain.columns WHERE tablename = 'USERS'
OK
END
'OWNER';(long)
'GROUPNAME';(long)
'USERNAME';(long)
'USERMODE';(long)
'CONNECTMODE';(long)
'MAXTIMEOUT';(long)
'COSTWARNING';(long)
'COSTLIMIT';(long)
'DEFAULTCODE';(long)
'CREATEDATE';(long)
'CREATETIME';(long)
'ALTERDATE';(long)
'ALTERTIME';(long)
'PWCREADATE';(long)
'PWCREATIME';(long)
'SERVERDB';(long)
'SERVERNODE';(long)
'USER_ID';(long)
'ISREPLICATIONUSER';(long)
'COMMENT';(long)