在phpMyAdmin中存储过程 [英] Store procedures in phpMyAdmin

查看:88
本文介绍了在phpMyAdmin中存储过程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须将存储过程添加到MySQL数据库.

I must add stored procedures to MySQL database.

问题在于主机提供 phpMyAdmin 来管理数据库.

The problem is that the hosting offers phpMyAdmin to manage the database.

我在Internet上进行了搜索,其想法是运行创建过程的MySQL本机语句,但是由于过程代码通常可能具有;,因此我们必须更改MySQL中的定界符.

I searched on the Internet and the idea is to run the MySQL native statement that creates the procedures, but as the code of procedures often may have ;, we have to change the delimiter in MySQL.

phpMyAdmin 没有此选项.有没有人试图手动设置锚点来创建存储过程,或者有什么用?

phpMyAdmin does not have this option. Has anyone tried to create stored procedures manually setting the anchor, or something that worked?

推荐答案

有一种方法,请参见以下链接:

There is a way, see this link: http://blog.nth-design.com/2009/02/25/creating-sp-in-phpmyadmin/

从该链接引用
1.打开phpMyadmin.
2.选择要使用的数据库.
3.打开SQL选项卡.
4.在存储过程脚本中的DELIMITER语句之间选择所有SQL语句. 请勿包含DELIMITER语句!这是我的示例脚本的外观:

Quote from that link
1.Open phpMyadmin.
2.Select a database to work with.
3.Open the SQL tab.
4.Select all of the SQL statements between the DELIMITER statements in your stored procedure script. Do not include the DELIMITER statements! Here’s what my example script should look like:

DROP PROCEDURE IF EXISTS spFoo $$
CREATE PROCEDURE spFoo ()
BEGIN
    SELECT 'Foo' FROM DUAL;
END $$

5.在分隔符字段中, SQL编辑器的文本区域正下方,输入$$作为分隔符.

5.In the delimiter field, just below the SQL editor’s text area, enter $$ as your delimiter.

这篇关于在phpMyAdmin中存储过程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆