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

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/17481890/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 12:57:53  来源:igfitidea点击:

How to write a stored procedure in phpMyAdmin?

phpmysqlstored-proceduresphpmyadmin

提问by KVK_cool

I am not able to find where to write the stored procedure in phpMyAdmin and how to call it using MVC architecture.

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

回答by Krishna Mohan

You can easily create procedures in phpMyAdmin.

您可以在 phpMyAdmin 中轻松创建程序。

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

enter image description here

在此处输入图片说明

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

For example like follows. enter image description here

例如如下。 在此处输入图片说明

That's it. You can view your created procedures under 'Routines' tab itself.

就是这样。您可以在“例程”选项卡本身下查看您创建的程序。

enter image description here

在此处输入图片说明

回答by Sathish D

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 窗口的底部更改此设置。

enter image description here

在此处输入图片说明

Also you can refer this: http://www.mysqltutorial.org/mysql-stored-procedure-tutorial.aspx

你也可以参考这个:http: //www.mysqltutorial.org/mysql-stored-procedure-tutorial.aspx

回答by Md Jawed Shamshedi

you can create a stored procedure in the sql query window on the phpmyadmin as you write any other query. And as soon as you execute the SP, it will be stored in the database's information_schema. You can check the existence of SP by the following commands:

您可以在编写任何其他查询时在 phpmyadmin 的 sql 查询窗口中创建存储过程。并且只要您执行 SP,它就会存储在数据库的 information_schema 中。可以通过以下命令检查SP是否存在:

SHOW PROCEDURE STATUS
SHOW FUNCTION STATUS

and

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

回答by Admin at dekho-ji.com

STORED PROCEDURES are written using normal SQL language in the SQL box available in phpmyadmin->database->table->execute sql

存储过程是使用普通 SQL 语言在可用的 SQL 框中编写的 phpmyadmin->database->table->execute 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