简体   繁体   English

如何在phpMyAdmin中编写存储过程?

[英]How to write a stored procedure in phpMyAdmin?

我无法找到在phpMyAdmin中编写存储过程的位置以及如何使用MVC架构调用它。

You can easily create procedures in phpMyAdmin. 您可以在phpMyAdmin中轻松创建过程。

  1. Go to your database. 转到您的数据库。 Click 'Routines' tab in header 单击标题中的“例程”选项卡
  2. Click on 'Add routine' 点击“添加例程”

在此输入图像描述

  1. Then a popup window will be opened. 然后会打开一个弹出窗口。 In that write your procedure and click on "GO" 在那里编写你的程序并点击“GO”

For example like follows. 例如如下。 在此输入图像描述

That's it. 而已。 You can view your created procedures under 'Routines' tab itself. 您可以在“例程”选项卡下查看创建的过程。

在此输入图像描述

In phpMyAdmin you can create the stored procedure in the SQL window. 在phpMyAdmin中,您可以在SQL窗口中创建存储过程。

You may have to set the delimieter to something like "$$" instead of the default ";". 您可能必须将分隔符设置为“$$”而不是默认的“;”。 You can change this from the bottom of the SQL window. 您可以从SQL窗口的底部更改此设置。

在此输入图像描述

Also you can refer this: http://www.mysqltutorial.org/mysql-stored-procedure-tutorial.aspx 您也可以参考: http//www.mysqltutorial.org/mysql-stored-procedure-tutorial.aspx

you can create a stored procedure in the sql query window on the phpmyadmin as you write any other query. 您可以在编写任何其他查询时在phpmyadmin的sql查询窗口中创建存储过程。 And as soon as you execute the SP, it will be stored in the database's information_schema. 一旦执行SP,它就会存储在数据库的information_schema中。 You can check the existence of SP by the following commands: 您可以通过以下命令检查SP的存在:

SHOW PROCEDURE STATUS
SHOW FUNCTION STATUS

and

SELECT ROUTINE_NAME 
FROM INFORMATION_SCHEMA.ROUTINES 
WHERE 
       ROUTINE_TYPE="PROCEDURE" 
   AND ROUTINE_SCHEMA="dbname"
;

STORED PROCEDURES are written using normal SQL language in the SQL box available in phpmyadmin->database->table->execute sql phpmyadmin->database->table->execute sql中可用的SQL框中使用普通SQL语言编写存储过程

Refer this: - http://dev.mysql.com/doc/refman/5.0/en/stored-routines.html 请参阅: - http://dev.mysql.com/doc/refman/5.0/en/stored-routines.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM