用于更新存储过程的脚本 [英] Script for update stored procedure

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

问题描述

我需要在mysql中为upadate存储过程编写一个脚本,这是我的代码,但有些不好,有人可以帮帮我吗?谢谢!



我尝试了什么:



Hi , i need to write a script for upadate stored procedure in mysql, this is my code , but someting is not good , can anyone help me? Thanks!

What I have tried:

CREATE DEFINER=`root`@`localhost` PROCEDURE `table_upd`
   (IN customer_id int, IN cname_param VARCHAR(45),IN lastname_param VARCHAR(45), IN date_of_birth_param DATE,
    IN country_param VARCHAR(45), IN email_param VARCHAR(100), IN username_param VARCHAR(45), IN short_biography_param TEXT
   )
BEGIN
  UPDATE customer 
  SET    cname = cname_param, 
         lastname = lastname_param, 
         date_of_birth = date_of_birth_param, 
         country = country_param, 
         email = email_param, 
         username = username_param, 
         short_biography = short_biography_param
  WHERE customer_ID=customer_id;
END

推荐答案

你需要解决问题如果你直接运行脚本而不是程序运行脚本会发生什么?

- 你以编程方式创建了什么值 - 它们是正确的类型吗?

- 你是否正确引用你的变量?

参见:http://www.w3resource.com/mysql/mysql-procedure.php



在上面的参考文献中,他们指出你如何引用一个值取决于它是否是程序的本地。这vs @this
You need to break your problem down into independent parts.
- what happens if you run the script directly instead of in your program?
- what values are you creating, programmatically - are they the right types?
- are you properly referencing your variables?
See: http://www.w3resource.com/mysql/mysql-procedure.php

In the above reference, they point out that how you reference a value depends upon whether it's local to the procedure or not. this vs @this


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

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