Open Source RDBMS - Seamless, Scalable, Stable and Free

한국어 | Login |Register

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

PREPARE Statement


The PREPARE statement prepares the query specified in preparable_stmt of the FROM clause and assigns the name to be used later when the SQL statement is referenced to stmt_name. See EXECUTE Statement for example.


PREPARE stmt_name FROM preparable_stmt

  • stmt_name: The prepared statement is specified. If an SQL statement with the same stmt_name exists in the given client session, clear the existing prepared statement and prepare a new SQL statement. If the PREPARE statement is not executed properly due to an error in the given SQL statement, it is processed as if the stmt_name assigned to the SQL statement does not exist.
  • preparable_stmt: You must use only one SQL statement. Multiple SQL statements cannot be specified. You can use a question mark (?) as a bind parameter in the preparable_stmt statement and it should not be enclosed with quotes.

The PREPARE statement starts by connecting an application to a server and will be maintained until the application terminates the connection. The connection maintained during this period is called a session. You can set the session time with the session_state_timeout parameter of cubrid.conf; the default value is 21600 seconds (=6 hours).

The data managed by the session includes the PREPARE statement, user-defined variables, the last ID inserted (LAST_INSERT_ID), and the number of rows affected by the statement (ROW_COUNT) that you execute at the end.