Open Source RDBMS - Seamless, Scalable, Stable and Free

한국어 | Login |Register

Versions available for this page: CUBRID 8.2.1 |  CUBRID 8.3.0 |  CUBRID 8.3.1 |  CUBRID 8.4.0 |  CUBRID 8.4.1 |  CUBRID 8.4.3 |  CUBRID 9.0.0 | 

EXECUTE Statement

Description

The EXECUTE statement executes the prepared statement. You can bind the data value after the USING clause if a bind parameter (?) is included in the prepared statement. You cannot specify user-defined variables like an attribute in the USING clause. An value such as literal and an input parameter only can be specified.

Syntax

EXECUTE stmt_name [USING value [, value] …]

  • stmt_name : The name given to the prepared statement to be executed is specified. An error message is displayed if the stmt_name is not valid, or if the prepared statement does not exist.
  • value : The data to bind is specified if there is a bind parameter in the prepared statement. The number and the order of the data must correspond to that of the bind parameter. If it does not, an error message is displayed.
Example

;clear

EXECUTE stmt1

;ru

 

ERROR: A prepared statement with the name stmt1 does not exist.

 

--prepare and execute a statement

PREPARE stmt2 FROM 'SELECT MID(?,?,?)';

EXECUTE stmt2 USING '12345abcdeabcde',6,5;

EXECUTE stmt2 USING '12345abcdeabcde',6,10;

;ru

 

Current transaction has been committed.

 

=== <Result of SELECT Command in Line 1> ===

 

   mid( ?:0 ,  ?:1 ,  ?:2 )

======================

  'abcde'

 

=== <Result of SELECT Command in Line 2> ===

 

   mid( ?:0 ,  ?:1 ,  ?:2 )

======================

  'abcdeabcde'