PREPARE
Syntax
PREPARE statement_name FROM statement
Description
This statement is used to preprocess a statement for later execution. A preprocessing statement is used to save a query in a session with a specified name. A statement can contain parameters to replace the text to be replaced during execution. The parameters are represented by question marks (?).
Example
- To preprocess a query:
PREPARE my_select1 FROM SELECT * FROM fruit;
- The following shows how to preprocess a query that contains parameters. In EXECUTE, the values compared with regionkey and nationkey are replaced.
PREPARE my_select2 FROM SELECT name FROM fruit WHERE name= ? AND price< ?;
- To preprocess INSERT query:
PREPARE my_insert FROM INSERT INTO fruit VALUES ('watermelon',18);
What is your overall rating for this page?
Thank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot