Understanding and Practice of Database-Stored Procedure

Hits: 0


The concept of the stored procedure is similar to the sh script in linux, that is, it can execute multiple commands at the same time, and can pass in parameters, etc.


create process

create procedure procedure_name()
    select name from t_user;
    select name from t_user;

delete a process
drop procedure procedure_name

Calling process
call procedure_name
You can see that the query statement is executed twice, achieving the function of executing multiple SQL statements.


The stored procedure is somewhat similar to the udf function, that is, the frequently used SQL is encapsulated into a function, which is convenient for development. However, in the existing web development, this kind of encapsulation can be realized directly by using languages ​​such as java, and it is more flexible. So stored procedures are generally not used in web programming.

You may also like...

Leave a Reply

Your email address will not be published.