Creating a Stored Procedure
A stored procedure is a set of SQL statements used to implement specific functions. After being compiled, stored procedures are stored in databases. You can execute the stored procedures by specifying their names and related parameters.
A stored procedure consists of a set of SQL statements that can complete specific tasks or process complex services. This section describes how to create a stored procedure. You can use loop statements in a stored procedure to insert objects repeatedly.
Prerequisites
- You have obtained the CREATE ROUTINE permission.
- You have obtained the EXECUTE permission.
Procedure
- Log in to the DAS console.
- Click in the upper left corner and select a region and project.
- Click in the upper left corner, and under Databases, click Data Admin Service.
- In the navigation pane on the left, choose Development Tool.
You can also click Go to Development Tool on the overview page.
- Locate the DB instance that you want to log in to and click Log In in the Operation column.
- On the top menu bar, choose Database Management.
- Click Change on the right of the current database to switch to the database where you want to create a stored procedure.
Figure 1 Switching to another database
- On the displayed Objects page, select Stored Procedures. In the upper left corner of the page, click Create Stored Procedure.
Figure 2 Creating a stored procedure
- In the displayed dialog box, enter a stored procedure name and description and click OK.
Figure 3 Specifying stored procedure information
- Click Option in the upper left corner. In the displayed dialog box, set option parameters based on service requirements.
Figure 4 Setting parameters
- After setting the option parameters, save or execute the stored procedure.
- View the execution status in the Message area.
Figure 5 Viewing the execution of the stored procedure
Feedback
Was this page helpful?
Provide feedbackThank 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