In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
This article will explain in detail how to create stored procedures in navicat. The editor thinks it is very practical, so I share it for you as a reference. I hope you can get something after reading this article.
How does navicat create stored procedures?
1. Use Navicat Premium to open the create function wizard, and operate as follows: connection name-Database-function-New function
2. Select the procedure-enter the parameters of the stored procedure-complete (this step allows you to set the parameters when writing the stored procedure code)
3. Complete the coding of the stored procedure as required
BEGIN DECLARE t_error INTEGER DEFAULT 0; DECLARE CONTINUE HANDLER FOR SQLEXCEPTION SET tactile errorists 1 MONTH # ensure data consistency start transaction START TRANSACTION; # get the time node that needs to be synchronized (the first day 3 months ago) # that is, the current date 2018-07-10 @ upmonth date 2018-04-018 SET @ upmonth= DATE_ADD (CURDATE ()-DAY (CURDATE ()) + 1, INTERVAL-3 MONTH) # migrate data statement SET @ sqlstr=CONCAT ('INSERT INTO fd_aseet_record_back_3_6 SELECT * FROM fd_asset_record WHERE type in (3,6) AND calendar_date '); # delete data statement SET @ delsqlstr=CONCAT ('DELETE FROM fd_asset_record WHERE type in (3,6) AND calendar_date '); # execute data migration PREPARE _ fddatamt FROM @ sqlstr; EXECUTE _ fddatamt USING @ upmonth; DEALLOCATE PREPARE _ fddatamt # data deletion after migration PREPARE _ fddatadel FROM @ delsqlstr; EXECUTE _ fddatadel USING @ upmonth; DEALLOCATE PREPARE _ fddatadel; IF t_error = 1 THEN ROLLBACK; # statement exception-rollback ELSE COMMIT; # commit transaction END IF; END
4. Save-enter the name of the stored procedure-determine
5. Select the stored procedure name, run the function, and view the result
Extended data
A stored procedure (Stored Procedure) is a set of SQL statements in a large database system in order to perform a specific function. It is stored in the database and is permanently valid after compilation. The user executes it by specifying the name of the stored procedure and giving parameters (if the stored procedure has parameters). Stored procedure is an important object in database. It is mainly divided into the following categories.
1 system stored procedure
Starting with sp_, it is used to set up the system. Get the information. Related management work.
2 Local stored procedures
The stored procedure created by the user is the stored procedure created by the user and completes a specific function. In fact, the stored procedure generally refers to the local stored procedure.
3 temporary stored procedure
There are two types of stored procedures:
One is a local temporary stored procedure, with the pit sign (#) as the first character of its name, the stored procedure will become a local temporary stored procedure stored in the tempdb database, and only the user who created it can execute it
The second is the global temporary stored procedure, which starts with two pit signs (# #), then the stored procedure will become a global temporary stored procedure stored in the tempdb database. Once the global temporary stored procedure is created, any user who connects to the server can execute it later, and does not require specific permissions.
4 remote stored procedure
In SQL Server2005, a remote stored procedure (Remote Stored Procedures) is a stored procedure located on a remote server, and a remote stored procedure can usually be executed using distributed queries and EXECUTE commands.
5 extended stored procedures
Extended stored procedures (Extended Stored Procedures) are stored procedures that users can write in an external programming language, and the name of the extended stored procedure usually begins with xp_.
This is the end of this article on how to create stored procedures in navicat. I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it out for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.