如何在wampServer中构建存储过程

发布于 2024-10-09 03:10:20 字数 365 浏览 0 评论 0原文

我在 txt 文件中编写了一个存储过程,但我不知道如何在服务器中应用此存储过程。我创建了我的表。但我再次不知道为了使用存储过程我必须采取的步骤。

我的存储过程:

  CREATE PROCEDURE findHorse @horseName varchar(15) 
AS 
SELECT *
 FROM horse 
WHERE horseName =@horseName

我知道如果我想执行它,我会使用

exec findHorse 

我需要的所有内容:1.如何在mySql中创建它。 //步骤2.我应该把exec findHorse放在哪里才能执行它//步骤

i wrote a stored procedure in a txt file but i don't know how to apply this stored procedure in the server .i created my tables. but again i don't know the steps that i have to take in orded to use the stored procedure.

my stored procedure:

  CREATE PROCEDURE findHorse @horseName varchar(15) 
AS 
SELECT *
 FROM horse 
WHERE horseName =@horseName

i know that if i wante to execute it i use

exec findHorse 

all what i need are : 1. how to create it in mySql. //steps 2.where should i put exec findHorse in order to execute it //steps

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

染年凉城似染瑾 2024-10-16 03:10:20

最好安装一个数据库管理工具。如果您也安装了 PHP,则可以选择 PHPMyAdmin。您可以像执行其他 sql 语句一样执行此语句来创建过程。

调用存储过程通常在需要它们的应用程序中完成。更准确地说,如果需要它们,您通常会编写一个存储过程,这意味着您已经有了它们的应用程序。就像您可以让网站执行查询来检索正确的数据一样,它也可以执行存储过程。您有一个存储过程但不知道何时调用它,这似乎很奇怪。

It's best to install a database management tool. If you have PHP installed as well you could choose PHPMyAdmin. You can execute this statement just like other sql statement to create the procedure.

Calling stored procedures is usually done in the application that needs them. To be more precise, you usually write a stored procedure if you need them, which means you already have an application for them. Just like you can have a website executing queries to retreive the right data, it could execute stored procedures as well. It seems odd that you have a stored procedure but do not know when to call it.

瞳孔里扚悲伤 2024-10-16 03:10:20

如果您使用 phpMyAdmin 而不是 MySQL Workbench,则可以使用以下语法,而不使用 beginend 语句:

create procedure procedure_name()
//sql commands ;

If you are using phpMyAdmin instead of MySQL workbench, you can use the syntax below, without using the begin and end statements:

create procedure procedure_name()
//sql commands ;
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文