我在DB2数据库中创建了一个存储过程,这是我的存储过程代码:
CREATE OR REPLACE PROCEDURE PWDCHANGE (UNAME IN VARCHAR(32),
OLDPWD IN VARCHAR(32),
NEWPWD IN VARCHAR(32))
AS
BEGIN
IF LOGINTABLE.USERNAME = UNAME AND LOGINTABLE.PASSWORD = OLDPWD THEN
UPDATE LOGINTABLE SET PASSWORD = NEWPWD;
DBMS_OUTPUT.PUT_LINE('Password Changed Successfully!');
ELSE DBMS_OUTPUT.PUT_LINE('Incorrect Old Password Input');
END IF;
END;
但是当我在IBM Data Studio中部署它时,它会显示一个错误:
Deploy SENJOBLADE.PWDCHANGE(VARCHAR(32), VARCHAR(32), VARCHAR(32))
Running
SENJOBLADE.PWDCHANGE - Deploy started.
Create stored procedure returns SQLCODE: -104, SQLSTATE: 42601.
SENJOBLADE.PWDCHANGE: 1: An unexpected token "VARCHAR" was found following "PWDCHANGE (UNAME IN". Expected tokens may include: ",".. SQLCODE=-104, SQLSTATE=42601, DRIVER=4.13.111
An unexpected token "VARCHAR" was found following "PWDCHANGE (UNAME IN". Expected tokens may include: ",".. SQLCODE=-104, SQLSTATE=42601, DRIVER=4.13.111
SENJOBLADE.PWDCHANGE - Deploy failed.
SENJOBLADE.PWDCHANGE - Roll back completed successfully.
我不知道为什么VARCHAR是一个意外的令牌,我不知道要改变什么才能部署我的存储过程。此存储过程的功能是接受3个用于密码更改的输入,用户名,当前密码和替换密码,这就是我有3个IN值的原因。
SENJOBLADE是我的模式名称,LOGINTABLE是表名,它有两列,USERNAME&密码栏
我尝试删除VARCHAR并显示以下错误:
Deploy SENJOBLADE.PWDCHANGE(IN, IN, IN)
Running
SENJOBLADE.PWDCHANGE - Deploy started.
Create stored procedure returns SQLCODE: -104, SQLSTATE: 42601.
SENJOBLADE.PWDCHANGE: 2: An unexpected token "BEGIN" was found following "PWD IN)
AS
". Expected tokens may include: ":".. SQLCODE=-104, SQLSTATE=42601, DRIVER=4.13.111
An unexpected token "BEGIN" was found following "PWD IN)
AS
". Expected tokens may include: ":".. SQLCODE=-104, SQLSTATE=42601, DRIVER=4.13.111
SENJOBLADE.PWDCHANGE - Deploy failed.
SENJOBLADE.PWDCHANGE - Roll back completed successfully.
请帮忙,我还在学习存储过程,所以我还没有习惯。任何帮助将不胜感激,谢谢!
答案 0 :(得分:0)
尝试Deploy SENJOBLADE.PWDCHANGE(UNAME, OLDPWD, NEWPWD)