我在下面的代码中得到一个错误。我在问题所在的地方添加了一个arror<-------
。
Error(27,6): PLS-00103: Encountered the symbol "BEGIN" when expecting one of the following: then and or The symbol "then" was substituted for "BEGIN" to continue.
Error(30,6): PLS-00103: Encountered the symbol "END" when expecting one of the following: , ; return returning
create or replace PROCEDURE "sp_updateUserPassword"(newUserPwd IN VARCHAR2, curIsoUserUID IN NUMBER)
IS
curUserID NUMBER;
userDateCreated DATE;
oldUserPwd VARCHAR2(255);
BEGIN
SELECT ISOUID INTO curUserID FROM ISOUSERS WHERE ISOUID=curIsoUserUID;
SELECT DATECREATE INTO userDateCreated FROM ISOUSERS WHERE ISOUID=curIsoUserUID;
SELECT PASSWORD INTO oldUserPwd FROM ISOUSERS WHERE ISOUID=curIsoUserUID;
IF(newUserPwd = oldUserPwd)
THEN
raise_application_error(-20000, 'The new password must be different from the previous password');
RETURN;
END IF;
IF NOT EXISTS
(
SELECT ISOUID
FROM OLDUSERPASSWORDS
WHERE ISOUID=curIsoUserUID
)
BEGIN <------------ Error is here
INSERT INTO OLDUSERPASSWORDS(ISOUID, DATECREATE, DATELASTCHANGE, CURRENTPASS, OLDPASS)
VALUES(curUserID, userDateCreated, SYSDATE, newUserPwd, oldUserPwd)
END;
/*raise_application_error(-20000, 'TEST');*/
END "sp_updateUserPassword";
IF NOT EXISTS
(
SELECT ISOUID
FROM OLDUSERPASSWORDS
WHERE ISOUID=curIsoUserUID
)
THEN
BEGIN
INSERT INTO OLDUSERPASSWORDS(ISOUID, DATECREATE, DATELASTCHANGE, CURRENTPASS, OLDPASS)
VALUES(curUserID, userDateCreated, SYSDATE, newUserPwd, oldUserPwd)
END;
END IF;
Error(30,7): PL/SQL: ORA-00933: SQL command not properly ended
Error(31,7): PLS-00103: Encountered the symbol "IF" when expecting one of the following: ; <an identifier> <a double-quoted delimited-identifier>
正确的语法是:
IF condition THEN
statements
END IF;
您的代码实际上是:
IF condition THEN
BEGIN
statements
END;
IF NOT EXISTS
(
SELECT ISOUID
FROM OLDUSERPASSWORDS
WHERE ISOUID=curIsoUserUID
)
THEN
BEGIN <------------ Error is NOT here
INSERT INTO OLDUSERPASSWORDS(ISOUID, DATECREATE, DATELASTCHANGE, CURRENTPASS, OLDPASS)
VALUES(curUserID, userDateCreated, SYSDATE, newUserPwd, oldUserPwd);
END;
END IF;
请帮我找出这个错误的原因 代码如下:
堆栈跟踪: [SqlException(0x80131904):关键字“from”附近语法不正确。] System.Data.sqlclient.sqlConnection.onerror(SqlException exception,Boolean breakConnection,Action`1 wrapCloseInAction)+1791910 System.Data.sqlClient.
问题内容: 您好,我试图弄清楚为什么在MSSQL中将兼容模式从80切换为100会破坏下面的功能? 这是我的功能: 问题答案: 尝试在with前面加一个半冒号: 给这篇文章读明白,为什么你需要做到这一点。尖刺: 但是,如果CTE不是批处理中的第一条语句,则必须在WITH关键字之前加上分号。作为一种最佳实践,我宁愿在所有CTE前面加上分号,以使这种一致的方法比记住我是否需要分号更容易。 就个人而言,我
我不熟悉SQL和visual studio等,但我改变了一些不允许我登录应用程序的内容。每当我按下登录按钮时,就会出现此错误 关键字“from”附近的语法不正确 这就是源头所在;
问题内容: 你好,我试图弄清楚为什么我有这个错误 关键字“表格”附近的语法不正确。 提前Thx 代码 : 问题答案: 发生这种情况是因为TABLE是T-SQL的保留关键字。 如果您确实需要使用该名称,则查询应将TABLE括在方括号中 我强烈建议更改该名称,并对该表的内容使用更具描述性的词