EXECUTE COMMAND

Executes a stored command.

SYNTAX

command_name Name of the stored command you want to execute.
value Input parameter that corresponds to a host variable in the stored command.

DESCRIPTION

The EXECUTE COMMAND command executes a stored command. You can use stored commands to quickly and conveniently execute frequently used SQL data-manipulation statements without entering them repeatedly. To execute the EXECUTE COMMAND command, you must have DBA or SYSADM security privileges, or have the EXECUTE privilege on that command.

A stored command is an SQL data-manipulation statement that is compiled and permanently stored in the database in executable format. This allows you to repeatedly execute the stored command without waiting for DBMaker to compile and optimize the command each time you use it. Stored commands are similar to stored procedures, except they can only contain a single command and cannot contain program logic.

You can use host variables as placeholders for column values in the SQL statement of a stored command. This allows you to assign actual values to the column when you execute the command, instead of when you create it. To use host variables in a stored command, replace any data or column value with a question mark symbol (?).

When you execute a stored command that has host variables, you can use constants, results from built-in functions, the NULL keyword, the DEFAULT keyword, or another host variable. You can only use built-in functions that have no argument, such as RAND(), PI(), CURDATE(), or NOW(), when providing a value for a host variable. If you use a NULL value for the host variable, the value represented by the host variable must be capable of accepting NULL values. The number of parameters you provide when executing a stored command must equal the number of host variables in the command definition.

EXAMPLE

The following example executes the stored command named sc1. This stored command has no input parameters.

EXECUTE COMMAND sc1

The following example executes the stored command named sc2. This stored command has two input parameters that you must provide a value for.

EXECUTE COMMAND sc2(10002, 10006)

RELATED COMMANDS

< END BACKUP | Contents | GRANT (Execute Privileges) >

Copyright 2002 SYSCOM Computer Engineering Co. All rights reserved.