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

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

问题描述

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

I must add stored procedures to MySQL database.

问题是托管提供了 phpMyAdmin 来管理数据库.

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

我在网上查了一下,想法是运行创建程序的MySQL native语句,但是由于程序的代码经常可能有;,所以我们不得不改变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?

推荐答案

有办法,看这个链接:http://blog.nth-design.com/2009/02/25/creating-sp-in-phpmyadmin/

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天全站免登陆