在MySQL查询,但我需要一些帮助 [英] query in mysql but i need some help

查看:83
本文介绍了在MySQL查询,但我需要一些帮助的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经写了一个查询,但是它不在运行,出现错误,请指出.

i have written a query ,but it''s not running where is error please point me out.

CREATE PROCEDURE InsertName
(
`username` VARCHAR(300),
`password` VARCHAR(300)
)
AS
IF EXISTS (SELECT id FROM users WHERE `username` =`username` AND `password`=`password`)
ELSE 
BEGIN  
 INSERT INTO users
(
   `firstname`,`lastname`,`email`,`contact`,`username`,`password`,`sec_question`,`sec_answer`
)
VALUES
(
  `firstname`=`firstname`,`lastname`=`lastname`,`email`=`email`,`contact`=`contact`,`username`=`username`,`password`=`password`,
`sec_question`=`sec_question`,`sec_answer`=`sec_answer`
);
END;

推荐答案

遵循正确的语法来处理存储过程,在第一行中本身,您不能声明"firstname",它应为:@firstname VARCHAR(300)

在Google中搜索存储过程,您可以找到更多
follow the proper syntax for vreating stored procedure, in the first line itself u cannot declare ''firstname'' it should be as:@firstname VARCHAR(300)

search for the stored procedures in google u can find there many more


这篇关于在MySQL查询,但我需要一些帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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