当我尝试创建以下程序时,我得到了这个错误:“PLS-00103:当遇到以下情况之一时遇到符号”=“: 我无法找到我出错的地方,请帮我解决这个问题。
create or replace PROCEDURE ProcName
(inTid IN VARCHAR2,outtxnstatus OUT CHAR,outrowcount OUT NUMBER,outretvalue OUT NUMBER) AS
CURSOR c1 IS
select TXN_STATUS from OP_TTERMINALMASTER where TERMINAL_ID = inTid and TXN_STATUS = 'N' FOR UPDATE OF TXN_STATUS;
outrowcount:= sql%rowcount;
BEGIN
if outrowcount = 1 then
Open c1;
fetch c1 into outtxnstatus;
update OP_TTERMINALMASTER set TXN_STATUS = 'Y' where current of c1;
outretvalue := 5;
CLOSE c1;
END IF;
EXCEPTION
WHEN NO_DATA_FOUND THEN
outretvalue := -5;
END;
答案 0 :(得分:3)
我认为它就在这里(BEGIN
之前):
outrowcount:= sql%rowcount;
您在正确的位置声明了一个光标,但是在begin
部分之前,您甚至在打开光标之前指定sql%rowcount
...
尝试
create or replace PROCEDURE ProcName
(inTid IN VARCHAR2,outtxnstatus OUT CHAR,outrowcount OUT NUMBER,outretvalue OUT NUMBER) AS
BEGIN
update OP_TTERMINALMASTER set TXN_STATUS = 'Y'
where TERMINAL_ID = inTid and TXN_STATUS = 'N';
outrowcount:= sql%rowcount;
outretvalue := 5;
EXCEPTION
WHEN NO_DATA_FOUND THEN
outretvalue := -5;
END;